@letta-ai/letta-code 0.34.44 → 0.34.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/agent-presets.js +9 -26
  2. package/dist/agent-presets.js.map +5 -6
  3. package/dist/app-server-client.cjs.map +2 -2
  4. package/dist/app-server-client.js.map +2 -2
  5. package/dist/channels-public.js +1 -1
  6. package/dist/channels-public.js.map +3 -3
  7. package/dist/mcp-client.js +2 -2
  8. package/dist/mcp-client.js.map +1 -1
  9. package/dist/mcp-oauth.js +2 -2
  10. package/dist/mcp-oauth.js.map +1 -1
  11. package/dist/types/agent/create-agent-request.d.ts.map +1 -1
  12. package/dist/types/agent/memory-git-hooks.d.ts.map +1 -1
  13. package/dist/types/agent/model-catalog.d.ts +7 -0
  14. package/dist/types/agent/model-catalog.d.ts.map +1 -1
  15. package/dist/types/cli/helpers/error-formatter.d.ts +2 -0
  16. package/dist/types/cli/helpers/error-formatter.d.ts.map +1 -1
  17. package/dist/types/constants.d.ts +0 -8
  18. package/dist/types/constants.d.ts.map +1 -1
  19. package/dist/types/tools/external-tool-types.d.ts +0 -2
  20. package/dist/types/tools/external-tool-types.d.ts.map +1 -1
  21. package/dist/types/tools/manager.d.ts +2 -2
  22. package/dist/types/tools/manager.d.ts.map +1 -1
  23. package/dist/types/tools/tool-policy.d.ts +18 -0
  24. package/dist/types/tools/tool-policy.d.ts.map +1 -0
  25. package/dist/types/tools/toolset.d.ts +4 -2
  26. package/dist/types/tools/toolset.d.ts.map +1 -1
  27. package/dist/types/types/app-server-info.d.ts +2 -0
  28. package/dist/types/types/app-server-info.d.ts.map +1 -1
  29. package/dist/types/types/external-tool-protocol.d.ts +26 -3
  30. package/dist/types/types/external-tool-protocol.d.ts.map +1 -1
  31. package/dist/types/types/input-create-message.d.ts +0 -2
  32. package/dist/types/types/input-create-message.d.ts.map +1 -1
  33. package/dist/types/types/queue-update-protocol.d.ts +6 -0
  34. package/dist/types/types/queue-update-protocol.d.ts.map +1 -1
  35. package/dist/types/types/runtime-start-protocol.d.ts +6 -1
  36. package/dist/types/types/runtime-start-protocol.d.ts.map +1 -1
  37. package/dist/types/utils/image-resize.d.ts.map +1 -1
  38. package/dist/types/utils/secrets-store.d.ts +9 -1
  39. package/dist/types/utils/secrets-store.d.ts.map +1 -1
  40. package/dist/types/websocket/listener/conversation-runtime.d.ts.map +1 -1
  41. package/dist/types/websocket/listener/types.d.ts +0 -1
  42. package/dist/types/websocket/listener/types.d.ts.map +1 -1
  43. package/image-resize-worker.js +3 -4
  44. package/letta.js +311 -614
  45. package/npm-shrinkwrap.json +155 -732
  46. package/package.json +3 -4
  47. package/scripts/isolated-unit-tests.json +15 -0
  48. package/scripts/smoke-image-worker.mjs +29 -4
  49. package/scripts/source-file-size-baseline.json +6 -6
  50. package/scripts/stage-pypi-deps.mjs +0 -1
  51. package/skills/working-across-computers/SKILL.md +3 -0
package/letta.js CHANGED
@@ -6077,7 +6077,7 @@ var package_default;
6077
6077
  var init_package = __esm(() => {
6078
6078
  package_default = {
6079
6079
  name: "@letta-ai/letta-code",
6080
- version: "0.34.44",
6080
+ version: "0.34.46",
6081
6081
  lettaStartupLogProtocol: 1,
6082
6082
  lettaConfigDirProtocol: 1,
6083
6083
  description: "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
@@ -6230,7 +6230,6 @@ var init_package = __esm(() => {
6230
6230
  dependencies: {
6231
6231
  "@cursor/sdk": "1.1.0",
6232
6232
  "@earendil-works/pi-ai": "^0.99.1",
6233
- "@janhapke/sharp-electron": "0.35.3-electron.1",
6234
6233
  "@letta-ai/letta-agent-sdk": "0.8.38",
6235
6234
  "@letta-ai/letta-client": "^1.10.2",
6236
6235
  "@letta-ai/trajectory": "0.2.0",
@@ -6246,7 +6245,7 @@ var init_package = __esm(() => {
6246
6245
  "node-pty": "^1.1.0",
6247
6246
  open: "^10.2.0",
6248
6247
  react: "18.2.0",
6249
- sharp: "^0.34.5",
6248
+ sharp: "^0.35.5",
6250
6249
  shiki: "^4.0.2",
6251
6250
  "strip-ansi": "^7.2.0",
6252
6251
  ws: "^8.19.0"
@@ -6355,7 +6354,7 @@ var init_package = __esm(() => {
6355
6354
  },
6356
6355
  lettaLifecycleProtocol: 1,
6357
6356
  lettaRuntimeGraphProtocol: 1,
6358
- lettaRuntimeGraphSha512: "sha512-x6CZjpXvXckGCycYwdxVs0W3XTf6uzPH1il5cUWVWlNkC2w7naCOb53kNlJ0PC9/t6XHtxAPZhqhWJUlOKG2lg==",
6357
+ lettaRuntimeGraphSha512: "sha512-DMyrwe+kalQ3U0ncY7kalXtOWp1QE7bh32cJNtGoERBViCd8eeb0avXJTTyM3TSLUTzaKyZ58TXwUiZeLLGDew==",
6359
6358
  patchedDependencies: {
6360
6359
  "@earendil-works/pi-ai@0.99.1": "patches/@earendil-works%2Fpi-ai@0.99.1.patch"
6361
6360
  }
@@ -99417,16 +99416,6 @@ var init_context = __esm(() => {
99417
99416
  context2 = getContext();
99418
99417
  });
99419
99418
 
99420
- // src/constants.ts
99421
- var DEFAULT_SUMMARIZATION_MODEL = "letta/auto", DEFAULT_TITLE_SUMMARIZATION_MODEL = "openai/gpt-6-luna", DEFAULT_AGENT_NAME = "Letta Code", INTERRUPTED_BY_USER = "Interrupted by user", TURN_DID_NOT_COMPLETE = "Turn did not complete", SYSTEM_REMINDER_TAG = "system-reminder", SYSTEM_REMINDER_OPEN, SYSTEM_REMINDER_CLOSE, SYSTEM_ALERT_TAG = "system-alert", SYSTEM_ALERT_OPEN, SYSTEM_ALERT_CLOSE, COMPACTION_SUMMARY_HEADER = "(Earlier messages in this conversation have been compacted to free up context, summarized below)", TOKEN_DISPLAY_THRESHOLD = 100, ELAPSED_DISPLAY_THRESHOLD_MS;
99422
- var init_constants2 = __esm(() => {
99423
- SYSTEM_REMINDER_OPEN = `<${SYSTEM_REMINDER_TAG}>`;
99424
- SYSTEM_REMINDER_CLOSE = `</${SYSTEM_REMINDER_TAG}>`;
99425
- SYSTEM_ALERT_OPEN = `<${SYSTEM_ALERT_TAG}>`;
99426
- SYSTEM_ALERT_CLOSE = `</${SYSTEM_ALERT_TAG}>`;
99427
- ELAPSED_DISPLAY_THRESHOLD_MS = 60 * 1000;
99428
- });
99429
-
99430
99419
  // src/agent/memory-constants.ts
99431
99420
  var READ_ONLY_BLOCK_LABELS;
99432
99421
  var init_memory_constants = __esm(() => {
@@ -101785,26 +101774,18 @@ function resolveModel(modelIdentifier) {
101785
101774
  return builtinHandle;
101786
101775
  return modelIdentifier.includes("/") ? modelIdentifier : null;
101787
101776
  }
101777
+ function isLettaHostedModelHandle(handle) {
101778
+ return handle.startsWith("letta/");
101779
+ }
101788
101780
  function getDefaultModel() {
101789
- if (models2.length === 0)
101790
- return "letta/auto";
101791
- const autoModel = models2.find((model) => model.id === "auto");
101792
- if (autoModel)
101793
- return autoModel.handle;
101794
- const defaultModel = models2.find((model) => model.isDefault);
101795
- if (defaultModel)
101796
- return defaultModel.handle;
101797
- const firstModel = models2[0];
101798
- if (!firstModel) {
101799
- throw new Error("Model catalog is unavailable.");
101800
- }
101801
- return firstModel.handle;
101802
- }
101803
- var models2, BUILTIN_MODEL_ALIASES;
101781
+ const candidates2 = models2.filter((model) => !isLettaHostedModelHandle(model.handle));
101782
+ const defaultModel = candidates2.find((model) => model.isDefault) ?? candidates2[0];
101783
+ return defaultModel?.handle ?? UNSELECTED_MODEL_HANDLE;
101784
+ }
101785
+ var models2, BUILTIN_MODEL_ALIASES, UNSELECTED_MODEL_HANDLE = "local/default";
101804
101786
  var init_model_catalog = __esm(() => {
101805
101787
  models2 = [];
101806
101788
  BUILTIN_MODEL_ALIASES = new Map([
101807
- ["auto", "letta/auto"],
101808
101789
  ["auto-chat", "letta/auto-chat"],
101809
101790
  ["auto-fast", "letta/auto-fast"]
101810
101791
  ]);
@@ -102143,7 +102124,7 @@ async function buildCreateAgentRequest(options = {}) {
102143
102124
  initial_message_sequence: [],
102144
102125
  parallel_tool_calls: options.parallelToolCalls ?? true,
102145
102126
  compaction_settings: {
102146
- model: options.compactionModel ?? DEFAULT_SUMMARIZATION_MODEL
102127
+ model: options.compactionModel ?? modelHandle
102147
102128
  },
102148
102129
  ...options.embedding !== undefined ? { embedding: options.embedding } : {},
102149
102130
  ...options.isSubagent ? { hidden: true } : options.hidden !== undefined ? { hidden: options.hidden } : {}
@@ -102151,7 +102132,6 @@ async function buildCreateAgentRequest(options = {}) {
102151
102132
  }
102152
102133
  var LETTA_CODE_AGENT_TYPE = "letta_v1_agent", DEFAULT_CREATED_AGENT_BASE_TOOLS, DEFAULT_ROOT_MEMORY_BLOCK;
102153
102134
  var init_create_agent_request = __esm(() => {
102154
- init_constants2();
102155
102135
  init_memory3();
102156
102136
  init_model_catalog();
102157
102137
  init_personality_presets();
@@ -102773,9 +102753,11 @@ case "$memory_layout_policy" in
102773
102753
  esac
102774
102754
 
102775
102755
  if [ "$use_v2_validation" = "true" ]; then
102776
- for file in $(git diff --cached --name-only --diff-filter=ACMR | grep -E '^skills/[^/]+\\.md$' || true); do
102777
- errors="$errors\\n $file: invalid skill path (skills must be folders). Use skills/<name>/SKILL.md"
102778
- done
102756
+ while IFS= read -r -d '' file; do
102757
+ if [[ "$file" =~ ^skills/[^/]+\\.md$ ]]; then
102758
+ errors="$errors\\n $file: invalid skill path (skills must be folders). Use skills/<name>/SKILL.md"
102759
+ fi
102760
+ done < <(git diff --cached --name-only -z --diff-filter=ACMR)
102779
102761
 
102780
102762
  validate_memory_files "memfs-v2"
102781
102763
 
@@ -102790,15 +102772,20 @@ fi
102790
102772
 
102791
102773
  # Skills must always be directories: skills/<name>/SKILL.md
102792
102774
  # Reject legacy flat skill files (both current and legacy repo layouts).
102793
- for file in $(git diff --cached --name-only --diff-filter=ACMR | grep -E '^(memory/)?skills/[^/]+\\.md$' || true); do
102794
- errors="$errors\\n $file: invalid skill path (skills must be folders). Use skills/<name>/SKILL.md"
102795
- done
102775
+ while IFS= read -r -d '' file; do
102776
+ if [[ "$file" =~ ^(memory/)?skills/[^/]+\\.md$ ]]; then
102777
+ errors="$errors\\n $file: invalid skill path (skills must be folders). Use skills/<name>/SKILL.md"
102778
+ fi
102779
+ done < <(git diff --cached --name-only -z --diff-filter=ACMR)
102796
102780
 
102797
102781
  # Match .md files under system/ or reference/ (with optional memory/ prefix).
102798
102782
  # Skip skill SKILL.md files — they use a different frontmatter format.
102799
- for file in $(git diff --cached --name-only --diff-filter=ACM | grep -E '^(memory/)?(system|reference)/.*\\.md$'); do
102800
- memory_files+=("$file")
102801
- done
102783
+ # NUL-delimited so paths containing spaces or quotes stay intact.
102784
+ while IFS= read -r -d '' file; do
102785
+ if [[ "$file" =~ ^(memory/)?(system|reference)/.*\\.md$ ]]; then
102786
+ memory_files+=("$file")
102787
+ fi
102788
+ done < <(git diff --cached --name-only -z --diff-filter=ACM)
102802
102789
  validate_memory_files "legacy"
102803
102790
 
102804
102791
  if [ -n "$errors" ]; then
@@ -108661,6 +108648,7 @@ __export(exports_secrets_store, {
108661
108648
  deleteSecretOnServer: () => deleteSecretOnServer,
108662
108649
  clearSecretsCache: () => clearSecretsCache,
108663
108650
  applySecretBatch: () => applySecretBatch,
108651
+ __testSetSecretsMaxAgeMs: () => __testSetSecretsMaxAgeMs,
108664
108652
  __testSeedSecretsCache: () => __testSeedSecretsCache,
108665
108653
  __testOverrideSecretsBackend: () => __testOverrideSecretsBackend,
108666
108654
  __testOverrideLocalSecretStorage: () => __testOverrideLocalSecretStorage
@@ -108759,8 +108747,19 @@ function getCache() {
108759
108747
  }
108760
108748
  return global2[SECRETS_CACHE_KEY];
108761
108749
  }
108750
+ function getLoadedAt() {
108751
+ const global2 = globalThis;
108752
+ if (!global2[SECRETS_LOADED_AT_KEY]) {
108753
+ global2[SECRETS_LOADED_AT_KEY] = new Map;
108754
+ }
108755
+ return global2[SECRETS_LOADED_AT_KEY];
108756
+ }
108762
108757
  function setCache(agentId, secrets2) {
108763
108758
  getCache().set(agentId, { ...secrets2 });
108759
+ getLoadedAt().set(agentId, Date.now());
108760
+ }
108761
+ function __testSetSecretsMaxAgeMs(ms) {
108762
+ testSecretsMaxAgeOverride = ms;
108764
108763
  }
108765
108764
  function localSecretIndexName(agentId) {
108766
108765
  return `agent:${agentId}:secrets:index`;
@@ -108895,8 +108894,22 @@ function loadSecrets(agentId) {
108895
108894
  return { ...getCache().get(resolvedAgentId) ?? {} };
108896
108895
  }
108897
108896
  async function ensureSecretsLoaded(agentId) {
108898
- if (!getCache().has(agentId))
108897
+ if (!getCache().has(agentId)) {
108899
108898
  await initSecretsFromServer(agentId);
108899
+ return;
108900
+ }
108901
+ const loadedAt = getLoadedAt().get(agentId) ?? 0;
108902
+ const maxAge = testSecretsMaxAgeOverride ?? DEFAULT_SECRETS_MAX_AGE_MS;
108903
+ if (Date.now() - loadedAt < maxAge)
108904
+ return;
108905
+ let refresh = staleRefreshes.get(agentId);
108906
+ if (!refresh) {
108907
+ refresh = initSecretsFromServer(agentId).catch(() => {
108908
+ return;
108909
+ }).finally(() => staleRefreshes.delete(agentId));
108910
+ staleRefreshes.set(agentId, refresh);
108911
+ }
108912
+ await refresh;
108900
108913
  }
108901
108914
  function listSecretNames(agentId) {
108902
108915
  return Object.keys(loadSecrets(agentId)).sort();
@@ -108980,16 +108993,19 @@ async function deleteSecretOnServer(key, agentIdArg) {
108980
108993
  function clearSecretsCache(agentId) {
108981
108994
  if (agentId === null) {
108982
108995
  getCache().clear();
108996
+ getLoadedAt().clear();
108983
108997
  return;
108984
108998
  }
108985
108999
  const resolvedAgentId = resolveSecretsAgentId(agentId);
108986
109000
  if (resolvedAgentId) {
108987
109001
  getCache().delete(resolvedAgentId);
109002
+ getLoadedAt().delete(resolvedAgentId);
108988
109003
  return;
108989
109004
  }
108990
109005
  getCache().clear();
109006
+ getLoadedAt().clear();
108991
109007
  }
108992
- var testBackendOverride = null, testLocalSecretStorageOverride = null, FILE_BACKED_LOCAL_SECRETS_PATH, SECRETS_CACHE_KEY, LOCAL_SECRET_NAME_PATTERN;
109008
+ var testBackendOverride = null, testLocalSecretStorageOverride = null, FILE_BACKED_LOCAL_SECRETS_PATH, SECRETS_CACHE_KEY, SECRETS_LOADED_AT_KEY, DEFAULT_SECRETS_MAX_AGE_MS = 60000, testSecretsMaxAgeOverride = null, staleRefreshes, LOCAL_SECRET_NAME_PATTERN;
108993
109009
  var init_secrets_store = __esm(() => {
108994
109010
  init_context();
108995
109011
  init_backend2();
@@ -108997,6 +109013,8 @@ var init_secrets_store = __esm(() => {
108997
109013
  init_secrets();
108998
109014
  FILE_BACKED_LOCAL_SECRETS_PATH = join18("secrets", "local-agent-secrets.json");
108999
109015
  SECRETS_CACHE_KEY = Symbol.for("@letta/secretsCache");
109016
+ SECRETS_LOADED_AT_KEY = Symbol.for("@letta/secretsLoadedAt");
109017
+ staleRefreshes = new Map;
109000
109018
  LOCAL_SECRET_NAME_PATTERN = /^[A-Z_][A-Z0-9_]*$/;
109001
109019
  });
109002
109020
 
@@ -109405,6 +109423,16 @@ function localConversationKey(conversationId, agentId) {
109405
109423
  return conversationId === "default" ? `default:${agentId}` : `conversation:${conversationId}`;
109406
109424
  }
109407
109425
 
109426
+ // src/constants.ts
109427
+ var DEFAULT_TITLE_SUMMARIZATION_MODEL = "openai/gpt-6-luna", DEFAULT_AGENT_NAME = "Letta Code", INTERRUPTED_BY_USER = "Interrupted by user", TURN_DID_NOT_COMPLETE = "Turn did not complete", SYSTEM_REMINDER_TAG = "system-reminder", SYSTEM_REMINDER_OPEN, SYSTEM_REMINDER_CLOSE, SYSTEM_ALERT_TAG = "system-alert", SYSTEM_ALERT_OPEN, SYSTEM_ALERT_CLOSE, COMPACTION_SUMMARY_HEADER = "(Earlier messages in this conversation have been compacted to free up context, summarized below)", TOKEN_DISPLAY_THRESHOLD = 100, ELAPSED_DISPLAY_THRESHOLD_MS;
109428
+ var init_constants2 = __esm(() => {
109429
+ SYSTEM_REMINDER_OPEN = `<${SYSTEM_REMINDER_TAG}>`;
109430
+ SYSTEM_REMINDER_CLOSE = `</${SYSTEM_REMINDER_TAG}>`;
109431
+ SYSTEM_ALERT_OPEN = `<${SYSTEM_ALERT_TAG}>`;
109432
+ SYSTEM_ALERT_CLOSE = `</${SYSTEM_ALERT_TAG}>`;
109433
+ ELAPSED_DISPLAY_THRESHOLD_MS = 60 * 1000;
109434
+ });
109435
+
109408
109436
  // src/backend/local/local-model-normalization.ts
109409
109437
  function supportedModelSettingsFromBody(bodyRecord) {
109410
109438
  const modelSettings = isRecord2(bodyRecord.model_settings) ? { ...bodyRecord.model_settings } : {};
@@ -113572,7 +113600,7 @@ Delete ${resourceType} at: ${LETTA_AGENTS_URL}`;
113572
113600
  const lettaHostedQuotaMsg2 = getLettaHostedQuotaMessage(e2, reasons);
113573
113601
  if (lettaHostedQuotaMsg2)
113574
113602
  return lettaHostedQuotaMsg2;
113575
- return `Your account does not have credits for this model. Add your own API keys or upgrade your plan to purchase credits.`;
113603
+ return KEY_OR_CREDITS_REQUIRED_MESSAGE;
113576
113604
  }
113577
113605
  const lettaHostedQuotaMsg = getLettaHostedQuotaMessage(e2, reasons);
113578
113606
  if (lettaHostedQuotaMsg)
@@ -113678,7 +113706,7 @@ function createAgentLink(runId, agentId, conversationId, surface) {
113678
113706
  const agentRef = surface === "terminal" ? buildAgentTerminalLink(agentId, { conversationId }) : agentId;
113679
113707
  return `View agent: ${agentRef} (run: ${runId})`;
113680
113708
  }
113681
- var LETTA_USAGE_URL, LETTA_AGENTS_URL, GENERIC_ERROR_MESSAGE = "The request failed. Please try again.", CLOUDFLARE_EDGE_5XX_MARKER_PATTERN, CLOUDFLARE_EDGE_5XX_TITLE_PATTERN, CLOUDFLARE_EDGE_5XX_FORMATTED_PATTERN, CLOUDFLARE_JSON_5XX_PATTERN, CHATGPT_USAGE_LIMIT_HINT = "Switch models with /model, or connect your own provider keys with /connect.", ENCRYPTED_CONTENT_HINT, DEFAULT_RETRY_MESSAGE = "Unexpected downstream LLM API error, retrying...", ENDPOINT_TYPE_DISPLAY_NAMES;
113709
+ var LETTA_USAGE_URL, KEY_OR_CREDITS_REQUIRED_MESSAGE, LETTA_AGENTS_URL, GENERIC_ERROR_MESSAGE = "The request failed. Please try again.", CLOUDFLARE_EDGE_5XX_MARKER_PATTERN, CLOUDFLARE_EDGE_5XX_TITLE_PATTERN, CLOUDFLARE_EDGE_5XX_FORMATTED_PATTERN, CLOUDFLARE_JSON_5XX_PATTERN, CHATGPT_USAGE_LIMIT_HINT = "Switch models with /model, or connect your own provider keys with /connect.", ENCRYPTED_CONTENT_HINT, DEFAULT_RETRY_MESSAGE = "Unexpected downstream LLM API error, retrying...", ENDPOINT_TYPE_DISPLAY_NAMES;
113682
113710
  var init_error_formatter = __esm(() => {
113683
113711
  init_error();
113684
113712
  init_conversation_busy_error();
@@ -113686,6 +113714,7 @@ var init_error_formatter = __esm(() => {
113686
113714
  init_error_context();
113687
113715
  init_zai_errors();
113688
113716
  LETTA_USAGE_URL = buildChatWebUrl("/preferences/usage");
113717
+ KEY_OR_CREDITS_REQUIRED_MESSAGE = `This model needs your own API key or Letta credits. Run /connect to add a provider key, or buy credits at ${LETTA_USAGE_URL}.`;
113689
113718
  LETTA_AGENTS_URL = buildChatWebUrl("/agents");
113690
113719
  CLOUDFLARE_EDGE_5XX_MARKER_PATTERN = /(^|\s)(502|52[0-6])\s*<!doctype html|error code\s*(502|52[0-6])/i;
113691
113720
  CLOUDFLARE_EDGE_5XX_TITLE_PATTERN = /\|\s*(502|52[0-6])\s*:/i;
@@ -141978,7 +142007,7 @@ var init_devtools = __esm(() => {
141978
142007
 
141979
142008
  // node_modules/ink/build/reconciler.js
141980
142009
  import process3 from "node:process";
141981
- var import_react_reconciler, import_constants7, diff2 = (before2, after2) => {
142010
+ var import_react_reconciler, import_constants6, diff2 = (before2, after2) => {
141982
142011
  if (before2 === after2) {
141983
142012
  return;
141984
142013
  }
@@ -142014,7 +142043,7 @@ var init_reconciler = __esm(async () => {
142014
142043
  init_styles()
142015
142044
  ]);
142016
142045
  import_react_reconciler = __toESM(require_react_reconciler(), 1);
142017
- import_constants7 = __toESM(require_constants(), 1);
142046
+ import_constants6 = __toESM(require_constants(), 1);
142018
142047
  if (process3.env["DEV"] === "true") {
142019
142048
  try {
142020
142049
  await Promise.resolve().then(() => (init_devtools(), exports_devtools));
@@ -142131,7 +142160,7 @@ $ npm install --save-dev react-devtools-core
142131
142160
  scheduleTimeout: setTimeout,
142132
142161
  cancelTimeout: clearTimeout,
142133
142162
  noTimeout: -1,
142134
- getCurrentEventPriority: () => import_constants7.DefaultEventPriority,
142163
+ getCurrentEventPriority: () => import_constants6.DefaultEventPriority,
142135
142164
  beforeActiveInstanceBlur() {},
142136
142165
  afterActiveInstanceBlur() {},
142137
142166
  detachDeletedInstance() {},
@@ -158209,6 +158238,7 @@ function resizeWithSharpWorker(buffer, inputMediaType) {
158209
158238
  return new Promise((resolve11, reject2) => {
158210
158239
  const workerPath = resolveImageWorkerPath();
158211
158240
  const child = spawn3(process.execPath, [workerPath, inputMediaType], {
158241
+ env: { ...process.env, ELECTRON_RUN_AS_NODE: "1" },
158212
158242
  shell: false,
158213
158243
  stdio: ["pipe", "pipe", "pipe"],
158214
158244
  windowsHide: true
@@ -212050,7 +212080,7 @@ var init_mcp_client = __esm(() => {
212050
212080
  init_streamableHttp();
212051
212081
  DEFAULT_CLIENT_INFO = {
212052
212082
  name: "letta-code",
212053
- version: "0.34.44"
212083
+ version: "0.34.46"
212054
212084
  };
212055
212085
  });
212056
212086
 
@@ -215919,44 +215949,8 @@ function defineTool(input) {
215919
215949
  var init_define_tool = () => {};
215920
215950
 
215921
215951
  // src/tools/descriptions/ApplyPatch.md
215922
- var ApplyPatch_default = `Use the \`ApplyPatch\` tool to edit files.
215923
- Your patch language is a stripped‑down, file‑oriented diff format designed to be easy to parse and safe to apply. You can think of it as a high‑level envelope:
215952
+ var ApplyPatch_default = `Use the \`ApplyPatch\` tool to edit files. Pass the whole patch as \`input\`, using this grammar:
215924
215953
 
215925
- *** Begin Patch
215926
- [ one or more file sections ]
215927
- *** End Patch
215928
-
215929
- Within that envelope, you get a sequence of file operations.
215930
- You MUST include a header to specify the action you are taking.
215931
- Each operation starts with one of three headers:
215932
-
215933
- *** Add File: <path> - create a new file. Every following line is a + line (the initial contents).
215934
- *** Delete File: <path> - remove an existing file. Nothing follows.
215935
- *** Update File: <path> - patch an existing file in place (optionally with a rename).
215936
-
215937
- May be immediately followed by *** Move to: <new path> if you want to rename the file.
215938
- Then one or more “hunks”, each introduced by @@ (optionally followed by a hunk header).
215939
- Within a hunk each line starts with:
215940
-
215941
- For instructions on [context_before] and [context_after]:
215942
- - By default, show 3 lines of code immediately above and 3 lines immediately below each change. If a change is within 3 lines of a previous change, do NOT duplicate the first change’s [context_after] lines in the second change’s [context_before] lines.
215943
- - If 3 lines of context is insufficient to uniquely identify the snippet of code within the file, use the @@ operator to indicate the class or function to which the snippet belongs. For instance, we might have:
215944
- @@ class BaseClass
215945
- [3 lines of pre-context]
215946
- - [old_code]
215947
- + [new_code]
215948
- [3 lines of post-context]
215949
-
215950
- - If a code block is repeated so many times in a class or function such that even a single \`@@\` statement and 3 lines of context cannot uniquely identify the snippet of code, you can use multiple \`@@\` statements to jump to the right context. For instance:
215951
-
215952
- @@ class BaseClass
215953
- @@ def method():
215954
- [3 lines of pre-context]
215955
- - [old_code]
215956
- + [new_code]
215957
- [3 lines of post-context]
215958
-
215959
- The full grammar definition is below:
215960
215954
  Patch := Begin { FileOp } End
215961
215955
  Begin := "*** Begin Patch" NEWLINE
215962
215956
  End := "*** End Patch" NEWLINE
@@ -215968,7 +215962,7 @@ MoveTo := "*** Move to: " newPath NEWLINE
215968
215962
  Hunk := "@@" [ header ] NEWLINE { HunkLine } [ "*** End of File" NEWLINE ]
215969
215963
  HunkLine := (" " | "-" | "+") text NEWLINE
215970
215964
 
215971
- A full patch can combine several operations:
215965
+ Example:
215972
215966
 
215973
215967
  *** Begin Patch
215974
215968
  *** Add File: hello.txt
@@ -215981,12 +215975,7 @@ A full patch can combine several operations:
215981
215975
  *** Delete File: obsolete.txt
215982
215976
  *** End Patch
215983
215977
 
215984
- It is important to remember:
215985
-
215986
- - You must include a header with your intended action (Add/Delete/Update)
215987
- - You must prefix new lines with \`+\` even when creating a new file
215988
- - Relative file references are interpreted from the current working directory.
215989
- - Absolute file references are also accepted.
215978
+ Relative file references are interpreted from the current working directory. Absolute file references are also accepted.
215990
215979
  `;
215991
215980
  var init_ApplyPatch = () => {};
215992
215981
 
@@ -216011,180 +216000,40 @@ Usage notes:
216011
216000
  var init_AskUserQuestion = () => {};
216012
216001
 
216013
216002
  // src/tools/descriptions/Bash.md
216014
- var Bash_default = `# Bash
216015
-
216016
- Executes a given shell command from the conversation's current working directory with optional timeout, ensuring proper handling and security measures.
216017
-
216018
- IMPORTANT: This tool is for terminal operations like git, npm, docker, etc. DO NOT use it for file operations (reading, writing, editing, searching, finding files) - use the specialized tools for this instead. When Glob or Grep is available, prefer those tools over shell commands for repository searches.
216019
-
216020
- Before executing the command, please follow these steps:
216021
-
216022
- 1. Directory Verification:
216023
- - If the command will create new directories or files, first use \`ls\` to verify the parent directory exists and is the correct location
216024
- - For example, before running "mkdir foo/bar", first use \`ls foo\` to check that "foo" exists and is the intended parent directory
216025
-
216026
- 2. Command Execution:
216027
- - Always quote file paths that contain spaces with double quotes (e.g., cd "path with spaces/file.txt")
216028
- - Examples of proper quoting:
216029
- - cd "/Users/name/My Documents" (correct)
216030
- - cd /Users/name/My Documents (incorrect - will fail)
216031
- - python "/path/with spaces/script.py" (correct)
216032
- - python /path/with spaces/script.py (incorrect - will fail)
216033
- - After ensuring proper quoting, execute the command.
216034
- - Capture the output of the command.
216035
-
216036
- Usage notes:
216037
- - The command and description arguments are required.
216038
- - Commands run until they exit unless you pass a timeout in milliseconds. Foreground timeouts have a maximum of 600000ms.
216039
- - Write a clear, concise user-facing description of what this command does. This description may be shown directly in chat as part of a status row like \`Running command: <description>\` or \`Ran command: <description>\`. Describe the command's purpose, not its shell syntax. For simple commands, keep it brief (5-10 words). For complex commands (piped commands, obscure flags, or anything hard to understand at a glance), add enough context to clarify what it does.
216040
- - If the output exceeds 30000 characters, you receive only the first 2000 characters plus the path of a file containing the full output. A failed command whose output exceeds 10000 characters returns a head-and-tail excerpt plus that file path. Read or search that file when you need the rest instead of re-running the command.
216041
- - Ordinary commands wait briefly for a result, then automatically continue in the background if they are still running. You will receive a task ID and one completion notification, so do not predict command duration, set \`run_in_background\` merely because a command may be slow, or poll for completion.
216042
- - Set \`run_in_background\` only when you want the command to return a task ID immediately. You do not need to use '&' at the end of the command.
216043
- - Pick between Bash and the Monitor tool by how many notifications you need. **One** ("tell me when the server is ready / the build finishes") → Bash with \`run_in_background\` and a command that exits when the condition is true, e.g. \`until grep -q "Ready in" dev.log; do sleep 0.5; done\`. You get one completion notification when it exits. Foreground \`sleep\` is blocked. **One per occurrence** ("tell me every time an ERROR line appears") → use Monitor: each stdout line is an event while you keep working.
216044
-
216045
- - Avoid using Bash with the \`cat\`, \`head\`, \`tail\`, \`sed\`, \`awk\`, or \`echo\` commands, unless explicitly instructed or when these commands are truly necessary for the task. Instead, always prefer using the dedicated tools for these commands:
216046
- - Read files: Use Read (NOT cat/head/tail)
216047
- - Edit files: Use Edit (NOT sed/awk)
216048
- - Write files: Use Write (NOT echo >/cat <<EOF)
216049
- - Communication: Output text directly (NOT echo/printf)
216050
- - When issuing multiple commands:
216051
- - If the commands are independent and can run in parallel, make multiple Bash tool calls in a single message. For example, if you need to run "git status" and "git diff", send a single message with two Bash tool calls in parallel.
216052
- - If the commands depend on each other and must run sequentially, use a single Bash call with '&&' to chain them together (e.g., \`git add . && git commit -m "message" && git push\`). For instance, if one operation must complete before another starts (like mkdir before cp, Write before Bash for git operations, or git add before git commit), run these operations sequentially instead.
216053
- - Use ';' only when you need to run commands sequentially but don't care if earlier commands fail
216054
- - DO NOT use newlines to separate commands (newlines are ok in quoted strings)
216055
- - Each Bash call starts from the conversation's current working directory. A \`cd\` affects only that command and does not change the directory used by later tool calls.
216056
- - To change the working directory for later tool calls, use \`SetWorkingDirectory\`. For a one-off command in another directory, use an absolute path or a command-specific option such as \`git -C /path/to/repo status\`.
216057
-
216058
- # Committing changes with git
216059
-
216060
- Only create commits when requested by the user. If unclear, ask first. When the user asks you to create a new git commit, follow these steps carefully:
216061
-
216062
- Git Safety Protocol:
216063
- - NEVER update the git config
216064
- - NEVER run destructive/irreversible git commands (like push --force, hard reset, etc) unless the user explicitly requests them
216065
- - NEVER skip hooks (--no-verify, --no-gpg-sign, etc) unless the user explicitly requests it
216066
- - NEVER run force push to main/master, warn the user if they request it
216067
- - CRITICAL: Always create NEW commits rather than amending, unless the user explicitly requests a git amend. When a pre-commit hook fails, the commit did NOT happen — so --amend would modify the PREVIOUS commit, which may result in destroying work or losing previous changes. Instead, after hook failure, fix the issue, re-stage, and create a NEW commit
216068
- - When staging files, prefer adding specific files by name rather than using "git add -A" or "git add .", which can accidentally include sensitive files (.env, credentials) or large binaries
216069
- - NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive.
216070
-
216071
- 1. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following bash commands in parallel, each using the Bash tool:
216072
- - Run a git status command to see all untracked files. IMPORTANT: Never use the -uall flag as it can cause memory issues on large repos.
216073
- - Run a git diff command to see both staged and unstaged changes that will be committed.
216074
- - Run a git log command to see recent commit messages, so that you can follow this repository's commit message style.
216075
- 2. Analyze all staged changes (both previously staged and newly added) and draft a commit message:
216076
- - Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.). Ensure the message accurately reflects the changes and their purpose (i.e. "add" means a wholly new feature, "update" means an enhancement to an existing feature, "fix" means a bug fix, etc.).
216077
- - Do not commit files that likely contain secrets (.env, credentials.json, etc). Warn the user if they specifically request to commit those files
216078
- - Draft a concise (1-2 sentences) commit message that focuses on the "why" rather than the "what"
216079
- - Ensure it accurately reflects the changes and their purpose
216080
- 3. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following commands:
216081
- - Add relevant untracked files to the staging area.
216082
- - Create the commit with a message ending with:
216083
- {{COMMIT_TRAILER}}
216084
- - Run git status after the commit completes to verify success.
216085
- Note: git status depends on the commit completing, so run it sequentially after the commit.
216086
- 4. If the commit fails due to pre-commit hook: fix the issue and create a NEW commit
216087
-
216088
- Important notes:
216089
- - NEVER run additional commands to read or explore code, besides git bash commands
216090
- - NEVER use the TaskCreate or Task tools
216091
- - DO NOT push to the remote repository unless the user explicitly asks you to do so
216092
- - IMPORTANT: Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported.
216093
- - IMPORTANT: Do not use --no-edit with git rebase commands, as the --no-edit flag is not a valid option for git rebase.
216094
- - If there are no changes to commit (i.e., no untracked files and no modifications), do not create an empty commit
216095
- - In order to ensure good formatting, ALWAYS pass the commit message as a single-quoted string with embedded newlines, a la this example:
216096
- <example>
216097
- git commit -m 'Commit message here.
216098
-
216099
- {{COMMIT_TRAILER}}'
216100
- </example>
216101
-
216102
- Use single quotes (not double quotes) and do NOT wrap the message in \`$(...)\` or backticks — single-quoting preserves the message verbatim (including \`$VAR\`, backticks, and other special characters) without needing escapes.
216103
-
216104
- # Creating pull requests
216105
- Use the gh command via the Bash tool for ALL GitHub-related tasks including working with issues, pull requests, checks, and releases. If given a Github URL use the gh command to get the information needed.
216106
-
216107
- IMPORTANT: When the user asks you to create a pull request, follow these steps carefully:
216108
-
216109
- 1. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following bash commands in parallel using the Bash tool, in order to understand the current state of the branch since it diverged from the main branch:
216110
- - Run a git status command to see all untracked files
216111
- - Run a git diff command to see both staged and unstaged changes that will be committed
216112
- - Check if the current branch tracks a remote branch and is up to date with the remote, so you know if you need to push to the remote
216113
- - Run a git log command and \`git diff [base-branch]...HEAD\` to understand the full commit history for the current branch (from the time it diverged from the base branch)
216114
- 2. Analyze all changes that will be included in the pull request, making sure to look at all relevant commits (NOT just the latest commit, but ALL commits that will be included in the pull request!!!), and draft a pull request summary
216115
- 3. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following commands in parallel:
216116
- - Create new branch if needed
216117
- - Push to remote with -u flag if needed
216118
- - Create PR using gh pr create with the format below. Pass the body as a single-quoted string with embedded newlines (do NOT wrap it in \`$(...)\` or backticks).
216119
- <example>
216120
- gh pr create --title "the pr title" --body '## Summary
216121
- <1-3 bullet points>
216122
-
216123
- ## Test plan
216124
- [Bulleted markdown checklist of TODOs for testing the pull request...]
216125
-
216126
- 👾 Generated with [Letta Code](https://letta.com)'
216127
- </example>
216128
-
216129
- 4. Passing \`gh pr checks\` does not mean GitHub will merge the PR — unresolved review threads and still-pending required checks leave the merge state BLOCKED. If WatchPR is available and you will follow the PR toward merge, start it on the PR URL, and call the PR ready, green, or mergeable only once WatchPR reports it merge-ready.
216130
-
216131
- Important:
216132
- - DO NOT use the TaskCreate or Task tools
216133
- - Return the PR URL when you're done, so the user can see it
216134
-
216135
- # Other common operations
216136
- - View comments on a Github PR: gh api repos/foo/bar/pulls/123/comments
216137
- `;
216003
+ var Bash_default = "Executes a shell command and returns its output.\n\n- Each Bash call starts from the conversation's current working directory. A `cd` affects only that command and does not change the directory used by later tool calls. To change the working directory for later tool calls, use `SetWorkingDirectory`. For a one-off command elsewhere, use an absolute path or an option such as `git -C /path/to/repo status`.\n- IMPORTANT: Avoid using this tool to run `cat`, `head`, `tail`, `sed`, `awk`, or `echo` commands, unless explicitly instructed. Use Read, Edit and Write for file operations instead. Quote paths that contain spaces.\n- Command output is displayed to you, not reliably to the user.\n- `timeout` is in milliseconds. Without it, commands run until they exit; foreground timeouts max out at 600000.\n- If the output exceeds 30000 characters, you receive only the first 2000 characters plus the path of a file containing the full output. A failed command whose output exceeds 10000 characters returns a head-and-tail excerpt plus that file path. Read or search that file when you need the rest instead of re-running the command.\n- Commands still running after a brief wait continue in the background automatically: you receive a task ID and one completion notification. Do not predict command duration, set `run_in_background` merely because a command may be slow, or poll for completion. Set `run_in_background` only when you want the task ID immediately; no `&` needed.\n- Foreground `sleep` is blocked. To be notified once when a condition is true, run a command that exits then, e.g. `until grep -q \"Ready\" dev.log; do sleep 0.5; done`. For one notification per event, use Monitor.\n- Run independent commands as parallel tool calls; chain dependent ones with `&&`.\n\n# Git\n- Interactive flags (`-i`, e.g. `git rebase -i`, `git add -i`) are not supported in this environment.\n- Use the `gh` CLI for GitHub operations (PRs, issues, API).\n- GitHub notifies the owner of any `@name` written in a PR, issue, or comment. Write a bare `@name` only for a real login you mean to notify. Put roles, placeholders, and code (`@human`, `@reviewer`, `@types/node`) in backticks or drop the `@`.\n- Commit or push only when the user asks. Do not amend, skip hooks, force-push, or run other destructive git commands unless the user asks; if a pre-commit hook fails, fix the issue and create a new commit.\n- Pass commit messages and PR bodies as single-quoted strings with embedded newlines. Do not wrap them in `$(...)` or backticks. End commit messages with:\n{{COMMIT_TRAILER}}\n<example>\ngit commit -m 'Commit message here.\n\n{{COMMIT_TRAILER}}'\n</example>\n- Passing `gh pr checks` does not mean GitHub will merge the PR — unresolved review threads and still-pending required checks leave the merge state BLOCKED. If WatchPR is available and you will follow the PR toward merge, start it on the PR URL, and call the PR ready, green, or mergeable only once WatchPR reports it merge-ready.\n";
216138
216004
  var init_Bash = () => {};
216139
216005
 
216140
216006
  // src/tools/descriptions/CodeMode.md
216141
- var CodeMode_default = "Run a JavaScript async function body that calls tools and returns only the results you need.\n\nCall built-in and server-side tools with `await tools.<name>(args)` and MCP tools with `await tools.mcp__server__tool(args)`; `listTools()` and `describeTool(name)` list tools and their schemas. Failed calls throw. `args` holds optional input, `process.env` holds the variables a Bash command sees plus the agent's secrets, and `console.log()` output is captured.\n\n`await decide(state, questions, options?)` makes one typed model decision. `questions` is an object of id → `{ type, instructions, criteria }`: `choice` takes a criteria map of id → description, `score` a criteria array, `noul` no criteria. It resolves to `{ answers }` keyed by question id (`.choice`, `.score`, or `.noul` in 0–1), or `null` after an invalid answer.\n\nReturns `{ result, output }`. Like Bash, a script still running after a brief wait continues in the background and its result arrives as a task notification; `run_in_background: true` returns the task ID immediately. TaskStop aborts it.\n\nNested calls follow permission rules; calls that need approval fail, so call those tools directly. This is not a security sandbox.\n\nExample:\n\n const texts = await Promise.all(args.paths.map(file_path => tools.Read({ file_path })));\n return texts.map((text, i) => ({ path: args.paths[i], lines: text.split('\\n').length }));\n";
216007
+ var CodeMode_default = "Run a JavaScript async function body that calls tools and returns only the results you need.\n\nCall built-in and server-side tools with `await tools.<name>(args)` and MCP tools with `await tools.mcp__server__tool(args)`; `listTools()` and `describeTool(name)` list tools and their schemas. Failed calls throw. `args` holds optional input, `process.env` holds the variables a shell command sees plus the agent's secrets, and `console.log()` output is captured.\n\n`await decide(state, questions, options?)` makes one typed model decision. `questions` is an object of id → `{ type, instructions, criteria }`: `choice` takes a criteria map of id → description, `score` a criteria array, `noul` no criteria. It resolves to `{ answers }` keyed by question id (`.choice`, `.score`, or `.noul` in 0–1), or `null` after an invalid answer.\n\nReturns `{ result, output }`. Like a shell command, a script still running after a brief wait continues in the background and its result arrives as a task notification; `run_in_background: true` returns the task ID immediately. TaskStop aborts it.\n\nNested calls follow permission rules; calls that need approval fail, so call those tools directly. This is not a security sandbox.\n";
216142
216008
  var init_CodeMode = () => {};
216143
216009
 
216144
216010
  // src/tools/descriptions/Edit.md
216145
- var Edit_default = "# Edit\n\nPerforms exact string replacements in files. \n\nUsage:\n- You must use your `Read` tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file. Exception: memory files whose contents are already present in your system prompt do not require a Read call first. For memory files, pass an expanded absolute path (use Bash to resolve `$MEMORY_DIR` first if needed).\n- `file_path` is literal: `$VAR`, `$MEMORY_DIR`, `~`, etc. are not expanded.\n- When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: spaces + line number + tab. Everything after that tab is the actual file content to match. Never include any part of the line number prefix in the old_string or new_string.\n- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.\n- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.\n- The edit will FAIL if `old_string` is not unique in the file. Either provide a larger string with more surrounding context to make it unique or use `replace_all` to change every instance of `old_string`. \n- Use `replace_all` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.\n";
216011
+ var Edit_default = "Performs exact string replacement in a file.\n\n- Read the file in this conversation before editing it. Exception: memory files whose contents are already present in your system prompt do not require a Read call first. For memory files, pass an expanded absolute path.\n- `file_path` is literal: `$VAR`, `$MEMORY_DIR`, `~`, etc. are not expanded.\n- `old_string` must match the file exactly, including indentation, and be unique — the edit fails otherwise. Strip the Read line prefix (line number + tab) before matching.\n- `replace_all: true` replaces every occurrence instead.\n";
216146
216012
  var init_Edit = () => {};
216147
216013
 
216148
216014
  // src/tools/descriptions/EnterWorktree.md
216149
- var EnterWorktree_default = "# EnterWorktree\n\nCreate a fresh isolated git worktree for this conversation, or switch this conversation into an existing one.\n\nUse this tool when starting a new feature, bug fix, refactor, or other file-editing task where isolated branch work is useful, especially if the user or other agents may be working in the same repository. Prefer worktrees by default unless the user explicitly asks to work in the current checkout or says they do not want worktrees.\n\nPass `name` (and optionally `branch_name`/`base_ref`) to create a new worktree. Pass `path` instead to switch into an existing worktree that was created under `.letta/worktrees/` — for example to resume work or hand off to a worktree another conversation started.\n\nPrefer this tool over manually running `git worktree add` with Bash because it creates the worktree in Letta Code's canonical location, bases it on the latest default branch, and updates this conversation/session's working directory when supported.\n\nDo not use this tool for read-only tasks, code review, answering questions, continuing work already in the correct checkout, or when the user explicitly asks not to use worktrees.\n\nBehavior:\n- Uses the current cwd as the target git repository by default, or `repo_path` when provided.\n- If the current cwd is not inside a git repository, pass `repo_path` instead of falling back to manual `git worktree` commands.\n- Creates the worktree under `.letta/worktrees/` for the target repository.\n- Creates a new branch from the default base ref (with `--no-track`, so it does not adopt the base as an upstream) unless `branch_name` or `base_ref` is provided.\n- Disables repository-local and worktree-scoped git checkout filters, the `core.fsmonitor` command, and git hooks (such as `post-checkout`) while creating the worktree so commands written into the repository's `.git` directory cannot run. Creation fails when conditional includes or Git LFS transfer-program settings prevent those filters from being neutralized safely.\n- By default, switches the active conversation/session cwd to the new worktree.\n- Does not copy uncommitted changes from the current checkout.\n- Automatically provisions the new worktree so it is usable without a manual setup pass:\n - Wires git hooks: if `core.hooksPath` is relative (e.g. husky's `.husky/_`, whose contents are gitignored and absent in a fresh worktree), it symlinks the populated hooks directory from the primary checkout so pre-commit hooks run.\n - Copies `.letta/settings.local.json` into the worktree when present.\n - Copies gitignored files/directories listed in a repo-root `.worktreeinclude` file (and in the `worktree.include` project setting) — use this for config like `.env`.\n- Dependencies are NOT shared by default: the worktree starts isolated, so install them with the repo's package manager if needed (modern managers like Bun/pnpm install quickly from a shared cache). Opt into sharing with `symlink_dependencies: true`, which symlinks heavy gitignored dependency directories (default: `node_modules`) from the primary checkout to avoid reinstalling — but only when the worktree will NOT change packages, because a package install into a symlinked `node_modules` writes through to the primary checkout's dependencies.\n- Provisioning is configurable project-wide via the `worktree` block in `.letta/settings.json` (`symlinkDirectories`, `copyLocalSettings`, `linkHooks`, `include`) and is best-effort: it reports what was done/skipped in the result and never aborts worktree creation.\n\nEntering an existing worktree (`path`):\n- Switches the conversation/session cwd into the worktree at `path` without creating or re-provisioning anything.\n- `path` must be a registered, non-prunable linked worktree of this repository, living under `.letta/worktrees/`. The main working tree and unmanaged worktrees are rejected.\n- Mutually exclusive with `name`, `branch_name`, and `base_ref`.\n\nCross-agent lock:\n- Switching into a worktree (whether by creating it or entering one) takes an advisory lock recording this conversation as its current owner, so two agents do not edit the same worktree concurrently.\n- Entering a worktree another active agent already holds fails with an error. If that agent is no longer active, retry with `force: true` to take over the lock. Locks left by a crashed/exited process are detected and reclaimed automatically.\n- The lock is released when this conversation switches into a different worktree, and never blocks re-entering a worktree you already hold.\n\nAfter success:\n- Continue using the returned worktree path as the current workspace.\n- Confirm you are in the new worktree with `git status` before editing.\n- Root `AGENTS.md` instructions are loaded into the successful tool result when present. Follow them before running setup, build, or validation commands; read README or other setup docs for anything they do not cover.\n- Dependencies are not shared by default. Follow the loaded project instructions for setup. If they define no setup command, use the repository's package manager. (If you created the worktree with `symlink_dependencies: true`, dependencies are already present via a symlink to the primary checkout — do NOT run an install, as it would mutate the primary checkout's `node_modules`.)\n";
216015
+ var EnterWorktree_default = "Create a fresh isolated git worktree for this conversation, or switch this conversation into an existing one.\n\nUse this tool when starting a new feature, bug fix, refactor, or other file-editing task where isolated branch work is useful, especially if the user or other agents may be working in the same repository. Prefer worktrees by default unless the user explicitly asks to work in the current checkout or says they do not want worktrees.\n\nDo not use this tool for read-only tasks, code review, answering questions, continuing work already in the correct checkout, or when the user explicitly asks not to use worktrees. Prefer it over running `git worktree add` yourself: it creates the worktree under `.letta/worktrees/`, bases it on the latest default branch, and switches this conversation's working directory.\n\n- Pass `name` (and optionally `branch_name`/`base_ref`) to create a new worktree, or `path` to switch into an existing one under `.letta/worktrees/`, e.g. to resume work another conversation started. `path` is mutually exclusive with `name`, `branch_name` and `base_ref`.\n- If the current cwd is not inside the target git repository, pass `repo_path` instead of falling back to manual `git worktree` commands.\n- Uncommitted changes in the current checkout are not copied.\n- Creation fails when repository config (conditional includes, Git LFS transfer settings) prevents checkout filters and hooks from being disabled safely.\n- Switching into a worktree takes an advisory lock for this conversation. Entering one another active agent holds fails; if that agent is no longer active, retry with `force: true`.\n- Dependencies are not shared by default; install them with the repo's package manager. `symlink_dependencies: true` symlinks `node_modules` and similar from the primary checkout instead — use it only when the worktree will not change packages, and then do NOT run an install, because it writes through to the primary checkout.\n\nAfter success:\n- Continue using the returned worktree path as the current workspace, and confirm with `git status` before editing.\n- Root `AGENTS.md` instructions are loaded into the successful tool result when present. Follow them before running setup, build, or validation commands; read README or other setup docs for anything they do not cover.\n";
216150
216016
  var init_EnterWorktree = () => {};
216151
216017
 
216152
216018
  // src/tools/descriptions/ExecCommand.md
216153
- var ExecCommand_default = "Runs a command in a PTY, returning output or a session ID for ongoing interaction.\n\nFor ordinary one-shot commands, omit `yield_time_ms` and let the default wait for completion; set `yield_time_ms` only when intentionally returning early from a long-running or interactive command.\n\nIf a command is still running when this tool yields, you will receive a notification when it completes. Do not poll the session just to check whether it has finished. Use `write_stdin` only when you need to send input, interrupt the process, or obtain output before you can continue.\n\nProvide the required `description` field as a clear, concise user-facing status label for what the command does. It may be shown directly in chat with no prefix, so make it grammatical by itself and avoid tense-dependent wording. Use an imperative or purpose phrase like `Find debug log entries` or `Search recent logs for errors`. Describe the command's purpose, not its shell syntax. Keep it brief for simple commands; add only enough context to clarify commands that are hard to parse at a glance.\n\n# Committing changes with git\n\nOnly create commits when requested by the user. If unclear, ask first. When the user asks you to create a new git commit, follow these steps carefully:\n\nGit Safety Protocol:\n- NEVER update the git config\n- NEVER run destructive/irreversible git commands (like push --force, hard reset, etc) unless the user explicitly requests them \n- NEVER skip hooks (--no-verify, --no-gpg-sign, etc) unless the user explicitly requests it\n- NEVER run force push to main/master, warn the user if they request it\n- CRITICAL: Always create NEW commits rather than amending, unless the user explicitly requests a git amend. When a pre-commit hook fails, the commit did NOT happen -- so --amend would modify the PREVIOUS commit, which may result in destroying work or losing previous changes. Instead, after hook failure, fix the issue, re-stage, and create a NEW commit\n- When staging files, prefer adding specific files by name rather than using \"git add -A\" or \"git add .\", which can accidentally include sensitive files (.env, credentials) or large binaries\n- NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive.\n\n1. Run the following shell commands in parallel:\n - Run a git status command to see all untracked files. IMPORTANT: Never use the -uall flag as it can cause memory issues on large repos.\n - Run a git diff command to see both staged and unstaged changes that will be committed.\n - Run a git log command to see recent commit messages, so that you can follow this repository's commit message style.\n2. Analyze all staged changes (both previously staged and newly added) and draft a commit message:\n - Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.). Ensure the message accurately reflects the changes and their purpose (i.e. \"add\" means a wholly new feature, \"update\" means an enhancement to an existing feature, \"fix\" means a bug fix, etc.).\n - Do not commit files that likely contain secrets (.env, credentials.json, etc). Warn the user if they specifically request to commit those files\n - Draft a concise (1-2 sentences) commit message that focuses on the \"why\" rather than the \"what\"\n - Ensure it accurately reflects the changes and their purpose\n3. Run the following commands:\n - Add relevant untracked files to the staging area.\n - Create the commit with a message ending with:\n {{COMMIT_TRAILER}}\n - Run git status after the commit completes to verify success.\n Note: git status depends on the commit completing, so run it sequentially after the commit.\n4. If the commit fails due to pre-commit hook: fix the issue and create a NEW commit\n\nImportant notes:\n- NEVER run additional commands to read or explore code, besides git commands\n- DO NOT push to the remote repository unless the user explicitly asks you to do so\n- IMPORTANT: Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported.\n- IMPORTANT: Do not use --no-edit with git rebase commands, as the --no-edit flag is not a valid option for git rebase.\n- If there are no changes to commit (i.e., no untracked files and no modifications), do not create an empty commit\n- In order to ensure good formatting, ALWAYS pass the commit message as a single-quoted string with embedded newlines, a la this example:\n<example>\ngit commit -m 'Commit message here.\n\n{{COMMIT_TRAILER}}'\n</example>\n\nUse single quotes (not double quotes) and do NOT wrap the message in `$(...)` or backticks — single-quoting preserves the message verbatim (including `$VAR`, backticks, and other special characters) without needing escapes.\n";
216154
- var init_ExecCommand = () => {};
216155
-
216156
- // src/tools/descriptions/ExitWorktree.md
216157
- var ExitWorktree_default = `# ExitWorktree
216158
-
216159
- Leave the git worktree this conversation is working in and return to the primary checkout, optionally deleting the worktree and its branch.
216160
-
216161
- Use this tool only when the user asks to exit, leave, or go back from a worktree, or asks to clean one up when the work is done or abandoned. Do NOT call it proactively — finishing a task is not by itself a reason to leave the worktree.
216019
+ var ExecCommand_default = `Runs a command in a PTY, returning output or a session ID for ongoing interaction.
216162
216020
 
216163
- ## Scope
216021
+ For ordinary one-shot commands, omit \`yield_time_ms\` and let the default wait for completion; set \`yield_time_ms\` only when intentionally returning early from a long-running or interactive command.
216164
216022
 
216165
- Applies to the worktree the conversation is currently in, when that worktree lives under \`.letta/worktrees/\` — the location EnterWorktree creates and enters. It does not matter whether this conversation created it.
216023
+ If a command is still running when this tool yields, you will receive a notification when it completes. Do not poll the session just to check whether it has finished. Use \`write_stdin\` only when you need to send input, interrupt the process, or obtain output before you can continue.
216166
216024
 
216167
- If the current working directory is not a managed worktree, this tool is a **no-op**: it reports that there is nothing to exit and changes nothing on disk.
216168
-
216169
- ## Parameters
216170
-
216171
- - \`action\` (required):
216172
- - \`"keep"\` — leave the worktree directory and branch intact. Use when the user may come back to the work, or when it holds changes worth preserving.
216173
- - \`"remove"\` — delete the worktree directory and its branch. Use for a clean exit when the work is merged, done, or abandoned.
216174
- - \`discard_changes\` (optional, default \`false\`): only meaningful with \`action: "remove"\`. If the worktree has uncommitted changes or commits that are not in the base ref, removal is refused unless this is \`true\`. When the tool reports refused work, surface it to the user and get confirmation before re-running with \`discard_changes: true\`.
216175
-
216176
- ## Behavior
216177
-
216178
- - Switches the conversation's working directory back to the primary checkout **before** touching the worktree, so removing it cannot strand the session (or a persistent shell) in a deleted directory.
216179
- - Releases this conversation's cross-agent worktree lock, so another agent can take the worktree over. A lock held by a different conversation is left alone.
216180
- - With \`action: "remove"\`, deletes the worktree and then its branch. If the branch cannot be deleted safely, the worktree removal still succeeds and the leftover branch is reported.
216181
- - Returns to the primary checkout, not to whatever directory you happened to be in before entering — the primary checkout is the reliable destination across restarts and across worktree-to-worktree switches.
216182
-
216183
- ## After success
216025
+ Git commits: commit only when the user asks. Do not amend, skip hooks, force-push, or run other destructive git commands unless the user asks; if a pre-commit hook fails, fix the issue and create a new commit. Pass the message as a single-quoted string with embedded newlines; do not wrap it in \`$(...)\` or backticks. End commit messages with:
216026
+ {{COMMIT_TRAILER}}
216027
+ <example>
216028
+ git commit -m 'Commit message here.
216184
216029
 
216185
- - Confirm the working directory with \`git status\` before editing further.
216186
- - If a branch was kept behind, tell the user its name so the work is not lost.
216030
+ {{COMMIT_TRAILER}}'
216031
+ </example>
216187
216032
  `;
216033
+ var init_ExecCommand = () => {};
216034
+
216035
+ // src/tools/descriptions/ExitWorktree.md
216036
+ var ExitWorktree_default = 'Leave the git worktree this conversation is working in and return to the primary checkout, optionally deleting the worktree and its branch.\n\nUse this tool only when the user asks to exit, leave, or go back from a worktree, or asks to clean one up when the work is done or abandoned. Do NOT call it proactively — finishing a task is not by itself a reason to leave the worktree.\n\nIt applies to the current worktree when it lives under `.letta/worktrees/`, whoever created it. Anywhere else it is a no-op.\n\n- `action: "keep"` leaves the worktree directory and branch intact; use it when the user may come back or the work is worth preserving. `action: "remove"` deletes the worktree and its branch.\n- `discard_changes` (default `false`): removal is refused when the worktree has uncommitted changes or commits not in the base ref. Surface refused work to the user and get confirmation before re-running with `discard_changes: true`.\n- The working directory returns to the primary checkout, and this conversation\'s worktree lock is released.\n\nAfter success, confirm the working directory with `git status` before editing further. If a branch was kept behind, tell the user its name so the work is not lost.\n';
216188
216037
  var init_ExitWorktree = () => {};
216189
216038
 
216190
216039
  // src/tools/descriptions/Glob.md
@@ -216242,28 +216091,11 @@ Do not use this tool for root memory files (already loaded) or skills/ (use Skil
216242
216091
  var init_Memory = () => {};
216243
216092
 
216244
216093
  // src/tools/descriptions/Monitor.md
216245
- var Monitor_default = 'Start a background monitor that streams events from a long-running script. Each stdout line is an event — you keep working and notifications arrive in the chat. Events arrive on their own schedule and are not replies from the user, even if one lands while you\'re waiting for the user to answer a question.\n\nPick by how many notifications you need:\n- **One** ("tell me when the server is ready / the build finishes") → use **Bash with `run_in_background`** and a command that exits when the condition is true, e.g. `until grep -q "Ready in" dev.log; do sleep 0.5; done`. You get a single completion notification when it exits.\n- **One per occurrence, indefinitely** ("tell me every time an ERROR line appears") → Monitor with an unbounded command (`tail -f`, `inotifywait -m`, `while true`).\n- **One per occurrence, until a known end** ("emit each CI step result, stop when the run completes") → Monitor with a command that emits lines and then exits.\n\nYour script\'s stdout is the event stream. Each line becomes a notification. Exit ends the watch.\n # Each matching log line is an event\n tail -f /var/log/app.log | grep --line-buffered "ERROR"\n # Each file change is an event\n inotifywait -m --format \'%e %f\' /watched/dir\n # Node script that emits events as they arrive (e.g. WebSocket listener)\n node watch-for-events.js\n\nFor open github.com pull requests, use WatchPR instead. It covers the whole PR surface and keeps watching after CI finishes. Use Monitor only when WatchPR does not apply.\n\n**Don\'t use an unbounded command for a single notification.** `tail -f`, `inotifywait -m`, and `while true` never exit on their own, so the monitor stays armed until timeout even after the event has fired. For "tell me when X is ready," use Bash `run_in_background` with an `until` loop instead (one notification, ends in seconds). Note that `tail -f log | grep -m 1 ...` does *not* fix this: if the log goes quiet after the match, `tail` never receives SIGPIPE and the pipeline hangs anyway.\n\n- Every pipe stage must flush per line or matches sit in its buffer unseen: `grep` needs `--line-buffered`, `awk` needs `fflush()`. `head` cannot flush at all — `| head -N` delivers nothing until N matches accumulate, then ends the stream.\n- In poll loops, handle transient failures (`curl ... || true`) — one failed request shouldn\'t kill the monitor.\n- Poll intervals: 30s+ for remote APIs (rate limits), 0.5–1s for local checks.\n- Write a specific `description` — it appears in every notification ("errors in deploy.log" not "watching logs").\n- Only stdout is the event stream. Stderr goes to the output file (readable via Read) but does not trigger notifications — for a command you run directly (e.g. `python train.py 2>&1 | grep --line-buffered ...`), merge stderr with `2>&1` so its failures reach your filter. (No effect on `tail -f` of an existing log — that file only contains what its writer redirected.)\n\n**Coverage — silence is not success.** When watching a job or process for an outcome, your filter must match every terminal state, not just the happy path. A monitor that greps only for the success marker stays silent through a crashloop, a hung process, or an unexpected exit — and silence looks identical to "still running." Before arming, ask: *if this process crashed right now, would my filter emit anything?* If not, widen it.\n # Wrong — silent on crash, hang, or any non-success exit\n tail -f run.log | grep --line-buffered "elapsed_steps="\n # Right — one alternation covering progress + the failure signatures you\'d act on\n tail -f run.log | grep -E --line-buffered "elapsed_steps=|Traceback|Error|FAILED|assert|Killed|OOM"\n\nFor poll loops checking job state, emit on every terminal status (`succeeded|failed|cancelled|timeout`), not just success. If you cannot confidently enumerate the failure signatures, broaden the grep alternation rather than narrow it — some extra noise is better than missing a crashloop.\n\n**Output volume**: Every stdout line is a conversation message, so the filter should be selective — but selective means "the lines you\'d act on," not "only good news." Never pipe raw logs; filter to exactly the success and failure signals you care about. Monitors that produce too many events are automatically stopped; restart with a tighter filter if this happens.\n\nStdout lines within 200ms are batched into a single notification, so multiline output from a single event groups naturally.\n\nThe script runs in the same shell environment as Bash. Exit ends the watch (exit code is reported). Timeout → killed. Set `persistent: true` for session-length watches (log tails, long-lived event streams). In managed Cloud sandboxes, every monitor, including persistent ones, stops after {{MONITOR_MAX_TIMEOUT}} (this sandbox\'s monitor cap); elsewhere persistent monitors run until TaskStop or session end. Call Monitor again to re-arm it if you still need to watch. For much longer Cloud waits, schedule a Wake or cron (which does not keep the sandbox running between turns) and combine it with shorter monitors. Use TaskStop to cancel early.\n\nWhen someone is waiting on the result, set `backup_after_seconds` (e.g. 900). If the monitor goes that long without an event, a durable Wake brings you back to check the real state, so a queued, hung, or dead watch can\'t leave them waiting in silence.\n\n**ws source** — open a WebSocket and stream each incoming text frame as an event. No shell, no polling: the server pushes, you get notified.\n ws: {url: \'wss://events.example.com/stream\', protocols: [\'v1\']},\n description: \'deploy events\',\n\nEach text frame becomes one notification (multiline frames stay as one event). Binary frames are reported as `[binary frame, N bytes]` rather than passed through. Socket close ends the watch with the close code surfaced; errors are surfaced before close. Same rate limiting as bash — a firehose will be suppressed and eventually stopped, so subscribe to a filtered feed where one exists.\n\nPrefer this over `command: \'websocat wss://…\'` — it avoids the extra process and line-buffering pitfalls. Use bash when you need to transform or filter frames with shell tools before they become events.\n\n**script source** — a JavaScript watch loop with the same globals as CodeMode (including `decide()`), plus `emit(text)` (one event) and `sleep(ms)`. Tool calls and `decide()` share one rate limit; `decide()` spends money on every call, so call it only when an observed change needs judgment, not on every poll. Returning or throwing ends the watch.\n';
216094
+ var Monitor_default = 'Start a background monitor that streams events from a long-running script. Each stdout line is an event — you keep working and notifications arrive in the chat. Events arrive on their own schedule and are not replies from the user, even if one lands while you\'re waiting for the user to answer a question.\n\nUse Monitor when you need one notification per occurrence: indefinitely ("every time an ERROR line appears": `tail -f`, `inotifywait -m`, `while true`), or until a known end ("each CI step result, stop when the run completes": a command that emits lines and then exits). For a single notification ("tell me when the server is ready"), run a command that exits when the condition is true, e.g. `until grep -q "Ready" dev.log; do sleep 0.5; done`, in the background with your shell tool; you get one completion notification. An unbounded command used for a single notification stays armed until timeout, and `tail -f log | grep -m 1 ...` can hang the same way.\n\nFor open github.com pull requests, use WatchPR instead. It covers the whole PR surface and keeps watching after CI finishes. Use Monitor only when WatchPR does not apply.\n\n- Every pipe stage must flush per line or matches sit in its buffer unseen: `grep` needs `--line-buffered`, `awk` needs `fflush()`. `| head -N` delivers nothing until N matches accumulate.\n- In poll loops, handle transient failures (`curl ... || true`). Poll remote APIs every 30s+, local checks every 0.5–1s.\n- Only stdout is the event stream. Stderr goes to the output file named in the result, without notifications; merge it with `2>&1` for commands you run directly so failures reach your filter.\n- Every stdout line is a conversation message, so filter to the lines you\'d act on. Lines within 200ms are batched into one notification. Monitors that produce too many events are stopped automatically; restart with a tighter filter.\n\n**Coverage — silence is not success.** When watching a job for an outcome, your filter must match every terminal state, not just the happy path. A monitor that greps only for the success marker stays silent through a crashloop, a hung process, or an unexpected exit — and silence looks identical to "still running." Match failures too, e.g. `grep -E --line-buffered "elapsed_steps=|Traceback|Error|FAILED|Killed|OOM"`, and in poll loops emit on every terminal status (`succeeded|failed|cancelled|timeout`).\n\nExit ends the watch (exit code is reported). Timeout → killed. Set `persistent: true` for session-length watches (log tails, long-lived event streams). In managed Cloud sandboxes, every monitor, including persistent ones, stops after {{MONITOR_MAX_TIMEOUT}} (this sandbox\'s monitor cap); elsewhere persistent monitors run until TaskStop or session end. Call Monitor again to re-arm it if you still need to watch. For much longer Cloud waits, schedule a Wake or cron (which does not keep the sandbox running between turns) and combine it with shorter monitors. Use TaskStop to cancel early.\n\nWhen someone is waiting on the result, set `backup_after_seconds` (e.g. 900). If the monitor goes that long without an event, a durable Wake brings you back to check the real state, so a queued, hung, or dead watch can\'t leave them waiting in silence.\n\nInstead of `command`, `ws` streams each WebSocket text frame as an event (prefer it over `websocat`), and `script` runs a JavaScript watch loop with CodeMode\'s globals plus `emit(text)` and `sleep(ms)`; `decide()` spends money on every call, so call it only when an observed change needs judgment.\n';
216246
216095
  var init_Monitor = () => {};
216247
216096
 
216248
216097
  // src/tools/descriptions/Read.md
216249
- var Read_default = `# Read
216250
-
216251
- Reads a file from the local filesystem. You can access any file directly by using this tool.
216252
- Assume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned.
216253
-
216254
- Usage:
216255
- - The file_path parameter must be an absolute path, not a relative path
216256
- - \`file_path\` is literal: \`$VAR\`, \`$MEMORY_DIR\`, \`~\`, etc. are not expanded.
216257
- - By default, it reads up to 2000 lines starting from the beginning of the file
216258
- - You can optionally specify a line offset and limit (especially handy for long files), but it's recommended to read the whole file by not providing these parameters
216259
- - Any lines longer than 2000 characters will be truncated
216260
- - Results are returned using cat -n format, with line numbers starting at 1
216261
- - This tool allows Letta Code to read images (eg PNG, JPG, etc). When reading an image file the contents are presented visually as Letta Code is a multimodal LLM.
216262
- - This tool can only read files, not directories. To read a directory, use an ls command via the Bash tool.
216263
- - You can call multiple tools in a single response. It is always better to speculatively read multiple potentially useful files in parallel.
216264
- - You will regularly be asked to read screenshots. If the user provides a path to a screenshot, ALWAYS use this tool to view the file at the path. This tool will work with all temporary file paths.
216265
- - If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.
216266
- `;
216098
+ var Read_default = "Reads a file from the local filesystem.\n\n- `file_path` must be an absolute path. It is literal: `$VAR`, `$MEMORY_DIR`, `~`, etc. are not expanded.\n- Reads up to 2000 lines by default; lines longer than 2000 characters are truncated.\n- When you already know which part of the file you need, only read that part with `offset` and `limit`. This can be important for larger files.\n- Results are returned using cat -n format, with line numbers starting at 1.\n- Reads images (PNG, JPG, …) and presents them visually.\n- Reading a directory or a missing file returns an error; an empty file returns a system reminder instead of content.\n";
216267
216099
  var init_Read = () => {};
216268
216100
 
216269
216101
  // src/tools/descriptions/ReadArtifactFile.md
@@ -216314,69 +216146,7 @@ This helps you catch type errors before making edits.
216314
216146
  var init_ReadLSP = () => {};
216315
216147
 
216316
216148
  // src/tools/descriptions/SendAgentMessage.md
216317
- var SendAgentMessage_default = `# SendAgentMessage
216318
-
216319
- Send a message without waiting for its answer. Letta-to-Letta messages require
216320
- the Cloud backend and fail on the local backend (\`agent-local-\` IDs). Use this
216321
- to coordinate with an agent already working, including an Agent child, or to
216322
- contact any conversation you are authorized to access.
216323
-
216324
- External coding workers return IDs backed by their native sessions. Use the
216325
- receipt to distinguish steering from a new or queued follow-up. An idle follow-up
216326
- starts one tracked local background turn. These messages do not use the Cloud
216327
- messaging backend.
216328
- Computer-qualified IDs returned by remote launches can be steered too.
216329
-
216330
- An agent has a persistent identity and shared memory. It can have multiple
216331
- conversations, each with its own message history.
216332
-
216333
- - Supply \`conversation_id\` to message an existing thread, or \`agent_id\` alone to
216334
- start a new hidden thread with that agent. To use an agent's default conversation,
216335
- supply its \`agent_id\` and \`conversation_id: "default"\`. Pass the full
216336
- conversation ID; truncated IDs are rejected.
216337
- - Your agent and conversation IDs are attached automatically as the return address.
216338
- To reply, the recipient must explicitly send to that address. Ordinary assistant
216339
- output is not forwarded back to you.
216340
- - A successful send means Cloud accepted the message; the recipient may not have
216341
- read it yet. Continue working rather than waiting for the answer.
216342
- - Omit \`computer\` unless a particular computer is needed. If the conversation is
216343
- active on A, selecting B is rejected rather than moving the conversation.
216344
- - If delivery cannot be confirmed, check the recipient's messages before resending
216345
- to avoid duplicates. The tool result includes details for inspecting the send.
216346
- - Keep sends sparse and useful: concise assignments, specific questions, or
216347
- material updates. Skip status pings and repeated acknowledgments; repeat a
216348
- point only when you have something new to add.
216349
- - For work already underway, treat the agent doing it as its owner. Send what it
216350
- needs, then let it decide. Do not take over or redo its work. If you think
216351
- ownership should change, ask the human instead of declaring it in a message.
216352
-
216353
- If you are a subagent, omitting both \`agent_id\` and \`conversation_id\` sends to
216354
- your parent (the agent and conversation that launched you). Message your parent
216355
- rarely: each message stays in both contexts, and your final report already
216356
- reaches it. Send one only when a parent decision would otherwise force you to
216357
- redo work, stating the default you will take, then keep working. Steering your
216358
- own children (Agent, Claude Code, or Codex) is normal; message them as often as
216359
- the work needs.
216360
-
216361
- Use Agent to launch or resume a managed Letta child task and receive its
216362
- completion notification. Letta-to-Letta sends create no local task ID. External
216363
- coding-agent follow-ups may return one when they start a new native turn; an
216364
- active external-agent steer remains part of the existing task. SendAgentMessage does not
216365
- change the recipient's tools, model, or permissions.
216366
-
216367
- On the local backend (\`agent-local-\` IDs), or from a script, send with the CLI
216368
- instead. It waits for the recipient's turn and prints its final message as
216369
- \`result\`, with the thread to continue in \`conversation_id\`:
216370
-
216371
- \`\`\`bash
216372
- letta -p --from-agent $LETTA_AGENT_ID --conversation <conversation-id> --output-format json "message"
216373
- letta -p --from-agent $LETTA_AGENT_ID --agent <agent-id> --output-format json "message" # new thread
216374
- \`\`\`
216375
-
216376
- Add \`--backend local\` after \`letta\` when your agent ID starts with \`agent-local-\`.
216377
- \`letta messages list --conversation <id> --limit 10\` reads a thread on either
216378
- backend; \`letta -p --help\` and \`letta messages --help\` list the other options.
216379
- `;
216149
+ var SendAgentMessage_default = 'Send a message without waiting for its answer. Use this to coordinate with an agent already working, including an Agent child, or to contact any conversation you are authorized to access. Letta-to-Letta messages require the Cloud backend and fail on the local backend (`agent-local-` IDs).\n\n- Supply `conversation_id` to message an existing thread, or `agent_id` alone to start a new hidden thread with that agent. To use an agent\'s default conversation, supply its `agent_id` and `conversation_id: "default"`. Pass the full conversation ID; truncated IDs are rejected.\n- Your agent and conversation IDs are attached automatically as the return address. To reply, the recipient must explicitly send to that address. Ordinary assistant output is not forwarded back to you.\n- A successful send means the message was accepted; the recipient may not have read it yet. Continue working rather than waiting for the answer.\n- External coding workers launched with Agent (including computer-qualified IDs from remote launches) can be messaged too. If the worker is mid-turn, the result says the message steered that turn; if it was idle, the result includes a `task_id` and you are notified when the new turn finishes.\n- Omit `computer` unless a particular computer is needed. If the conversation is active on A, selecting B is rejected rather than moving the conversation.\n- If delivery cannot be confirmed, check the recipient\'s messages before resending to avoid duplicates.\n- Keep sends sparse and useful: concise assignments, specific questions, or material updates. Skip status pings and repeated acknowledgments; repeat a point only when you have something new to add.\n- For work already underway, treat the agent doing it as its owner. Send what it needs, then let it decide. Do not take over or redo its work. If you think ownership should change, ask the human instead of declaring it in a message.\n\nIf you are a subagent, omitting both `agent_id` and `conversation_id` sends to your parent (the agent and conversation that launched you). Message your parent rarely: each message stays in both contexts, and your final report already reaches it. Send one only when a parent decision would otherwise force you to redo work, stating the default you will take, then keep working. Steering your own children is normal; message them as often as the work needs.\n\nOn the local backend, or from a script, use the CLI instead; it waits and prints the reply: `letta -p --from-agent $LETTA_AGENT_ID --conversation <conversation-id> --output-format json "message"` (add `--backend local` after `letta` for `agent-local-` IDs; `letta -p --help` lists options).\n';
216380
216150
  var init_SendAgentMessage = () => {};
216381
216151
 
216382
216152
  // src/tools/descriptions/SetWorkingDirectory.md
@@ -216391,172 +216161,43 @@ Use EnterWorktree instead when starting isolated feature or bug-fix work that sh
216391
216161
  var init_SetWorkingDirectory = () => {};
216392
216162
 
216393
216163
  // src/tools/descriptions/Skill.md
216394
- var Skill_default = `# Skill
216164
+ var Skill_default = "Invoke a skill.\n\nA skill is a packaged set of instructions the user or project has set up for a particular kind of task (deploy steps, a review checklist, a repo-specific workflow). Available skills are listed in your prompt context with one-line descriptions. When the task at hand is one a listed skill covers, call this tool first — the skill's instructions load into the turn for you to follow in place of your default approach. Users may also ask for one by name (`/<name>`, or \"slash command\"); that's a request to invoke it.\n\n- `skill`: exact name from the listing, no leading slash.\n\nOnly names from the listing (or that the user typed explicitly) are valid. Built-in CLI commands (`/help`, `/clear`, …) aren't skills. Do not invoke a skill that is already running. If a `<command-name>` block is already present this turn, the skill is loaded — follow it directly rather than calling again.\n";
216165
+ var init_Skill = () => {};
216395
216166
 
216396
- Execute a skill within the main conversation
216167
+ // src/tools/descriptions/Task.md
216168
+ var Task_default = `# Agent
216397
216169
 
216398
- When users ask you to perform tasks, check if any of the available skills match. Skills provide specialized capabilities and domain knowledge.
216170
+ Launch an agent in the background. You'll be notified when it finishes; the user does not see its result unless you relay it.
216399
216171
 
216400
- When users reference a "slash command" or "/<something>" (e.g., "/commit", "/review-pr"), they are referring to a skill. Use this tool to invoke it.
216172
+ A fresh agent knows only what you put in the prompt, and you see only the summary it sends back. Do the work yourself when it is a handful of tool calls or a lookup whose target you already know; delegate independent work that can run in parallel, or reading across many files where you only need the conclusion. Once you've delegated something, don't also run it yourself; wait for the result. Never fabricate or predict a pending agent's result: if the user asks before the notification arrives, say it's still running.
216401
216173
 
216402
- How to invoke:
216403
- - Use this tool with only the skill name
216404
- - Examples:
216405
- - \`skill: "pdf"\` - invoke the pdf skill
216406
- - \`skill: "commit"\` - invoke the commit skill
216407
- - \`skill: "review-pr"\` - invoke the review-pr skill
216408
- - \`skill: "ms-office-suite:pdf"\` - invoke using fully qualified name
216174
+ To steer an agent that is still working, call SendAgentMessage with the receipt's \`Agent ID\`, plus its \`Conversation ID\` when the receipt has one. For external harnesses, the Agent ID is the native session ID with a harness prefix (e.g. \`claude_<session-id>\`), and sending to it resumes that session. Do not call Agent again for the same task.
216409
216175
 
216410
- Important:
216411
- - Available skills are included in your current prompt context in the conversation
216412
- - When a skill matches the user's request, this is a BLOCKING REQUIREMENT: invoke the relevant Skill tool BEFORE generating any other response about the task
216413
- - NEVER mention a skill without actually calling this tool
216414
- - Do not invoke a skill that is already running
216415
- - Do not use this tool for built-in CLI commands (like /help, /clear, etc.)
216416
- - If you see a <command-name> tag in the current conversation turn, the skill has ALREADY been loaded - follow the instructions directly instead of calling this tool again
216176
+ Progress and history:
216177
+ - \`Output file\`: readable progress log.
216178
+ - \`Event log\`: complete, untruncated JSONL record of tool calls, tool results, messages, and reasoning.
216179
+ - Letta agents: \`letta messages list --agent <agent_id> --conversation <conversation_id>\` reads the full conversation, including later turns.
216417
216180
  `;
216418
- var init_Skill = () => {};
216419
-
216420
- // src/tools/descriptions/Task.md
216421
- var Task_default = "# Agent\n\nLaunch an agent in the background. You'll be notified when it finishes; the user does not see its result unless you relay it.\n\nTo steer an agent that is still working, call SendAgentMessage with the receipt's `Agent ID`, plus its `Conversation ID` when the receipt has one. For external harnesses, the Agent ID is the native session ID with a harness prefix (e.g. `claude_<session-id>`), and sending to it resumes that session. Do not call Agent again for the same task.\n\nProgress and history:\n- `Output file`: readable progress log.\n- `Event log`: complete, untruncated JSONL record of tool calls, tool results, messages, and reasoning.\n- Letta agents: `letta messages list --agent <agent_id> --conversation <conversation_id>` reads the full conversation, including later turns.\n";
216422
216181
  var init_Task = () => {};
216423
216182
 
216424
216183
  // src/tools/descriptions/TaskCreate.md
216425
- var TaskCreate_default = `# TaskCreate
216426
-
216427
- Create a new task in the session task list.
216428
-
216429
- Tasks help you track progress on complex, multi-step work and show the user what you're planning to do. Each task gets a stable ID you can reference from \`TaskGet\`, \`TaskList\`, and \`TaskUpdate\`.
216430
-
216431
- ## When to use this tool
216432
-
216433
- Use TaskCreate proactively for:
216434
-
216435
- 1. **Complex multi-step tasks** — 3+ distinct steps or actions
216436
- 2. **Non-trivial tasks** — careful planning or multiple operations required
216437
- 3. **User provides multiple tasks** — numbered lists, comma-separated requests
216438
- 4. **New instructions arrive** — capture user requirements as tasks immediately
216439
- 5. **Starting work** — create the task, then \`TaskUpdate\` it to \`in_progress\`
216440
-
216441
- ## When NOT to use this tool
216442
-
216443
- - Single, trivial task — just do it
216444
- - Purely informational or conversational replies
216445
- - Tasks that take fewer than 3 trivial steps
216446
-
216447
- ## Required fields
216448
-
216449
- - \`subject\` — short imperative (e.g. "Run tests", "Fix auth bug")
216450
- - \`description\` — full description with enough context to be actionable later
216451
-
216452
- ## Optional fields
216453
-
216454
- - \`activeForm\` — present-continuous form shown during execution (e.g. "Running tests")
216455
- - \`metadata\` — free-form \`{string: string}\` bag for ad-hoc annotations
216456
-
216457
- ## Example
216458
-
216459
- \`\`\`
216460
- TaskCreate({
216461
- subject: "Add dark mode toggle",
216462
- description: "Add a dark mode toggle to the Settings page. Wire it into the existing theme context and persist the preference to localStorage.",
216463
- activeForm: "Adding dark mode toggle",
216464
- metadata: { area: "ui", priority: "medium" }
216465
- })
216466
- \`\`\`
216467
-
216468
- Returns the full task record including the assigned \`taskId\`.
216469
- `;
216184
+ var TaskCreate_default = 'Create a new task in the session task list. Tasks track progress on multi-step work and show the user what you\'re planning; each gets a stable ID for `TaskGet`, `TaskList`, and `TaskUpdate`.\n\nUse it proactively for work with 3+ distinct steps, when the user gives several tasks, or when new requirements arrive. Skip it for single, trivial, or purely conversational work. When starting a task, `TaskUpdate` it to `in_progress`.\n\n- `subject`: short imperative (e.g. "Run tests").\n- `description`: enough context to be actionable later.\n- `activeForm` (optional): present-continuous form shown during execution (e.g. "Running tests").\n\nReturns the full task record including the assigned `taskId`.\n';
216470
216185
  var init_TaskCreate = () => {};
216471
216186
 
216472
216187
  // src/tools/descriptions/TaskGet.md
216473
- var TaskGet_default = '# TaskGet\n\nFetch a single task by its `taskId`.\n\nReturns the full task record, including `subject`, `description`, `status`, `owner`, dependency edges (`blocks`, `blockedBy`), and `metadata`.\n\n## Notes\n\n- Errors if the task ID doesn\'t exist or was deleted.\n\n## Example\n\n```\nTaskGet({ taskId: "task_3" })\n```\n';
216188
+ var TaskGet_default = "Fetch a single task by its `taskId`. Returns the full task record, including `subject`, `description`, `status`, `owner`, dependency edges (`blocks`, `blockedBy`), and `metadata`. Errors if the task ID doesn't exist or was deleted.\n";
216474
216189
  var init_TaskGet = () => {};
216475
216190
 
216476
216191
  // src/tools/descriptions/TaskList.md
216477
- var TaskList_default = '# TaskList\n\nList all tasks in the current session, in creation order.\n\nTasks removed with `status: "deleted"` are excluded from the output and cannot be retrieved.\n\n## When to use\n\n- Check current progress without scrolling back through the transcript\n- Verify state before committing to a sequence of `TaskUpdate` calls\n- Confirm task IDs before wiring `addBlocks` / `addBlockedBy` dependencies\n\n## Returns\n\n```\n{ "tasks": [TaskRecord, ...] }\n```\n\nEach `TaskRecord` includes `taskId`, `subject`, `description`, `activeForm`, `status`, `owner`, `blocks`, `blockedBy`, `metadata`, `createdAt`, `updatedAt`.\n';
216192
+ var TaskList_default = 'List all tasks in the current session, in creation order. Deleted tasks are excluded.\n\nReturns `{ "tasks": [TaskRecord, ...] }`; each record includes `taskId`, `subject`, `description`, `activeForm`, `status`, `owner`, `blocks`, `blockedBy`, `metadata`, `createdAt`, `updatedAt`.\n';
216478
216193
  var init_TaskList = () => {};
216479
216194
 
216480
216195
  // src/tools/descriptions/TaskStop.md
216481
- var TaskStop_default = "# TaskStop\n\n- Stops a running background task or monitor by its ID\n- Required: `task_id` (the task to terminate; the legacy `shell_id` alias has been removed — bash background shells share the same ID space as other tasks)\n- Returns `{ killed: boolean }` indicating whether the task was actively running and got terminated\n- Use this tool when you need to terminate a long-running task\n";
216196
+ var TaskStop_default = "- Stops a running background task or monitor by its `task_id`\n- Returns `{ killed: boolean }` indicating whether the task was actively running and got terminated\n";
216482
216197
  var init_TaskStop = () => {};
216483
216198
 
216484
216199
  // src/tools/descriptions/TaskUpdate.md
216485
- var TaskUpdate_default = `Use this tool to update a task in the task list.
216486
-
216487
- ## When to Use This Tool
216488
-
216489
- **Mark tasks as resolved:**
216490
- - When you have completed the work described in a task
216491
- - When a task is no longer needed or has been superseded
216492
- - IMPORTANT: Always mark your assigned tasks as resolved when you finish them
216493
- - After resolving, call TaskList to find your next task
216494
-
216495
- - ONLY mark a task as completed when you have FULLY accomplished it
216496
- - If you encounter errors, blockers, or cannot finish, keep the task as in_progress
216497
- - When blocked, create a new task describing what needs to be resolved
216498
- - Never mark a task as completed if:
216499
- - Tests are failing
216500
- - Implementation is partial
216501
- - You encountered unresolved errors
216502
- - You couldn't find necessary files or dependencies
216503
-
216504
- **Delete tasks:**
216505
- - When a task is no longer relevant or was created in error
216506
- - Setting status to \`deleted\` permanently removes the task
216507
-
216508
- **Update task details:**
216509
- - When requirements change or become clearer
216510
- - When establishing dependencies between tasks
216511
-
216512
- ## Fields You Can Update
216513
-
216514
- - **status**: The task status (see Status Workflow below)
216515
- - **subject**: Change the task title (imperative form, e.g., "Run tests")
216516
- - **description**: Change the task description
216517
- - **activeForm**: Present continuous form shown in spinner when in_progress (e.g., "Running tests")
216518
- - **owner**: Change the task owner (agent name)
216519
- - **metadata**: Merge metadata keys into the task (set a key to null to delete it)
216520
- - **addBlocks**: Mark tasks that cannot start until this one completes
216521
- - **addBlockedBy**: Mark tasks that must complete before this one can start
216522
-
216523
- ## Status Workflow
216524
-
216525
- Status progresses: \`pending\` → \`in_progress\` → \`completed\`
216526
-
216527
- Use \`deleted\` to permanently remove a task.
216528
-
216529
- ## Staleness
216530
-
216531
- Make sure to read a task's latest state using \`TaskGet\` before updating it.
216532
-
216533
- ## Examples
216534
-
216535
- Mark task as in progress when starting work:
216536
- \`\`\`json
216537
- {"taskId": "1", "status": "in_progress"}
216538
- \`\`\`
216539
-
216540
- Mark task as completed after finishing work:
216541
- \`\`\`json
216542
- {"taskId": "1", "status": "completed"}
216543
- \`\`\`
216544
-
216545
- Delete a task:
216546
- \`\`\`json
216547
- {"taskId": "1", "status": "deleted"}
216548
- \`\`\`
216549
-
216550
- Claim a task by setting owner:
216551
- \`\`\`json
216552
- {"taskId": "1", "owner": "my-name"}
216553
- \`\`\`
216554
-
216555
- Set up task dependencies:
216556
- \`\`\`json
216557
- {"taskId": "2", "addBlockedBy": ["1"]}
216558
- \`\`\`
216559
- `;
216200
+ var TaskUpdate_default = 'Update a task in the task list. Read its latest state with `TaskGet` before updating.\n\n- Status moves `pending` → `in_progress` → `completed`; `deleted` permanently removes a task.\n- Mark a task completed only when it is fully done. If tests are failing, the implementation is partial, or you hit unresolved errors or blockers, keep it `in_progress` and create a new task describing what needs to be resolved.\n- Always mark your assigned tasks resolved when you finish them, then call TaskList to find your next task.\n- You can also change `subject`, `description`, `activeForm`, `owner`, merge `metadata` keys (null deletes a key), and add dependencies with `addBlocks` / `addBlockedBy`.\n\nExample: `{"taskId": "1", "status": "in_progress"}`\n';
216560
216201
  var init_TaskUpdate = () => {};
216561
216202
 
216562
216203
  // src/tools/descriptions/UpdatePlan.md
@@ -216573,7 +216214,7 @@ var ViewImage_default = `View a local image file from the filesystem when visual
216573
216214
  var init_ViewImage = () => {};
216574
216215
 
216575
216216
  // src/tools/descriptions/Wake.md
216576
- var Wake_default = "Schedule a future turn for the current conversation. Wake is the durable, time-based counterpart to Monitor: use Monitor when ongoing work can emit an event, and Wake when you need to act at a future time even if nothing emits one.\n\nWake is always self-bound. It cannot target another agent, conversation, or computer.\n\n- `create`: provide `name`, `prompt`, and exactly one of `after_seconds`, `scheduled_at`, or `cron`.\n- `list`: list active and paused wakes for this conversation.\n- `cancel`: provide the `id` returned by create or list.\n\nWrite `prompt` as a note to your future self, not a script: what you are waiting on, what you planned and why, and what to check before acting. When the wake fires, the situation or people's wishes may have changed since you wrote it.\n\nUse `after_seconds` for ordinary follow-ups such as checking again in five minutes. `scheduled_at` must be RFC 3339 with `Z` or an explicit UTC offset. `cron` is a recurring five-field UTC expression and cannot run more often than hourly.\n\nFor calendar requests such as “tomorrow at 9am,” resolve the date in the user's timezone and pass `scheduled_at` with an explicit offset. Infer a reasonable timezone from available context instead of asking a redundant follow-up. State the timezone you used in the confirmation (for example, “Scheduled for 9:00 AM PT”) so the user can correct the assumption.\n\nWakes created in a managed Cloud sandbox survive sandbox shutdown. Wakes created on a user-managed computer or self-hosted runtime use its local scheduler and only fire while a listener is active. List and cancel include both local and Cloud wakes already bound to this conversation, so older wakes remain manageable. The create result warns when no listener currently owns local schedules.\n\nFor advanced scheduling, load the `scheduling-tasks` skill and use `letta cron`. The CLI can target fresh, default, or other conversations and, from managed Cloud, connected computers; it can also inspect run history and manage schedules outside the current conversation.\n";
216217
+ var Wake_default = "Schedule a future turn for the current conversation. Wake is the durable, time-based counterpart to Monitor: use Monitor when ongoing work can emit an event, and Wake when you need to act at a future time even if nothing emits one.\n\nWake is always self-bound. It cannot target another agent, conversation, or computer.\n\n- `create`: provide `name`, `prompt`, and exactly one of `after_seconds`, `scheduled_at`, or `cron`.\n- `list`: list active and paused wakes for this conversation.\n- `cancel`: provide the `id` returned by create or list.\n\nWrite `prompt` as a note to your future self, not a script: what you are waiting on, what you planned and why, and what to check before acting. When the wake fires, the situation or people's wishes may have changed since you wrote it.\n\nUse `after_seconds` for ordinary follow-ups. `scheduled_at` must be RFC 3339 with `Z` or an explicit UTC offset. `cron` is a recurring five-field UTC expression and cannot run more often than hourly. For calendar requests such as \"tomorrow at 9am,\" resolve the time in the user's timezone (inferred from context), pass an explicit offset, and state the timezone you used.\n\nWakes created in a managed Cloud sandbox survive sandbox shutdown; elsewhere they fire only while a listener is active, and the create result warns when none is. For schedules targeting other conversations or computers, load the `scheduling-tasks` skill.\n";
216577
216218
  var init_Wake = () => {};
216578
216219
 
216579
216220
  // src/tools/descriptions/WatchPR.md
@@ -216581,37 +216222,20 @@ var WatchPR_default = `Watch one open github.com pull request until it merges, c
216581
216222
 
216582
216223
  In managed Cloud sandboxes, WatchPR also stops after {{MONITOR_MAX_TIMEOUT}} (this sandbox's monitor cap) and sends a timeout notification. Call WatchPR again to re-arm it if you still need to watch. For much longer waits, use Wake or cron (which does not keep the sandbox running between turns) and combine it with shorter watches. Local watches have no duration limit.
216583
216224
 
216584
- Use WatchPR instead of writing a Monitor or shell polling loop when you need ongoing notifications about a PR. Start at most one watch per PR. It reports:
216585
-
216586
- - current-head check failures, recoveries, retries, and completion;
216587
- - new or edited PR comments, submitted reviews, and inline review comments;
216588
- - unresolved review-thread blockers and resolved, reopened, or outdated transitions;
216589
- - head changes, draft changes, merge conflicts, and GitHub merge-state changes;
216590
- - merge-ready regressions, merge-ready transitions, watcher errors, merge, and close.
216225
+ Use WatchPR instead of writing a Monitor or shell polling loop when you need ongoing notifications about a PR: checks, comments, reviews, review threads, pushes, conflicts, merge state, merge, and close. Start at most one watch per PR.
216591
216226
 
216592
- The initial result includes current blockers and changes since the previous watch ended for the same agent, conversation, and PR, when a locally saved snapshot is at most seven days old. The first snapshot is never merge-ready: readiness requires a second consecutive read on the same head, so \`awaiting a second same-head readiness read\` is expected at startup. Later changes arrive as task notifications in this conversation. The watcher uses the locally authenticated \`gh\` CLI, polls every 30 seconds while GitHub is reachable, backs off after refresh errors, and keeps watching after checks become green because reviews, comments, conflicts, and new pushes can still arrive. Green checks are not the same as a mergeable PR, so report the PR as ready, green, or mergeable only once the watcher reports it merge-ready.
216227
+ The initial result includes current blockers and changes since the previous watch ended for the same agent, conversation, and PR, when a locally saved snapshot is at most seven days old. The first snapshot is never merge-ready: readiness requires a second consecutive read on the same head, so \`awaiting a second same-head readiness read\` is expected at startup. Later changes arrive as task notifications in this conversation. It uses the locally authenticated \`gh\` CLI and keeps watching after checks become green because reviews, comments, conflicts, and new pushes can still arrive. Green checks are not the same as a mergeable PR, so report the PR as ready, green, or mergeable only once the watcher reports it merge-ready.
216593
216228
 
216594
216229
  Pass a URL ending at the PR number, such as \`https://github.com/owner/repo/pull/123\`. Remove \`/files\`, \`/commits\`, \`/checks\`, and other suffixes. The watcher is read-only and errors if the PR is already merged or closed.
216595
216230
  `;
216596
216231
  var init_WatchPR = () => {};
216597
216232
 
216598
216233
  // src/tools/descriptions/Workflow.md
216599
- var Workflow_default = "Execute a workflow script that orchestrates multiple subagents deterministically (loops, conditionals, fan-out) rather than model-driven.\n\nWorkflows run in the background: this tool returns immediately with a task ID, and a <task-notification> carrying the script's return value arrives when the workflow completes. Do not poll or sleep for it, and never fabricate the result before it arrives. TaskStop aborts the run. With `wait: true`, the workflow runs in the foreground instead and this tool returns the script's value directly.\n\nScripts that call `agent()` or `decide()` spend money on subagents and model calls. Run one only when the user explicitly asked for a workflow or multi-agent orchestration (\"use a workflow\", \"fan out agents\") or a skill's instructions call this tool; otherwise describe the workflow and ask first. For scripts that only call tools, use CodeMode instead.\n\nScripts can call tools directly: `await tools.<name>(args)` for this turn's built-in tools and `await tools.mcp__server__tool(args)` for the agent's MCP tools, subject to the user's permission rules. `await listTools()` returns `[{ name, description }]`; `await describeTool(name)` returns `{ name, description, inputSchema }`, or `undefined` for an unknown tool.\n\nScripts are plain JavaScript and must begin with `export const meta = {...}`, a pure literal (no variables, calls, or interpolation). Pass the work list via `args`. `process.env` holds the variables a Bash command sees plus the agent's secrets. Prefer `pipeline()` so each item moves to its next stage as soon as it is ready. Await `agent()` calls: failures reject with the cause, `callIndex`, and `conversationId` when available. `parallel()` and `pipeline()` let siblings finish, then reject if any callback failed; a failed pipeline item skips its remaining stages. Catch errors explicitly inside callbacks for best-effort processing.\n\n export const meta = {\n name: 'review-files',\n description: 'Review each file for bugs, verify each finding',\n phases: [{ title: 'Review' }, { title: 'Verify' }],\n }\n const findings = {type: 'object', properties: {bugs: {type: 'array', items: {type: 'string'}}}, required: ['bugs']}\n const verdict = {type: 'object', properties: {real: {type: 'boolean'}}, required: ['real']}\n const results = await pipeline(\n args.files,\n f => agent(`Review ${f} for bugs.`, { phase: 'Review', schema: findings }),\n (review, f) => parallel(review.bugs.map(bug => () =>\n agent(`Is this a real bug in ${f}? ${bug}`, { phase: 'Verify', schema: verdict })\n .then(v => v.real ? { file: f, bug } : null))),\n )\n return results.flat().filter(Boolean)\n\nBefore authoring a script, load the `workflow-authoring` skill — the script API, pipeline-vs-barrier rules, quality patterns, worked examples, and how to diagnose a run.\n";
216234
+ var Workflow_default = "Execute a workflow script that orchestrates multiple subagents deterministically (loops, conditionals, fan-out) rather than model-driven.\n\nWorkflows run in the background: this tool returns immediately with a task ID, and a <task-notification> carrying the script's return value arrives when the workflow completes. Do not poll or sleep for it, and never fabricate the result before it arrives. TaskStop aborts the run. With `wait: true`, the workflow runs in the foreground instead and this tool returns the script's value directly.\n\nScripts that call `agent()` or `decide()` spend money on subagents and model calls. Run one only when the user explicitly asked for a workflow or multi-agent orchestration (\"use a workflow\", \"fan out agents\") or a skill's instructions call this tool; otherwise describe the workflow and ask first. For scripts that only call tools, use CodeMode instead.\n\nScripts can call tools directly: `await tools.<name>(args)` for this turn's built-in tools and `await tools.mcp__server__tool(args)` for the agent's MCP tools, subject to the user's permission rules. `await listTools()` returns `[{ name, description }]`; `await describeTool(name)` returns `{ name, description, inputSchema }`, or `undefined` for an unknown tool.\n\nScripts are plain JavaScript and must begin with `export const meta = {...}`, a pure literal (no variables, calls, or interpolation). Pass the work list via `args`. `process.env` holds the variables a shell command sees plus the agent's secrets. Prefer `pipeline()` so each item moves to its next stage as soon as it is ready. Await `agent()` calls: failures reject with the cause, `callIndex`, and `conversationId` when available. `parallel()` and `pipeline()` let siblings finish, then reject if any callback failed; a failed pipeline item skips its remaining stages. Catch errors explicitly inside callbacks for best-effort processing.\n\nBefore authoring a script, load the `workflow-authoring` skill — the script API, pipeline-vs-barrier rules, quality patterns, worked examples, and how to diagnose a run.\n";
216600
216235
  var init_Workflow = () => {};
216601
216236
 
216602
216237
  // src/tools/descriptions/Write.md
216603
- var Write_default = `# Write
216604
-
216605
- Writes a file to the local filesystem.
216606
-
216607
- Usage:
216608
- - This tool will overwrite the existing file if there is one at the provided path.
216609
- - If this is an existing file, you MUST use the Read tool first to read the file's contents. This tool will fail if you did not read the file first. Exception: memory files whose contents are already present in your system prompt do not require a Read call first. For memory files, pass an expanded absolute path (use Bash to resolve \`$MEMORY_DIR\` first if needed).
216610
- - \`file_path\` is literal: \`$VAR\`, \`$MEMORY_DIR\`, \`~\`, etc. are not expanded.
216611
- - ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
216612
- - NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.
216613
- - Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.
216614
- `;
216238
+ var Write_default = "Writes a file to the local filesystem, overwriting if one exists.\n\nWhen to use: creating a new file, or fully replacing one you've already Read. For partial changes, use Edit instead.\n\n- Exception: memory files whose contents are already present in your system prompt do not require a Read call first. For memory files, pass an expanded absolute path.\n- `file_path` is literal: `$VAR`, `$MEMORY_DIR`, `~`, etc. are not expanded.\n";
216615
216239
  var init_Write = () => {};
216616
216240
 
216617
216241
  // src/tools/descriptions/WriteArtifactFile.md
@@ -216619,7 +216243,7 @@ var WriteArtifactFile_default = "Write a file under the Letta Code Desktop artif
216619
216243
  var init_WriteArtifactFile = () => {};
216620
216244
 
216621
216245
  // src/tools/descriptions/WriteStdin.md
216622
- var WriteStdin_default = "Writes characters to an existing unified exec session and returns recent output.\n\nUse this tool to send input, interrupt a process, or inspect new output from a long-lived interactive process such as a dev server or REPL. Do not call it with empty `chars` merely to wait for completion; `exec_command` sends a notification when a yielded process completes. If the process needs a completion deadline, create a one-shot Wake instead of blocking or polling.\n";
216246
+ var WriteStdin_default = "Writes characters to an existing unified exec session and returns recent output.\n\nDo not call it with empty `chars` merely to wait for completion; `exec_command` sends a notification when a yielded process completes. If the process needs a completion deadline, create a one-shot Wake instead of blocking or polling.\n";
216623
216247
  var init_WriteStdin = () => {};
216624
216248
 
216625
216249
  // src/utils/text-files.ts
@@ -232831,19 +232455,10 @@ function filterMemoryToolByMemoryFormat(registry4, agentId) {
232831
232455
  function filterExternalToolsByRuntimeContext(externalTools, runtimeContext) {
232832
232456
  return new Map(Array.from(externalTools.entries()).filter(([, tool]) => {
232833
232457
  const matchesRuntime = !tool.runtime || (tool.runtime.agentId ?? null) === (runtimeContext.agentId ?? null) && tool.runtime.conversationId === runtimeContext.conversationId;
232834
- const matchesConnection = tool.connectionId === undefined || tool.connectionId === runtimeContext.connectionId || tool.runtime !== undefined && tool.scopeId === undefined;
232458
+ const matchesConnection = tool.connectionId === undefined || tool.connectionId === runtimeContext.connectionId || tool.runtime !== undefined;
232835
232459
  return matchesRuntime && matchesConnection;
232836
232460
  }));
232837
232461
  }
232838
- function filterExternalToolsByScopeIds(externalTools, externalToolScopeIds) {
232839
- const selectedScopes = new Set(externalToolScopeIds ?? []);
232840
- return new Map(Array.from(externalTools.entries()).filter(([, tool]) => {
232841
- if (tool.scopeId === undefined) {
232842
- return true;
232843
- }
232844
- return selectedScopes.has(tool.scopeId);
232845
- }));
232846
- }
232847
232462
  function filterModToolsByClientAllowlist(modTools, clientToolAllowlist) {
232848
232463
  if (clientToolAllowlist === undefined) {
232849
232464
  return new Map(modTools);
@@ -233055,7 +232670,7 @@ function capturePreparedToolExecutionContext(snapshot, options) {
233055
232670
  const toolRegistrySnapshot = filterMemoryToolByMemoryFormat(applySubagentToolPolicy(filterToolRegistryByClientAllowlist(snapshot.toolRegistry, clientToolAllowlist), readSubagentDepth(getRuntimeExecutionEnv(process.env, runtimeContext.executionSettings))), runtimeContext.agentId);
233056
232671
  const executionSnapshot = {
233057
232672
  toolRegistry: toolRegistrySnapshot,
233058
- externalTools: selectModelFacingExternalTools(filterExternalToolsByClientAllowlist(filterExternalToolsByScopeIds(filterExternalToolsByRuntimeContext(snapshot.externalTools, runtimeContext), options?.externalToolScopeIds), clientToolAllowlist), runtimeContext.connectionId),
232673
+ externalTools: selectModelFacingExternalTools(filterExternalToolsByClientAllowlist(filterExternalToolsByRuntimeContext(snapshot.externalTools, runtimeContext), clientToolAllowlist), options?.externalToolOwnerConnectionId ?? runtimeContext.connectionId),
233059
232674
  externalExecutor: snapshot.externalExecutor,
233060
232675
  modContext: options?.modContext ?? snapshot.modContext,
233061
232676
  modEvents: options?.modEvents ?? snapshot.modEvents,
@@ -248027,7 +247642,7 @@ class CodexAppServerClient {
248027
247642
  await this.request("initialize", {
248028
247643
  clientInfo: {
248029
247644
  name: "letta-code",
248030
- version: "0.34.44"
247645
+ version: "0.34.46"
248031
247646
  },
248032
247647
  capabilities: null
248033
247648
  });
@@ -264889,7 +264504,8 @@ function scheduleDurableQueueRestore(listener, capacityReleased = true) {
264889
264504
  function queueRemovalTransition(item, disposition) {
264890
264505
  return {
264891
264506
  client_message_id: item.clientMessageId ?? `cm-${item.id}`,
264892
- disposition
264507
+ disposition,
264508
+ source: item.source
264893
264509
  };
264894
264510
  }
264895
264511
  function ensureConversationQueueRuntime(listener, runtime) {
@@ -270297,8 +269913,6 @@ function getInputToolSelectionError(payload) {
270297
269913
  return "Protocol violation: client_preferences must contain only an optional toolset with include: known bundled tool names[]";
270298
269914
  if (payload.exclude_interactive_tools !== undefined && typeof payload.exclude_interactive_tools !== "boolean")
270299
269915
  return "Protocol violation: input.payload.exclude_interactive_tools must be boolean";
270300
- if (payload.external_tool_scope_ids !== undefined && !isStringArray8(payload.external_tool_scope_ids))
270301
- return "Protocol violation: input.payload.external_tool_scope_ids must be string[]";
270302
269916
  return null;
270303
269917
  }
270304
269918
  var init_input_tool_selection = __esm(async () => {
@@ -270360,10 +269974,19 @@ function isExternalToolDefinitionPayload(value) {
270360
269974
  return false;
270361
269975
  return typeof value.name === "string" && (value.label === undefined || typeof value.label === "string") && typeof value.description === "string" && isRecord13(value.parameters) && (value.auto_background === undefined || typeof value.auto_background === "boolean") && (value.timeout_ms === undefined || typeof value.timeout_ms === "number" && Number.isSafeInteger(value.timeout_ms) && value.timeout_ms >= 1000 && value.timeout_ms <= 300000);
270362
269976
  }
269977
+ function isStringList(value) {
269978
+ return Array.isArray(value) && value.every((entry) => typeof entry === "string");
269979
+ }
270363
269980
  function isRuntimeStartExternalToolsGroup(value) {
270364
269981
  if (!isRecord13(value))
270365
269982
  return false;
270366
- return (value.scope_id === undefined || typeof value.scope_id === "string") && Array.isArray(value.tools) && value.tools.every(isExternalToolDefinitionPayload);
269983
+ return Array.isArray(value.tools) && value.tools.every(isExternalToolDefinitionPayload);
269984
+ }
269985
+ function isRuntimeToolPolicy(value) {
269986
+ if (!isRecord13(value))
269987
+ return false;
269988
+ const toolset = value.toolset;
269989
+ return (toolset === undefined || isRecord13(toolset) && (toolset.base === undefined || isToolsetPreference(toolset.base)) && (toolset.include === undefined || isStringList(toolset.include))) && (value.allowlist === undefined || isStringList(value.allowlist)) && (value.exclude_interactive === undefined || typeof value.exclude_interactive === "boolean");
270367
269990
  }
270368
269991
  function isRuntimeExternalToolsUpdateCommand(value) {
270369
269992
  if (!isRecord13(value))
@@ -270373,7 +269996,7 @@ function isRuntimeExternalToolsUpdateCommand(value) {
270373
269996
  }
270374
269997
  const runtimeKeys = new Set;
270375
269998
  for (const update3 of value.updates) {
270376
- if (!isRecord13(update3) || !Array.isArray(update3.runtimes) || update3.runtimes.length === 0 || !update3.runtimes.every(isRuntimeScope2) || !Array.isArray(update3.external_tools) || !update3.external_tools.every(isRuntimeStartExternalToolsGroup)) {
269999
+ if (!isRecord13(update3) || !Array.isArray(update3.runtimes) || update3.runtimes.length === 0 || !update3.runtimes.every(isRuntimeScope2) || !Array.isArray(update3.external_tools) || !update3.external_tools.every(isRuntimeStartExternalToolsGroup) || update3.tool_policy !== undefined && !isRuntimeToolPolicy(update3.tool_policy)) {
270377
270000
  return false;
270378
270001
  }
270379
270002
  for (const runtime of update3.runtimes) {
@@ -270401,6 +270024,9 @@ function isExternalToolCallResponseCommand(value) {
270401
270024
  return false;
270402
270025
  return Array.isArray(value.result.content) && value.result.content.every(isRecord13) && (value.result.is_error === undefined || typeof value.result.is_error === "boolean");
270403
270026
  }
270027
+ var init_external_tool_protocol = __esm(() => {
270028
+ init_toolset_catalog();
270029
+ });
270404
270030
 
270405
270031
  // src/websocket/listener/runtime-start-validation.ts
270406
270032
  function isDevicePermissionMode(value) {
@@ -270410,7 +270036,7 @@ function isRuntimeStartCommand(value) {
270410
270036
  if (!value || typeof value !== "object")
270411
270037
  return false;
270412
270038
  const c = value;
270413
- return c.type === "runtime_start" && typeof c.request_id === "string" && (c.agent_id === undefined || typeof c.agent_id === "string") && (c.create_agent === undefined || isRuntimeStartCreateAgentOptions(c.create_agent)) && (c.conversation_id === undefined || typeof c.conversation_id === "string") && (c.create_conversation === undefined || isRuntimeStartCreateConversationOptions(c.create_conversation)) && (c.conversation_source_tags === undefined || isStringArray8(c.conversation_source_tags)) && (c.cwd === undefined || c.cwd === null || typeof c.cwd === "string") && (c.mode === undefined || isDevicePermissionMode(c.mode)) && (c.mode_is_default === undefined || typeof c.mode_is_default === "boolean") && (c.execution_settings === undefined || isRuntimeExecutionSettings(c.execution_settings)) && (c.workspace_sandbox === undefined || isRuntimeStartWorkspaceSandbox(c.workspace_sandbox)) && (c.skill_sources === undefined || isSkillSourceArray(c.skill_sources)) && (c.preserve_skill_sources === undefined || typeof c.preserve_skill_sources === "boolean") && (c.bundled_skills === undefined || isStringArray8(c.bundled_skills)) && (c.client_info === undefined || isRuntimeStartClientInfo(c.client_info)) && (c.recover_approvals === undefined || typeof c.recover_approvals === "boolean") && (c.force_device_status === undefined || typeof c.force_device_status === "boolean") && (c.wait_for_replay === undefined || typeof c.wait_for_replay === "boolean") && (c.teleport_id === undefined || typeof c.teleport_id === "string") && (c.external_tools === undefined || Array.isArray(c.external_tools) && c.external_tools.every(isRuntimeStartExternalToolsGroup));
270039
+ return c.type === "runtime_start" && typeof c.request_id === "string" && (c.agent_id === undefined || typeof c.agent_id === "string") && (c.create_agent === undefined || isRuntimeStartCreateAgentOptions(c.create_agent)) && (c.conversation_id === undefined || typeof c.conversation_id === "string") && (c.create_conversation === undefined || isRuntimeStartCreateConversationOptions(c.create_conversation)) && (c.conversation_source_tags === undefined || isStringArray8(c.conversation_source_tags)) && (c.cwd === undefined || c.cwd === null || typeof c.cwd === "string") && (c.mode === undefined || isDevicePermissionMode(c.mode)) && (c.mode_is_default === undefined || typeof c.mode_is_default === "boolean") && (c.execution_settings === undefined || isRuntimeExecutionSettings(c.execution_settings)) && (c.workspace_sandbox === undefined || isRuntimeStartWorkspaceSandbox(c.workspace_sandbox)) && (c.skill_sources === undefined || isSkillSourceArray(c.skill_sources)) && (c.preserve_skill_sources === undefined || typeof c.preserve_skill_sources === "boolean") && (c.bundled_skills === undefined || isStringArray8(c.bundled_skills)) && (c.client_info === undefined || isRuntimeStartClientInfo(c.client_info)) && (c.recover_approvals === undefined || typeof c.recover_approvals === "boolean") && (c.force_device_status === undefined || typeof c.force_device_status === "boolean") && (c.wait_for_replay === undefined || typeof c.wait_for_replay === "boolean") && (c.teleport_id === undefined || typeof c.teleport_id === "string") && (c.external_tools === undefined || Array.isArray(c.external_tools) && c.external_tools.every(isRuntimeStartExternalToolsGroup)) && (c.tool_policy === undefined || isRuntimeToolPolicy(c.tool_policy));
270414
270040
  }
270415
270041
  function isRuntimeStartCreateAgentOptions(value) {
270416
270042
  if (!isObjectRecord(value))
@@ -270435,6 +270061,7 @@ function isRuntimeStartWorkspaceSandbox(value) {
270435
270061
  var init_runtime_start_validation = __esm(() => {
270436
270062
  init_skill_sources();
270437
270063
  init_runtime_execution_settings();
270064
+ init_external_tool_protocol();
270438
270065
  });
270439
270066
 
270440
270067
  // src/websocket/listener/turn-finished-protocol-inbound.ts
@@ -270633,8 +270260,7 @@ function legacyEnvironmentMessageToInputCommand(value) {
270633
270260
  kind: "create_message",
270634
270261
  messages: candidate.messages,
270635
270262
  client_tool_allowlist: isStringArray8(candidate.clientToolAllowlist) ? candidate.clientToolAllowlist : undefined,
270636
- client_toolset: isClientToolsetConfig(candidate.clientToolset) ? candidate.clientToolset : undefined,
270637
- external_tool_scope_ids: isStringArray8(candidate.externalToolScopeIds) ? candidate.externalToolScopeIds : undefined
270263
+ client_toolset: isClientToolsetConfig(candidate.clientToolset) ? candidate.clientToolset : undefined
270638
270264
  }
270639
270265
  };
270640
270266
  }
@@ -271284,6 +270910,7 @@ var init_protocol_inbound = __esm(async () => {
271284
270910
  init_queue_pause_protocol_inbound();
271285
270911
  init_connect_provider_protocol_inbound();
271286
270912
  init_connect_provider_protocol_inbound();
270913
+ init_external_tool_protocol();
271287
270914
  init_runtime_start_validation();
271288
270915
  init_turn_finished_protocol_inbound();
271289
270916
  init_subagent_protocol_inbound();
@@ -273112,6 +272739,40 @@ var init_remote_model_catalog = __esm(() => {
273112
272739
  REFRESH_TTL_MS = 5 * 60 * 1000;
273113
272740
  });
273114
272741
 
272742
+ // src/tools/tool-policy.ts
272743
+ function intersectToolAllowlists(ceiling, narrower) {
272744
+ return narrower.filter((name) => ceiling.some((allowed) => getInternalToolName(allowed) === getInternalToolName(name)));
272745
+ }
272746
+ function resolveTurnToolSelection(turn, policy) {
272747
+ const base2 = turn.clientToolset?.base ?? policy?.toolset?.base;
272748
+ const include = turn.clientToolset?.include ?? policy?.toolset?.include;
272749
+ const clientToolset = base2 === undefined && include === undefined ? undefined : {
272750
+ ...base2 !== undefined ? { base: base2 } : {},
272751
+ ...include !== undefined ? { include: [...include] } : {}
272752
+ };
272753
+ const policyAllowlist = policy?.allowlist;
272754
+ const clientToolAllowlist = policyAllowlist === undefined ? turn.clientToolAllowlist : turn.clientToolAllowlist === undefined ? [...policyAllowlist] : intersectToolAllowlists(policyAllowlist, turn.clientToolAllowlist);
272755
+ const excludeInteractiveTools = turn.excludeInteractiveTools ?? policy?.exclude_interactive;
272756
+ return {
272757
+ ...clientToolset ? { clientToolset } : {},
272758
+ ...clientToolAllowlist !== undefined ? { clientToolAllowlist } : {},
272759
+ ...excludeInteractiveTools !== undefined ? { excludeInteractiveTools } : {}
272760
+ };
272761
+ }
272762
+ function mergeClientToolsetFields(primary, fallback) {
272763
+ const base2 = primary?.base ?? fallback?.base;
272764
+ const include = primary?.include ?? fallback?.include;
272765
+ if (base2 === undefined && include === undefined)
272766
+ return;
272767
+ return {
272768
+ ...base2 !== undefined ? { base: base2 } : {},
272769
+ ...include !== undefined ? { include } : {}
272770
+ };
272771
+ }
272772
+ var init_tool_policy = __esm(() => {
272773
+ init_tool_name_mapping();
272774
+ });
272775
+
273115
272776
  // src/tools/toolset.ts
273116
272777
  var exports_toolset = {};
273117
272778
  __export(exports_toolset, {
@@ -273207,7 +272868,7 @@ async function prepareToolExecutionContextForResolvedTarget(params) {
273207
272868
  clientToolset,
273208
272869
  exclude: exclude3,
273209
272870
  clientToolAllowlist: inputToolAllowlist,
273210
- externalToolScopeIds,
272871
+ externalToolOwnerConnectionId,
273211
272872
  workingDirectory,
273212
272873
  permissionModeState,
273213
272874
  modContext,
@@ -273239,7 +272900,7 @@ async function prepareToolExecutionContextForResolvedTarget(params) {
273239
272900
  exclude: exclude3,
273240
272901
  include: includedToolNames,
273241
272902
  clientToolAllowlist,
273242
- externalToolScopeIds,
272903
+ externalToolOwnerConnectionId,
273243
272904
  workingDirectory,
273244
272905
  permissionModeState,
273245
272906
  modContext: scopedModContext,
@@ -273272,7 +272933,7 @@ async function prepareToolExecutionContextForScope(params) {
273272
272933
  exclude: exclude3,
273273
272934
  clientToolset: requestClientToolset,
273274
272935
  clientToolAllowlist,
273275
- externalToolScopeIds,
272936
+ externalToolOwnerConnectionId,
273276
272937
  workingDirectory,
273277
272938
  permissionModeState,
273278
272939
  skillsDirectory,
@@ -273285,7 +272946,7 @@ async function prepareToolExecutionContextForScope(params) {
273285
272946
  modEvents,
273286
272947
  modAdapters
273287
272948
  } = params;
273288
- const clientToolset = requestClientToolset ?? getStoredClientPreferences(agentId, conversationId).toolset;
272949
+ const clientToolset = mergeClientToolsetFields(requestClientToolset, getStoredClientPreferences(agentId, conversationId).toolset);
273289
272950
  const backend3 = getBackend();
273290
272951
  const agent = agentId ? cachedAgent ?? await backend3.retrieveAgent(agentId) : null;
273291
272952
  const agentTarget = modelTargetFromCarrier(agent);
@@ -273319,7 +272980,7 @@ async function prepareToolExecutionContextForScope(params) {
273319
272980
  clientToolset,
273320
272981
  exclude: exclude3,
273321
272982
  clientToolAllowlist,
273322
- externalToolScopeIds,
272983
+ externalToolOwnerConnectionId,
273323
272984
  workingDirectory,
273324
272985
  permissionModeState,
273325
272986
  modContext,
@@ -273387,6 +273048,7 @@ var init_toolset = __esm(async () => {
273387
273048
  init_context2();
273388
273049
  init_settings_manager();
273389
273050
  init_removed_tools();
273051
+ init_tool_policy();
273390
273052
  await __promiseAll([
273391
273053
  init_client_preferences(),
273392
273054
  init_manager2(),
@@ -445590,6 +445252,14 @@ function getRegisteredTools(runtime) {
445590
445252
  }
445591
445253
  return registeredTools;
445592
445254
  }
445255
+ function getLastSubmittingConnections(runtime) {
445256
+ let connections = lastSubmittingConnectionByRuntime.get(runtime);
445257
+ if (!connections) {
445258
+ connections = new Map;
445259
+ lastSubmittingConnectionByRuntime.set(runtime, connections);
445260
+ }
445261
+ return connections;
445262
+ }
445593
445263
  function getConnectionIdsByRegistrationKey(runtime) {
445594
445264
  let controllers = connectionIdByRegistrationKey.get(runtime);
445595
445265
  if (!controllers) {
@@ -445601,13 +445271,12 @@ function getConnectionIdsByRegistrationKey(runtime) {
445601
445271
  function getRuntimeKey(runtime) {
445602
445272
  return `${runtime.agent_id}:${runtime.conversation_id}`;
445603
445273
  }
445604
- function getToolRegistrationKey(connectionId, runtime, scopeId, toolName2) {
445274
+ function getToolRegistrationKey(connectionId, runtime, toolName2) {
445605
445275
  return JSON.stringify([
445606
445276
  "runtime",
445607
445277
  connectionId,
445608
445278
  runtime.agent_id,
445609
445279
  runtime.conversation_id,
445610
- scopeId ?? null,
445611
445280
  toolName2
445612
445281
  ]);
445613
445282
  }
@@ -445634,7 +445303,7 @@ function captureExternalToolNotificationGuard(listener, runtimeScope) {
445634
445303
  }
445635
445304
  };
445636
445305
  }
445637
- function toExternalToolDefinition(listener, tool, connectionId, runtimeScope, scopeId) {
445306
+ function toExternalToolDefinition(listener, tool, connectionId, runtimeScope) {
445638
445307
  const toolDefinition = {
445639
445308
  name: tool.name,
445640
445309
  connectionId,
@@ -445643,8 +445312,7 @@ function toExternalToolDefinition(listener, tool, connectionId, runtimeScope, sc
445643
445312
  parameters: tool.parameters,
445644
445313
  ...tool.timeout_ms !== undefined ? { timeoutMs: tool.timeout_ms } : {},
445645
445314
  autoBackground: tool.auto_background ?? true,
445646
- registrationKey: getToolRegistrationKey(connectionId, runtimeScope, scopeId, tool.name),
445647
- ...scopeId !== undefined ? { scopeId } : {},
445315
+ registrationKey: getToolRegistrationKey(connectionId, runtimeScope, tool.name),
445648
445316
  runtime: {
445649
445317
  agentId: runtimeScope.agent_id ?? undefined,
445650
445318
  conversationId: runtimeScope.conversation_id
@@ -445677,7 +445345,6 @@ function installExternalToolBridge(runtime) {
445677
445345
  type: "external_tool_call_request",
445678
445346
  request_id: requestId,
445679
445347
  ...requestRuntime ? { runtime: requestRuntime } : {},
445680
- ...context3?.tool.scopeId !== undefined ? { scope_id: context3.tool.scopeId } : {},
445681
445348
  tool_call_id: toolCallId,
445682
445349
  tool_name: toolName2,
445683
445350
  input
@@ -445714,35 +445381,74 @@ function installExternalToolBridge(runtime) {
445714
445381
  return result3;
445715
445382
  });
445716
445383
  }
445717
- function registerRuntimeExternalTools(runtime, connectionId, runtimeScope, groups) {
445384
+ function registerRuntimeExternalTools(runtime, connectionId, runtimeScope, groups, toolPolicy) {
445718
445385
  const resolvedGroups = groups ?? [];
445386
+ if (resolvedGroups.some((group) => Object.hasOwn(group, "scope_id"))) {
445387
+ debugLog("Listen", "Ignoring deprecated external tool scope_id");
445388
+ }
445719
445389
  const registeredTools = getRegisteredTools(runtime);
445720
- const runtimeKey = createConnectionRequestKey(connectionId, getRuntimeKey(runtimeScope));
445721
- const previousTools = registeredTools.get(runtimeKey) ?? [];
445390
+ const runtimeKey = getRuntimeKey(runtimeScope);
445391
+ const registrationScope = createConnectionRequestKey(connectionId, runtimeKey);
445392
+ const previousTools = registeredTools.get(registrationScope)?.tools ?? [];
445722
445393
  unregisterExternalTools(previousTools);
445723
- const tools = resolvedGroups.flatMap((group) => group.tools.map((tool) => toExternalToolDefinition(runtime, tool, connectionId, runtimeScope, group.scope_id)));
445394
+ const tools = resolvedGroups.flatMap((group) => group.tools.map((tool) => toExternalToolDefinition(runtime, tool, connectionId, runtimeScope)));
445724
445395
  const controllers = getConnectionIdsByRegistrationKey(runtime);
445725
445396
  for (const tool of previousTools) {
445726
445397
  if (tool.registrationKey) {
445727
445398
  controllers.delete(tool.registrationKey);
445728
445399
  }
445729
445400
  }
445730
- if (tools.length > 0) {
445731
- registerExternalTools(tools);
445732
- for (const tool of tools) {
445733
- if (tool.registrationKey) {
445734
- controllers.set(tool.registrationKey, connectionId);
445401
+ registerExternalTools(tools);
445402
+ for (const tool of tools) {
445403
+ if (tool.registrationKey) {
445404
+ controllers.set(tool.registrationKey, connectionId);
445405
+ }
445406
+ }
445407
+ registeredTools.delete(registrationScope);
445408
+ if (tools.length > 0 || toolPolicy !== undefined) {
445409
+ registeredTools.set(registrationScope, {
445410
+ connectionId,
445411
+ runtimeKey,
445412
+ tools,
445413
+ ...toolPolicy !== undefined ? { toolPolicy } : {},
445414
+ sequence: ++nextRegistrationSequence
445415
+ });
445416
+ }
445417
+ }
445418
+ function recordRuntimeSubmittingConnection(runtime, runtimeScope, connectionId) {
445419
+ getLastSubmittingConnections(runtime).set(getRuntimeKey(runtimeScope), connectionId);
445420
+ }
445421
+ function resolveRuntimeToolOwner(runtime, runtimeScope, submittingConnectionId) {
445422
+ const registeredTools = registeredToolsByRuntime.get(runtime);
445423
+ const runtimeKey = getRuntimeKey(runtimeScope);
445424
+ const registrationFor = (connectionId) => registeredTools?.get(createConnectionRequestKey(connectionId, runtimeKey));
445425
+ if (submittingConnectionId !== undefined) {
445426
+ const toolPolicy = registrationFor(submittingConnectionId)?.toolPolicy;
445427
+ return {
445428
+ connectionId: submittingConnectionId,
445429
+ ...toolPolicy ? { toolPolicy } : {}
445430
+ };
445431
+ }
445432
+ const lastSubmitter = lastSubmittingConnectionByRuntime.get(runtime)?.get(runtimeKey);
445433
+ let owner = lastSubmitter !== undefined ? registrationFor(lastSubmitter) : undefined;
445434
+ if (!owner) {
445435
+ for (const registration of registeredTools?.values() ?? []) {
445436
+ if (registration.runtimeKey === runtimeKey && (!owner || registration.sequence > owner.sequence)) {
445437
+ owner = registration;
445735
445438
  }
445736
445439
  }
445737
- registeredTools.set(runtimeKey, tools);
445738
- } else {
445739
- registeredTools.delete(runtimeKey);
445740
445440
  }
445441
+ if (!owner)
445442
+ return {};
445443
+ return {
445444
+ connectionId: owner.connectionId,
445445
+ ...owner.toolPolicy ? { toolPolicy: owner.toolPolicy } : {}
445446
+ };
445741
445447
  }
445742
445448
  function updateRuntimeExternalTools(runtime, connectionId, updates) {
445743
445449
  for (const update3 of updates) {
445744
445450
  for (const runtimeScope of update3.runtimes) {
445745
- registerRuntimeExternalTools(runtime, connectionId, runtimeScope, update3.external_tools);
445451
+ registerRuntimeExternalTools(runtime, connectionId, runtimeScope, update3.external_tools, update3.tool_policy);
445746
445452
  }
445747
445453
  }
445748
445454
  }
@@ -445794,19 +445500,23 @@ function rejectPendingExternalToolCallsForConnection(runtime, connectionId, reas
445794
445500
  pendingExternalToolCalls.delete(requestKey);
445795
445501
  pending2.reject(new Error(reason));
445796
445502
  }
445503
+ const lastSubmitters = lastSubmittingConnectionByRuntime.get(runtime);
445504
+ for (const [runtimeKey, submitter] of lastSubmitters ?? []) {
445505
+ if (submitter === connectionId)
445506
+ lastSubmitters?.delete(runtimeKey);
445507
+ }
445797
445508
  const registeredTools = registeredToolsByRuntime.get(runtime);
445798
445509
  if (!registeredTools) {
445799
445510
  return;
445800
445511
  }
445801
445512
  const controllers = getConnectionIdsByRegistrationKey(runtime);
445802
- for (const [registrationScope, tools] of registeredTools) {
445803
- const ownedByConnection = tools.some((tool) => tool.registrationKey !== undefined && controllers.get(tool.registrationKey) === connectionId);
445804
- if (!ownedByConnection) {
445513
+ for (const [registrationScope, registration] of registeredTools) {
445514
+ if (registration.connectionId !== connectionId) {
445805
445515
  continue;
445806
445516
  }
445807
- unregisterExternalTools(tools);
445517
+ unregisterExternalTools(registration.tools);
445808
445518
  registeredTools.delete(registrationScope);
445809
- for (const tool of tools) {
445519
+ for (const tool of registration.tools) {
445810
445520
  if (tool.registrationKey) {
445811
445521
  controllers.delete(tool.registrationKey);
445812
445522
  }
@@ -445822,16 +445532,18 @@ function rejectPendingExternalToolCalls(runtime, reason) {
445822
445532
  }
445823
445533
  const registeredTools = registeredToolsByRuntime.get(runtime);
445824
445534
  if (registeredTools) {
445825
- for (const tools of registeredTools.values()) {
445826
- unregisterExternalTools(tools);
445535
+ for (const registration of registeredTools.values()) {
445536
+ unregisterExternalTools(registration.tools);
445827
445537
  }
445828
445538
  registeredToolsByRuntime.delete(runtime);
445829
445539
  }
445830
445540
  connectionIdByRegistrationKey.delete(runtime);
445541
+ lastSubmittingConnectionByRuntime.delete(runtime);
445831
445542
  }
445832
- var EXTERNAL_TOOL_CALL_TIMEOUT_MS, registeredToolsByRuntime, connectionIdByRegistrationKey;
445543
+ var EXTERNAL_TOOL_CALL_TIMEOUT_MS, registeredToolsByRuntime, lastSubmittingConnectionByRuntime, nextRegistrationSequence = 0, connectionIdByRegistrationKey;
445833
445544
  var init_external_tools = __esm(async () => {
445834
445545
  init_external_tool_background_eligibility();
445546
+ init_debug();
445835
445547
  init_transport2();
445836
445548
  await __promiseAll([
445837
445549
  init_manager2(),
@@ -445840,6 +445552,7 @@ var init_external_tools = __esm(async () => {
445840
445552
  ]);
445841
445553
  EXTERNAL_TOOL_CALL_TIMEOUT_MS = 5 * 60 * 1000;
445842
445554
  registeredToolsByRuntime = new WeakMap;
445555
+ lastSubmittingConnectionByRuntime = new WeakMap;
445843
445556
  connectionIdByRegistrationKey = new WeakMap;
445844
445557
  });
445845
445558
 
@@ -447202,7 +446915,7 @@ async function handleRuntimeStartCommand(parsed, context3) {
447202
446915
  }
447203
446916
  assertConnectionOpen();
447204
446917
  subscribeListenerConnection(context3.runtime, connectionId, runtimeScope);
447205
- registerRuntimeExternalTools(context3.runtime, connectionId, runtimeScope, parsed.external_tools ?? []);
446918
+ registerRuntimeExternalTools(context3.runtime, connectionId, runtimeScope, parsed.external_tools ?? [], parsed.tool_policy);
447206
446919
  if (parsed.wait_for_replay) {
447207
446920
  await context3.replaySyncStateForRuntime(context3.runtime, context3.socket, runtimeScope, {
447208
446921
  recoverApprovals: parsed.recover_approvals !== false,
@@ -457391,7 +457104,7 @@ function buildConversationDescriptionMessages(messages) {
457391
457104
  }
457392
457105
  return descriptionMessages;
457393
457106
  }
457394
- async function generateConversationDescriptionFromSummary(conversationId, messages, model = DEFAULT_SUMMARIZATION_MODEL) {
457107
+ async function generateConversationDescriptionFromSummary(conversationId, messages, model = DEFAULT_TITLE_SUMMARIZATION_MODEL) {
457395
457108
  if (messages.length === 0) {
457396
457109
  return null;
457397
457110
  }
@@ -457432,7 +457145,7 @@ async function regenerateConversationDescription(conversationId) {
457432
457145
  include_return_message_types: ["user_message", "assistant_message"]
457433
457146
  });
457434
457147
  const messages = buildConversationDescriptionMessages(paginatedItems3(page).reverse());
457435
- const description = await generateConversationDescriptionFromSummary(conversationId, messages, DEFAULT_SUMMARIZATION_MODEL);
457148
+ const description = await generateConversationDescriptionFromSummary(conversationId, messages, DEFAULT_TITLE_SUMMARIZATION_MODEL);
457436
457149
  if (!description) {
457437
457150
  return false;
457438
457151
  }
@@ -463497,6 +463210,19 @@ async function prepareListenerTurn(params) {
463497
463210
  const environmentDeviceId = listenerOptions?.deviceId;
463498
463211
  if (msg.clientPreferences !== undefined)
463499
463212
  replaceClientPreferences(agentId, conversationId, msg.clientPreferences);
463213
+ const toolRuntimeScope = {
463214
+ agent_id: agentId,
463215
+ conversation_id: conversationId
463216
+ };
463217
+ if (connectionId) {
463218
+ recordRuntimeSubmittingConnection(runtime.listener, toolRuntimeScope, connectionId);
463219
+ }
463220
+ const toolOwner = resolveRuntimeToolOwner(runtime.listener, toolRuntimeScope, connectionId);
463221
+ const toolSelection = resolveTurnToolSelection({
463222
+ clientToolset: msg.clientToolset,
463223
+ clientToolAllowlist: msg.clientToolAllowlist,
463224
+ excludeInteractiveTools: msg.excludeInteractiveTools
463225
+ }, toolOwner.toolPolicy);
463500
463226
  const preparedToolContext = await prepareToolExecutionContextForScope({
463501
463227
  connectionId: executionConnectionId,
463502
463228
  environmentDeviceId,
@@ -463506,10 +463232,10 @@ async function prepareListenerTurn(params) {
463506
463232
  suppressActingUserFallback: msg.suppressActingUserFallback,
463507
463233
  mcpOriginatorSuperRunId: getEffectiveMcpOriginatorId(msg),
463508
463234
  resolveClientMessageIds,
463509
- clientToolset: msg.clientToolset,
463510
- clientToolAllowlist: msg.clientToolAllowlist,
463511
- ...msg.excludeInteractiveTools ? { exclude: [...INTERACTIVE_USER_INPUT_TOOL_NAMES] } : {},
463512
- externalToolScopeIds: msg.externalToolScopeIds,
463235
+ externalToolOwnerConnectionId: toolOwner.connectionId,
463236
+ clientToolset: toolSelection.clientToolset,
463237
+ clientToolAllowlist: toolSelection.clientToolAllowlist,
463238
+ ...toolSelection.excludeInteractiveTools ? { exclude: [...INTERACTIVE_USER_INPUT_TOOL_NAMES] } : {},
463513
463239
  workingDirectory,
463514
463240
  permissionModeState,
463515
463241
  skillsDirectory: listenerOptions?.skillsDirectory,
@@ -463584,6 +463310,7 @@ var init_turn_setup = __esm(async () => {
463584
463310
  init_runtime_context();
463585
463311
  init_error_reporting();
463586
463312
  init_interactive_policy();
463313
+ init_tool_policy();
463587
463314
  init_debug();
463588
463315
  init_shell_context();
463589
463316
  init_channel_runtime_tools();
@@ -463593,6 +463320,7 @@ var init_turn_setup = __esm(async () => {
463593
463320
  init_client_preferences(),
463594
463321
  init_toolset(),
463595
463322
  init_connection(),
463323
+ init_external_tools(),
463596
463324
  init_image_policy(),
463597
463325
  init_interrupts(),
463598
463326
  init_mod_adapter2(),
@@ -466958,7 +466686,7 @@ async function handleCompactCommand(socket, conversationRuntime, args) {
466958
466686
  compactParams = {
466959
466687
  compaction_settings: {
466960
466688
  mode: modeArg,
466961
- model: agent.compaction_settings?.model?.trim() || DEFAULT_SUMMARIZATION_MODEL
466689
+ model: agent.compaction_settings?.model?.trim() || agent.model || undefined
466962
466690
  }
466963
466691
  };
466964
466692
  }
@@ -467116,7 +466844,6 @@ var init_commands2 = __esm(async () => {
467116
466844
  init_reflect_command();
467117
466845
  init_reflection_launcher();
467118
466846
  init_command_runtime();
467119
- init_constants2();
467120
466847
  init_hooks();
467121
466848
  init_settings_manager();
467122
466849
  init_error_reporting();
@@ -467161,6 +466888,7 @@ function buildAppServerInfoResponse(command, options) {
467161
466888
  subagent_message: true,
467162
466889
  runtime_workspace_sandbox: true,
467163
466890
  runtime_external_tools_update: true,
466891
+ runtime_tool_policy: true,
467164
466892
  structured_outputs: options.backend === "api",
467165
466893
  write_file_base64: true,
467166
466894
  split_channels: false
@@ -468307,6 +468035,9 @@ var init_input_disposition_ownership = __esm(async () => {
468307
468035
  function createIncomingMessage(scope, payload, connectionId, frame) {
468308
468036
  const mcpOriginator = readMcpOriginatorDelivery(frame);
468309
468037
  const terminalConsumerId = frame?.terminal_consumer_id ?? undefined;
468038
+ if (Object.hasOwn(payload, "external_tool_scope_ids")) {
468039
+ debugLog("Listen", "Ignoring deprecated external_tool_scope_ids");
468040
+ }
468310
468041
  return {
468311
468042
  type: "message",
468312
468043
  connectionId,
@@ -468315,7 +468046,6 @@ function createIncomingMessage(scope, payload, connectionId, frame) {
468315
468046
  clientToolAllowlist: payload.client_tool_allowlist,
468316
468047
  clientToolset: payload.client_toolset,
468317
468048
  clientPreferences: payload.client_preferences,
468318
- externalToolScopeIds: payload.external_tool_scope_ids,
468319
468049
  excludeInteractiveTools: payload.exclude_interactive_tools,
468320
468050
  responseFormat: payload.response_format,
468321
468051
  imageFailureMode: payload.image_failure_mode,
@@ -468594,7 +468324,6 @@ function summarizeInputPayload(payload) {
468594
468324
  pushField(fields, "client_toolset.base", payload.client_toolset.base);
468595
468325
  pushField(fields, "client_toolset.include", payload.client_toolset.include);
468596
468326
  }
468597
- pushField(fields, "external_tool_scope_ids", payload.external_tool_scope_ids);
468598
468327
  pushField(fields, "exclude_interactive_tools", payload.exclude_interactive_tools);
468599
468328
  } else if (payload.kind === "approval_response") {
468600
468329
  pushField(fields, "request_id", payload.request_id);
@@ -493621,10 +493350,10 @@ async function reconcileExistingAgentState(client, agent) {
493621
493350
  const appliedTweaks = [];
493622
493351
  const skippedTweaks = [];
493623
493352
  const configuredCompactionModel = typeof agent.compaction_settings?.model === "string" ? agent.compaction_settings.model.trim() : "";
493624
- if (!configuredCompactionModel) {
493353
+ if (!configuredCompactionModel && agent.model) {
493625
493354
  patch2.compaction_settings = {
493626
493355
  ...agent.compaction_settings ?? {},
493627
- model: DEFAULT_SUMMARIZATION_MODEL
493356
+ model: agent.model
493628
493357
  };
493629
493358
  appliedTweaks.push("set_compaction_model");
493630
493359
  }
@@ -493659,7 +493388,6 @@ async function reconcileExistingAgentState(client, agent) {
493659
493388
  }
493660
493389
  var DEFAULT_ATTACHED_BASE_TOOLS;
493661
493390
  var init_reconcile_existing_agent_state = __esm(() => {
493662
- init_constants2();
493663
493391
  DEFAULT_ATTACHED_BASE_TOOLS = [
493664
493392
  "web_search",
493665
493393
  "fetch_webpage"
@@ -494926,14 +494654,14 @@ function sampleReflectionArenaComparisonModel(excludedModels = []) {
494926
494654
  const candidates2 = REFLECTION_ARENA_COMPARISON_MODEL_POOL.filter((entry) => !excluded.has(entry.model));
494927
494655
  const totalWeight = candidates2.reduce((sum2, entry) => sum2 + Math.max(0, entry.weight), 0);
494928
494656
  if (totalWeight <= 0)
494929
- return "letta/auto";
494657
+ return REFLECTION_ARENA_COMPARISON_FALLBACK_MODEL;
494930
494658
  let offset = randomInt2(totalWeight);
494931
494659
  for (const candidate of candidates2) {
494932
494660
  offset -= Math.max(0, candidate.weight);
494933
494661
  if (offset < 0)
494934
494662
  return candidate.model;
494935
494663
  }
494936
- return candidates2[0]?.model ?? "letta/auto";
494664
+ return candidates2[0]?.model ?? REFLECTION_ARENA_COMPARISON_FALLBACK_MODEL;
494937
494665
  }
494938
494666
  async function getGitOutput(cwd2, args) {
494939
494667
  try {
@@ -495493,7 +495221,7 @@ async function finalizeReflectionArenaChoice(options) {
495493
495221
  run: completedRun
495494
495222
  };
495495
495223
  }
495496
- var execFile23, REFLECTION_ARENA_TELEMETRY_TRANSCRIPT_MAX_CHARS = 1e6, REFLECTION_ARENA_MODEL_A_DEFAULT = "letta/auto-memory", REFLECTION_ARENA_COMPARISON_MODEL_POOL, ANSI_BOLD = "\x1B[1m", ANSI_CYAN = "\x1B[36m", ANSI_MAGENTA = "\x1B[35m", ANSI_RESET_BOLD = "\x1B[22m", ANSI_RESET_FOREGROUND = "\x1B[39m", REFLECTION_ARENA_CANDIDATE_COUNT = 2, REFLECTION_ARENA_CHOICE_QUESTION = "Which reflection should be merged?", REFLECTION_ARENA_NOTES_QUESTION = "Optional feedback for this choice?", updateLocks;
495224
+ var execFile23, REFLECTION_ARENA_TELEMETRY_TRANSCRIPT_MAX_CHARS = 1e6, REFLECTION_ARENA_MODEL_A_DEFAULT = "letta/auto-memory", REFLECTION_ARENA_COMPARISON_FALLBACK_MODEL = "lc-anthropic/claude-sonnet-5", REFLECTION_ARENA_COMPARISON_MODEL_POOL, ANSI_BOLD = "\x1B[1m", ANSI_CYAN = "\x1B[36m", ANSI_MAGENTA = "\x1B[35m", ANSI_RESET_BOLD = "\x1B[22m", ANSI_RESET_FOREGROUND = "\x1B[39m", REFLECTION_ARENA_CANDIDATE_COUNT = 2, REFLECTION_ARENA_CHOICE_QUESTION = "Which reflection should be merged?", REFLECTION_ARENA_NOTES_QUESTION = "Optional feedback for this choice?", updateLocks;
495497
495225
  var init_reflection_arena = __esm(() => {
495498
495226
  init_memory_worktree();
495499
495227
  init_app_urls();
@@ -495509,7 +495237,6 @@ var init_reflection_arena = __esm(() => {
495509
495237
  { model: "lc-anthropic/claude-sonnet-5", weight: 1 },
495510
495238
  { model: "lc-anthropic/claude-opus-4-8", weight: 3 },
495511
495239
  { model: "lc-anthropic/claude-fable-5", weight: 1 },
495512
- { model: "letta/auto", weight: 1 },
495513
495240
  { model: "deepseek/deepseek-v4-pro", weight: 1 },
495514
495241
  { model: "minimax-m3", weight: 1 },
495515
495242
  { model: "gpt-5.5-plus-pro-high", weight: 3 }
@@ -524136,7 +523863,7 @@ var init_AppView = __esm(async () => {
524136
523863
  });
524137
523864
 
524138
523865
  // src/cli/app/constants.ts
524139
- var CLEAR_SCREEN_AND_HOME = "\x1B[2J\x1B[H", MIN_RESIZE_DELTA = 2, RESIZE_SETTLE_MS = 250, MIN_CLEAR_INTERVAL_MS = 750, STABLE_WIDTH_SETTLE_MS = 180, TOOL_CALL_COMMIT_DEFER_MS = 50, ANIMATION_RESUME_HYSTERESIS_ROWS = 2, EAGER_CANCEL = true, LLM_API_ERROR_MAX_RETRIES3 = 3, EMPTY_RESPONSE_MAX_RETRIES3 = 2, TEMP_QUOTA_OVERRIDE_MODEL = "letta/auto", CONVERSATION_BUSY_MAX_RETRIES2 = 3, INTERRUPT_MESSAGE = "Interrupted – tell the agent what to do differently. Something went wrong? Use /feedback to report issues.", ERROR_FEEDBACK_HINT = "Something went wrong? Use /feedback to report issues.", PROVIDER_STATUS_PAGES, APPROVAL_OPTIONS_HEIGHT = 8, APPROVAL_PREVIEW_BUFFER = 4, MIN_WRAP_WIDTH = 10, TEXT_WRAP_GUTTER = 6, DIFF_WRAP_GUTTER = 12, SHELL_PREVIEW_MAX_LINES = 3;
523866
+ var CLEAR_SCREEN_AND_HOME = "\x1B[2J\x1B[H", MIN_RESIZE_DELTA = 2, RESIZE_SETTLE_MS = 250, MIN_CLEAR_INTERVAL_MS = 750, STABLE_WIDTH_SETTLE_MS = 180, TOOL_CALL_COMMIT_DEFER_MS = 50, ANIMATION_RESUME_HYSTERESIS_ROWS = 2, EAGER_CANCEL = true, LLM_API_ERROR_MAX_RETRIES3 = 3, EMPTY_RESPONSE_MAX_RETRIES3 = 2, CONVERSATION_BUSY_MAX_RETRIES2 = 3, INTERRUPT_MESSAGE = "Interrupted – tell the agent what to do differently. Something went wrong? Use /feedback to report issues.", ERROR_FEEDBACK_HINT = "Something went wrong? Use /feedback to report issues.", PROVIDER_STATUS_PAGES, APPROVAL_OPTIONS_HEIGHT = 8, APPROVAL_PREVIEW_BUFFER = 4, MIN_WRAP_WIDTH = 10, TEXT_WRAP_GUTTER = 6, DIFF_WRAP_GUTTER = 12, SHELL_PREVIEW_MAX_LINES = 3;
524140
523867
  var init_constants4 = __esm(() => {
524141
523868
  PROVIDER_STATUS_PAGES = {
524142
523869
  anthropic: {
@@ -525936,7 +525663,7 @@ ${guidance}`);
525936
525663
  const existingModel = existing?.model?.trim();
525937
525664
  const nextCompactionSettings = {
525938
525665
  ...existing,
525939
- model: existingModel || DEFAULT_SUMMARIZATION_MODEL,
525666
+ model: existingModel || agentState?.model || undefined,
525940
525667
  mode
525941
525668
  };
525942
525669
  await getBackend().updateAgent(agentId, {
@@ -525956,6 +525683,7 @@ ${guidance}`);
525956
525683
  isAgentBusy,
525957
525684
  withCommandLock,
525958
525685
  agentState?.compaction_settings,
525686
+ agentState?.model,
525959
525687
  setActiveOverlay,
525960
525688
  setAgentState,
525961
525689
  setQueuedOverlayAction
@@ -526151,7 +525879,6 @@ var init_use_configuration_handlers = __esm(async () => {
526151
525879
  init_client4();
526152
525880
  init_error_formatter();
526153
525881
  init_memory_reminder();
526154
- init_constants2();
526155
525882
  init_manager();
526156
525883
  init_openai_codex_provider();
526157
525884
  init_settings_manager();
@@ -526376,7 +526103,6 @@ function useConversationLoop(ctx) {
526376
526103
  queuedApprovalResultsRef,
526377
526104
  queueApprovalResults,
526378
526105
  queueSnapshotRef,
526379
- quotaAutoSwapAttemptedRef,
526380
526106
  refreshDerived,
526381
526107
  refreshDerivedThrottled,
526382
526108
  resetTrajectoryBases,
@@ -526404,7 +526130,6 @@ function useConversationLoop(ctx) {
526404
526130
  setRestoredInput,
526405
526131
  setStreaming,
526406
526132
  setConversationSummary,
526407
- setTempModelOverride,
526408
526133
  setThinkingMessage,
526409
526134
  setTrajectoryElapsedBaseMs,
526410
526135
  setTrajectoryTokenBase,
@@ -526579,7 +526304,6 @@ function useConversationLoop(ctx) {
526579
526304
  llmApiErrorRetriesRef.current = 0;
526580
526305
  emptyResponseRetriesRef.current = 0;
526581
526306
  conversationBusyRetriesRef.current = 0;
526582
- quotaAutoSwapAttemptedRef.current = false;
526583
526307
  chatgptPlanSwapsRef.current = 0;
526584
526308
  chatgptExhaustedProvidersRef.current.clear();
526585
526309
  }
@@ -527539,37 +527263,8 @@ ${feedback}
527539
527263
  continue;
527540
527264
  }
527541
527265
  }
527542
- const autoSwapOnQuotaLimitEnabled = settingsManager.getSetting("autoSwapOnQuotaLimit") !== false;
527543
- const supportsHostedAutoQuotaFallback = !getBackend().capabilities.localModelCatalog;
527544
- const isQuotaLimit = isQuotaLimitErrorDetail(detailFromRun ?? fallbackError);
527545
- const alreadyOnTempAuto = tempModelOverrideRef.current === TEMP_QUOTA_OVERRIDE_MODEL;
527546
- const canAttemptQuotaAutoSwap = autoSwapOnQuotaLimitEnabled && supportsHostedAutoQuotaFallback && isQuotaLimit && !alreadyOnTempAuto && !quotaAutoSwapAttemptedRef.current;
527547
- if (canAttemptQuotaAutoSwap) {
527548
- quotaAutoSwapAttemptedRef.current = true;
527549
- setTempModelOverride(TEMP_QUOTA_OVERRIDE_MODEL);
527550
- const statusId = uid("status");
527551
- buffersRef.current.byId.set(statusId, {
527552
- kind: "status",
527553
- id: statusId,
527554
- lines: [
527555
- "Quota limit reached; temporarily switching to Auto and continuing..."
527556
- ]
527557
- });
527558
- buffersRef.current.order.push(statusId);
527559
- refreshDerived();
527560
- currentInput = [
527561
- ...currentInput,
527562
- {
527563
- type: "message",
527564
- role: "user",
527565
- content: "Keep going."
527566
- }
527567
- ];
527568
- buffersRef.current.byId.delete(statusId);
527569
- buffersRef.current.order = buffersRef.current.order.filter((id2) => id2 !== statusId);
527570
- refreshDerived();
527571
- buffersRef.current.interrupted = false;
527572
- continue;
527266
+ if (!getBackend().capabilities.localModelCatalog && isQuotaLimitErrorDetail(detailFromRun ?? fallbackError)) {
527267
+ appendError(KEY_OR_CREDITS_REQUIRED_MESSAGE, true);
527573
527268
  }
527574
527269
  if (isEmptyResponseRetryable(stopReasonToHandle === "llm_api_error" ? "llm_error" : undefined, detailFromRun, emptyResponseRetriesRef.current, EMPTY_RESPONSE_MAX_RETRIES3)) {
527575
527270
  emptyResponseRetriesRef.current += 1;
@@ -530980,7 +530675,7 @@ function readOptionValue(argv, index, optionName) {
530980
530675
  }
530981
530676
  function resolveRequestedModel(requested, currentModelId) {
530982
530677
  if (requested === "current")
530983
- return currentModelId ?? DEFAULT_MODEL;
530678
+ return currentModelId ?? undefined;
530984
530679
  return requested;
530985
530680
  }
530986
530681
  function parseModsCommand(trimmed, currentModelId) {
@@ -531401,7 +531096,11 @@ async function runLearnCommand(learn, ctx, command) {
531401
531096
  const launcher = (ctx.resolveLauncher ?? resolveCurrentLettaLauncher)();
531402
531097
  const headlessEnv = await (ctx.getHeadlessEnv ?? defaultHeadlessEnv)();
531403
531098
  const learningEnv = await resolveEnv(learn, ctx.cwd, readEnvImpl);
531404
- const model = learn.options.model ?? DEFAULT_MODEL;
531099
+ const model = learn.options.model ?? ctx.currentModelId;
531100
+ if (!model) {
531101
+ command.fail("No model selected. Pass --model <handle>, or choose one with /model first.");
531102
+ return;
531103
+ }
531405
531104
  const optimizationIterations = effectiveOptimizationIterations(learn.options);
531406
531105
  let lastProgress = null;
531407
531106
  let pulseFrameIndex = 0;
@@ -531469,7 +531168,7 @@ function handleModsCommand(trimmed, ctx) {
531469
531168
  });
531470
531169
  return { handled: true, done };
531471
531170
  }
531472
- var DEFAULT_TARGET = "memory-citations", DEFAULT_MODEL = "auto", DEFAULT_OPTIMIZATION_ITERATIONS = 5, MOD_OPTIMIZATION_PULSE, MOD_OPTIMIZATION_RUNNING_LABELS, MOD_OPTIMIZATION_SPINNER_INTERVAL_MS, SPARKLINE_BLOCKS, SCORE_BAR_WIDTH = 12, MAX_SCORE_BARS = 5, MAX_STEP_DOTS = 20;
531171
+ var DEFAULT_TARGET = "memory-citations", DEFAULT_OPTIMIZATION_ITERATIONS = 5, MOD_OPTIMIZATION_PULSE, MOD_OPTIMIZATION_RUNNING_LABELS, MOD_OPTIMIZATION_SPINNER_INTERVAL_MS, SPARKLINE_BLOCKS, SCORE_BAR_WIDTH = 12, MAX_SCORE_BARS = 5, MAX_STEP_DOTS = 20;
531473
531172
  var init_mods2 = __esm(async () => {
531474
531173
  init_memory_citations_env();
531475
531174
  init_animations();
@@ -534511,7 +534210,7 @@ Tip: Use /clear instead to clear the current message buffer.`;
534511
534210
  const compactParams = modeArg ? {
534512
534211
  compaction_settings: {
534513
534212
  mode: modeArg,
534514
- model: agentStateRef.current?.compaction_settings?.model?.trim() || DEFAULT_SUMMARIZATION_MODEL
534213
+ model: agentStateRef.current?.compaction_settings?.model?.trim() || agentStateRef.current?.model || undefined
534515
534214
  }
534516
534215
  } : undefined;
534517
534216
  const compactConversationId = conversationIdRef.current;
@@ -536466,7 +536165,6 @@ function App2({
536466
536165
  const abortControllerRef = import_react124.useRef(null);
536467
536166
  const userCancelledRef = import_react124.useRef(false);
536468
536167
  const llmApiErrorRetriesRef = import_react124.useRef(0);
536469
- const quotaAutoSwapAttemptedRef = import_react124.useRef(false);
536470
536168
  const emptyResponseRetriesRef = import_react124.useRef(0);
536471
536169
  const chatgptPlanSwapsRef = import_react124.useRef(0);
536472
536170
  const chatgptExhaustedProvidersRef = import_react124.useRef(new Set);
@@ -537952,7 +537650,6 @@ Memory may be stale. Try running: git -C ${getScopedMemoryFilesystemRoot(agentId
537952
537650
  queuedApprovalResultsRef,
537953
537651
  queueApprovalResults,
537954
537652
  queueSnapshotRef,
537955
- quotaAutoSwapAttemptedRef,
537956
537653
  refreshDerived,
537957
537654
  refreshDerivedThrottled,
537958
537655
  resetTrajectoryBases,
@@ -543241,4 +542938,4 @@ function registerBunOAuthFlows() {
543241
542938
  registerBunOAuthFlows();
543242
542939
  await init_src5().then(() => exports_src2);
543243
542940
 
543244
- //# debugId=1FB31163ED2A450364756E2164756E21
542941
+ //# debugId=A5E4F04FD213E38C64756E2164756E21