@letta-ai/letta-code 0.31.2 → 0.31.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/letta.js CHANGED
@@ -5509,7 +5509,7 @@ var package_default;
5509
5509
  var init_package = __esm(() => {
5510
5510
  package_default = {
5511
5511
  name: "@letta-ai/letta-code",
5512
- version: "0.31.2",
5512
+ version: "0.31.3",
5513
5513
  description: "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
5514
5514
  type: "module",
5515
5515
  packageManager: "bun@1.3.10",
@@ -111856,7 +111856,8 @@ var init_skills3 = __esm(() => {
111856
111856
  init_skill_sources();
111857
111857
  LOCAL_AGENT_EXCLUDED_BUNDLED_SKILLS = new Set([
111858
111858
  "image-generation",
111859
- "managing-shared-memory"
111859
+ "managing-shared-memory",
111860
+ "using-cloud-mcp"
111860
111861
  ]);
111861
111862
  PROJECT_SKILLS_DIR = join23(".agents", "skills");
111862
111863
  GLOBAL_SKILLS_DIR = join23(process.env.HOME || process.env.USERPROFILE || "~", ".letta/skills");
@@ -197190,6 +197191,330 @@ var init_channels = __esm(() => {
197190
197191
  };
197191
197192
  });
197192
197193
 
197194
+ // src/backend/api/mcp-servers.ts
197195
+ function getString(record3, key2) {
197196
+ const value = record3[key2];
197197
+ return typeof value === "string" ? value : null;
197198
+ }
197199
+ function parseAgentConnectedMcpServer(value) {
197200
+ if (!isRecord(value)) {
197201
+ return null;
197202
+ }
197203
+ const id2 = getString(value, "id");
197204
+ const serverName = getString(value, "server_name");
197205
+ const serverType = getString(value, "mcp_server_type");
197206
+ if (!id2 || !serverName || !serverType) {
197207
+ return null;
197208
+ }
197209
+ const target2 = getString(value, "server_url") ?? [
197210
+ getString(value, "command"),
197211
+ ...Array.isArray(value.args) ? value.args : []
197212
+ ].filter((item) => typeof item === "string").join(" ");
197213
+ return { id: id2, serverName, serverType, target: target2 };
197214
+ }
197215
+ function parseAgentConnectedMcpTool(value) {
197216
+ if (!isRecord(value)) {
197217
+ return null;
197218
+ }
197219
+ const id2 = getString(value, "id");
197220
+ const name = getString(value, "name");
197221
+ if (!id2 || !name) {
197222
+ return null;
197223
+ }
197224
+ const description = getString(value, "description");
197225
+ return { id: id2, name, description };
197226
+ }
197227
+ function parseAgentMcpToolRunResult(value) {
197228
+ if (!isRecord(value)) {
197229
+ throw new Error("MCP tool run returned an invalid response");
197230
+ }
197231
+ const status = getString(value, "status") ?? "unknown";
197232
+ return {
197233
+ status,
197234
+ funcReturn: value.func_return,
197235
+ stdout: value.stdout,
197236
+ stderr: value.stderr
197237
+ };
197238
+ }
197239
+ function withTimeout(promise, timeoutMs, label) {
197240
+ let timer;
197241
+ const timeout = new Promise((_4, reject2) => {
197242
+ timer = setTimeout(() => reject2(new Error(`${label} timed out after ${timeoutMs}ms`)), timeoutMs);
197243
+ });
197244
+ return Promise.race([promise, timeout]).finally(() => {
197245
+ if (timer !== undefined)
197246
+ clearTimeout(timer);
197247
+ });
197248
+ }
197249
+ function listServerMcpServers(client, timeoutMs = 1e4) {
197250
+ return withTimeout(client.mcpServers.list(), timeoutMs, "Listing server-side MCP servers");
197251
+ }
197252
+ async function listAgentConnectedMcpServers(client, agentId, timeoutMs = 1e4) {
197253
+ const result2 = await withTimeout(client.get(`/v1/agents/${encodeURIComponent(agentId)}/mcp-servers`), timeoutMs, "Listing agent-connected MCP servers");
197254
+ if (!Array.isArray(result2)) {
197255
+ return [];
197256
+ }
197257
+ return result2.map(parseAgentConnectedMcpServer).filter((server2) => server2 !== null);
197258
+ }
197259
+ async function listAgentConnectedMcpTools(client, agentId, mcpServerId, timeoutMs = 1e4) {
197260
+ const result2 = await withTimeout(client.get(`/v1/agents/${encodeURIComponent(agentId)}/mcp-servers/${encodeURIComponent(mcpServerId)}/tools`), timeoutMs, "Listing agent-connected MCP server tools");
197261
+ if (!Array.isArray(result2)) {
197262
+ return [];
197263
+ }
197264
+ return result2.map(parseAgentConnectedMcpTool).filter((tool) => tool !== null);
197265
+ }
197266
+ async function runAgentConnectedMcpTool(params) {
197267
+ const result2 = await withTimeout(params.client.post(`/v1/agents/${encodeURIComponent(params.agentId)}/mcp-servers/${encodeURIComponent(params.mcpServerId)}/tools/${encodeURIComponent(params.toolId)}/run`, { args: params.args }), params.timeoutMs ?? 60000, "Running agent-connected MCP tool");
197268
+ return parseAgentMcpToolRunResult(result2);
197269
+ }
197270
+ async function listLiveServerMcpTools(client, serverName, timeoutMs = 15000) {
197271
+ const result2 = await withTimeout(client.get(`/v1/tools/mcp/servers/${encodeURIComponent(serverName)}/tools`), timeoutMs, `Listing tools for MCP server "${serverName}"`);
197272
+ if (!Array.isArray(result2))
197273
+ return [];
197274
+ return result2.filter((tool) => typeof tool === "object" && tool !== null && typeof tool.name === "string");
197275
+ }
197276
+ async function loadServerMcpEntries(client, timeoutMs = 15000) {
197277
+ const servers = await listServerMcpServers(client, timeoutMs);
197278
+ return Promise.all(servers.map(async (server2) => {
197279
+ try {
197280
+ const tools = await listLiveServerMcpTools(client, server2.server_name, timeoutMs);
197281
+ return { server: server2, tools };
197282
+ } catch (cause) {
197283
+ return {
197284
+ server: server2,
197285
+ tools: [],
197286
+ toolsError: cause instanceof Error ? cause.message : String(cause)
197287
+ };
197288
+ }
197289
+ }));
197290
+ }
197291
+ function parseMcpMetadata(tool) {
197292
+ const metadata = tool.metadata_;
197293
+ const mcp = metadata?.mcp;
197294
+ if (typeof mcp !== "object" || mcp === null)
197295
+ return null;
197296
+ const { server_id, server_name } = mcp;
197297
+ return {
197298
+ ...typeof server_id === "string" && { serverId: server_id },
197299
+ ...typeof server_name === "string" && { serverName: server_name }
197300
+ };
197301
+ }
197302
+ async function listAgentMcpAttachments(client, agentId) {
197303
+ const attachments = [];
197304
+ for await (const tool of client.agents.tools.list(agentId, { limit: 100 })) {
197305
+ if (tool.tool_type !== "external_mcp" || !tool.id || !tool.name)
197306
+ continue;
197307
+ attachments.push({
197308
+ toolId: tool.id,
197309
+ toolName: tool.name,
197310
+ ...parseMcpMetadata(tool)
197311
+ });
197312
+ }
197313
+ return attachments;
197314
+ }
197315
+ function attachmentsForEntry(entry, attachments) {
197316
+ return attachments.filter((attachment) => attachment.serverId && entry.server.id ? attachment.serverId === entry.server.id : attachment.serverName === entry.server.server_name);
197317
+ }
197318
+ function attachedToolNamesForEntry(entry, attachments) {
197319
+ return new Set(attachmentsForEntry(entry, attachments).map((attachment) => attachment.toolName));
197320
+ }
197321
+ async function registerServerMcpTool(client, serverName, toolName) {
197322
+ const result2 = await client.post(`/v1/tools/mcp/servers/${encodeURIComponent(serverName)}/${encodeURIComponent(toolName)}`);
197323
+ if (typeof result2?.id !== "string") {
197324
+ throw new Error(`Registering MCP tool "${toolName}" on server "${serverName}" returned no tool id`);
197325
+ }
197326
+ return { id: result2.id };
197327
+ }
197328
+ async function attachServerMcpTools(client, agentId, serverName, toolNames) {
197329
+ await Promise.all(toolNames.map(async (toolName) => {
197330
+ const { id: id2 } = await registerServerMcpTool(client, serverName, toolName);
197331
+ await client.agents.tools.attach(id2, { agent_id: agentId });
197332
+ }));
197333
+ }
197334
+ async function detachServerMcpTools(client, agentId, toolIds) {
197335
+ await Promise.all(toolIds.map((toolId) => client.agents.tools.detach(toolId, { agent_id: agentId })));
197336
+ }
197337
+ function refreshServerMcpServer(client, mcpServerId, agentId) {
197338
+ return client.mcpServers.refresh(mcpServerId, { agent_id: agentId });
197339
+ }
197340
+ function planServerMcpToggle(entry, attachments) {
197341
+ const attached = attachmentsForEntry(entry, attachments);
197342
+ if (attached.length > 0) {
197343
+ return {
197344
+ action: "detach",
197345
+ toolIds: attached.map((attachment) => attachment.toolId)
197346
+ };
197347
+ }
197348
+ return { action: "attach", toolNames: entry.tools.map((tool) => tool.name) };
197349
+ }
197350
+ function describeServerMcpTarget(server2) {
197351
+ if ("server_url" in server2 && server2.server_url) {
197352
+ return server2.server_url;
197353
+ }
197354
+ if ("command" in server2 && server2.command) {
197355
+ return [server2.command, ...server2.args ?? []].join(" ");
197356
+ }
197357
+ return "";
197358
+ }
197359
+ var init_mcp_servers2 = () => {};
197360
+
197361
+ // src/cli/subcommands/cloud-mcp.ts
197362
+ import { parseArgs as parseArgs4 } from "node:util";
197363
+ function printUsage4(stdout = console.log) {
197364
+ stdout(`
197365
+ Usage:
197366
+ letta cloud-mcp list [--agent <id>]
197367
+ letta cloud-mcp tools <mcp-server-id> [--agent <id>]
197368
+ letta cloud-mcp run <mcp-server-id> <tool-id> [--args '<json>'] [--agent <id>]
197369
+
197370
+ Actions:
197371
+ list List MCP servers connected to the agent
197372
+ tools List registered tools for one connected MCP server
197373
+ run Run one registered MCP tool through the agent-scoped server route
197374
+
197375
+ Aliases:
197376
+ list-servers, list_servers Alias for list
197377
+ list-tools, list_tools Alias for tools
197378
+ call, run-tool, run_tool Alias for run
197379
+
197380
+ Options:
197381
+ --agent <id> Agent ID. Defaults to LETTA_AGENT_ID or AGENT_ID
197382
+ --agent-id <id> Alias for --agent
197383
+ --args '<json>' JSON object passed as MCP tool arguments for run
197384
+ -h, --help Show this help
197385
+
197386
+ Notes:
197387
+ - Output is JSON only.
197388
+ - Requires a signed-in Letta Cloud agent with server-side MCP support.
197389
+ - Uses CLI auth; override with LETTA_API_KEY/LETTA_BASE_URL if needed.
197390
+ `.trim());
197391
+ }
197392
+ function parseCloudMcpArgs(argv) {
197393
+ return parseArgs4({
197394
+ args: argv,
197395
+ options: {
197396
+ help: { type: "boolean", short: "h" },
197397
+ agent: { type: "string" },
197398
+ "agent-id": { type: "string" },
197399
+ args: { type: "string" }
197400
+ },
197401
+ strict: true,
197402
+ allowPositionals: true
197403
+ });
197404
+ }
197405
+ function stringValue3(value) {
197406
+ return typeof value === "string" ? value : undefined;
197407
+ }
197408
+ function resolveCloudMcpAgentId(agent, agentId, env4 = process.env) {
197409
+ return (agent || agentId || env4.LETTA_AGENT_ID || env4.AGENT_ID || "").trim();
197410
+ }
197411
+ function parseToolArgs(value) {
197412
+ const raw2 = stringValue3(value);
197413
+ if (!raw2) {
197414
+ return {};
197415
+ }
197416
+ let parsed;
197417
+ try {
197418
+ parsed = JSON.parse(raw2);
197419
+ } catch (error4) {
197420
+ const message = error4 instanceof Error ? error4.message : String(error4);
197421
+ throw new Error(`Invalid --args JSON: ${message}`);
197422
+ }
197423
+ if (!isRecord(parsed)) {
197424
+ throw new Error("Invalid --args JSON: expected a JSON object");
197425
+ }
197426
+ return parsed;
197427
+ }
197428
+ function printJson(stdout, result2) {
197429
+ stdout(JSON.stringify(result2, null, 2));
197430
+ }
197431
+ async function defaultGetClient() {
197432
+ const client = await getClient();
197433
+ return client;
197434
+ }
197435
+ async function runCloudMcpSubcommand(argv, deps = {}) {
197436
+ const stdout = deps.stdout ?? console.log;
197437
+ const stderr = deps.stderr ?? console.error;
197438
+ let parsed;
197439
+ try {
197440
+ parsed = parseCloudMcpArgs(argv);
197441
+ } catch (error4) {
197442
+ const message = error4 instanceof Error ? error4.message : String(error4);
197443
+ stderr(`Error: ${message}`);
197444
+ printUsage4(stdout);
197445
+ return 1;
197446
+ }
197447
+ const [action3, mcpServerId, toolId] = parsed.positionals;
197448
+ if (parsed.values.help || !action3 || action3 === "help") {
197449
+ printUsage4(stdout);
197450
+ return 0;
197451
+ }
197452
+ const isAvailable = deps.isServerSideMcpAvailable ?? (() => getBackend().capabilities.serverSideToolManagement);
197453
+ if (!isAvailable()) {
197454
+ stderr("Server-side MCP requires a signed-in Letta Cloud agent; the local backend does not support it.");
197455
+ return 1;
197456
+ }
197457
+ const agentId = resolveCloudMcpAgentId(stringValue3(parsed.values.agent), stringValue3(parsed.values["agent-id"]));
197458
+ if (!agentId) {
197459
+ stderr("Agent id required: pass --agent <id> or set LETTA_AGENT_ID/AGENT_ID.");
197460
+ return 1;
197461
+ }
197462
+ await (deps.initializeSettings ?? (() => settingsManager.initialize()))();
197463
+ const client = await (deps.getClient ?? defaultGetClient)();
197464
+ try {
197465
+ if (action3 === "list" || action3 === "list-servers" || action3 === "list_servers") {
197466
+ printJson(stdout, {
197467
+ agent_id: agentId,
197468
+ servers: await listAgentConnectedMcpServers(client, agentId)
197469
+ });
197470
+ return 0;
197471
+ }
197472
+ if (action3 === "tools" || action3 === "list-tools" || action3 === "list_tools") {
197473
+ if (!mcpServerId) {
197474
+ stderr("Usage: letta cloud-mcp tools <mcp-server-id> [--agent <id>]");
197475
+ return 1;
197476
+ }
197477
+ printJson(stdout, {
197478
+ agent_id: agentId,
197479
+ mcp_server_id: mcpServerId,
197480
+ tools: await listAgentConnectedMcpTools(client, agentId, mcpServerId)
197481
+ });
197482
+ return 0;
197483
+ }
197484
+ if (action3 === "run" || action3 === "call" || action3 === "run-tool" || action3 === "run_tool") {
197485
+ if (!mcpServerId || !toolId) {
197486
+ stderr("Usage: letta cloud-mcp run <mcp-server-id> <tool-id> [--args '<json>'] [--agent <id>]");
197487
+ return 1;
197488
+ }
197489
+ printJson(stdout, {
197490
+ agent_id: agentId,
197491
+ mcp_server_id: mcpServerId,
197492
+ tool_id: toolId,
197493
+ result: await runAgentConnectedMcpTool({
197494
+ client,
197495
+ agentId,
197496
+ mcpServerId,
197497
+ toolId,
197498
+ args: parseToolArgs(parsed.values.args)
197499
+ })
197500
+ });
197501
+ return 0;
197502
+ }
197503
+ stderr(`Unknown cloud-mcp action: ${action3}`);
197504
+ printUsage4(stdout);
197505
+ return 1;
197506
+ } catch (error4) {
197507
+ stderr(error4 instanceof Error ? error4.message : String(error4));
197508
+ return 1;
197509
+ }
197510
+ }
197511
+ var init_cloud_mcp = __esm(() => {
197512
+ init_backend2();
197513
+ init_client2();
197514
+ init_mcp_servers2();
197515
+ init_settings_manager();
197516
+ });
197517
+
197193
197518
  // src/auth/openai-oauth.ts
197194
197519
  import http3 from "node:http";
197195
197520
  function renderOAuthPage(options) {
@@ -198313,7 +198638,7 @@ var init_connect_normalize = __esm(() => {
198313
198638
  // src/cli/subcommands/connect.ts
198314
198639
  import { createInterface as createInterface6 } from "node:readline/promises";
198315
198640
  import { Writable } from "node:stream";
198316
- import { parseArgs as parseArgs4 } from "node:util";
198641
+ import { parseArgs as parseArgs5 } from "node:util";
198317
198642
  function readStringOption(value) {
198318
198643
  if (typeof value === "string") {
198319
198644
  return value;
@@ -198405,7 +198730,7 @@ async function runConnectSubcommand(argv, deps = {}) {
198405
198730
  const io = { ...DEFAULT_DEPS2, ...deps };
198406
198731
  let parsed;
198407
198732
  try {
198408
- parsed = parseArgs4({
198733
+ parsed = parseArgs5({
198409
198734
  args: argv,
198410
198735
  options: CONNECT_OPTIONS,
198411
198736
  strict: true,
@@ -207615,8 +207940,8 @@ var init_cron_task_ref = __esm(async () => {
207615
207940
  });
207616
207941
 
207617
207942
  // src/cli/subcommands/cron.ts
207618
- import { parseArgs as parseArgs5 } from "node:util";
207619
- function printUsage4() {
207943
+ import { parseArgs as parseArgs6 } from "node:util";
207944
+ function printUsage5() {
207620
207945
  console.log(`
207621
207946
  Usage:
207622
207947
  letta cron add --prompt <text> --every <interval> [options]
@@ -207670,7 +207995,7 @@ Output is JSON.
207670
207995
  `.trim());
207671
207996
  }
207672
207997
  function parseCronArgs(argv) {
207673
- return parseArgs5({
207998
+ return parseArgs6({
207674
207999
  args: argv,
207675
208000
  options: CRON_OPTIONS,
207676
208001
  strict: true,
@@ -208226,12 +208551,12 @@ async function runCronSubcommand(argv) {
208226
208551
  parsed = parseCronArgs(argv);
208227
208552
  } catch (err) {
208228
208553
  console.error(`Error: ${err instanceof Error ? err.message : String(err)}`);
208229
- printUsage4();
208554
+ printUsage5();
208230
208555
  return 1;
208231
208556
  }
208232
208557
  const [action3] = parsed.positionals;
208233
208558
  if (parsed.values.help || !action3 || action3 === "help") {
208234
- printUsage4();
208559
+ printUsage5();
208235
208560
  return 0;
208236
208561
  }
208237
208562
  switch (action3) {
@@ -208248,7 +208573,7 @@ async function runCronSubcommand(argv) {
208248
208573
  return handleDelete(parsed.values, parsed.positionals);
208249
208574
  default:
208250
208575
  console.error(`Unknown action: ${action3}`);
208251
- printUsage4();
208576
+ printUsage5();
208252
208577
  return 1;
208253
208578
  }
208254
208579
  }
@@ -208841,12 +209166,12 @@ function rowToolCalls(row, index, diagnostics2) {
208841
209166
  }
208842
209167
  return calls;
208843
209168
  }
208844
- function contentText2(content) {
209169
+ function contentText(content) {
208845
209170
  if (typeof content === "string") {
208846
209171
  if (content.startsWith(CONTENT_JSON_PREFIX)) {
208847
209172
  const encoded = content.slice(CONTENT_JSON_PREFIX.length);
208848
209173
  try {
208849
- return contentText2(JSON.parse(encoded));
209174
+ return contentText(JSON.parse(encoded));
208850
209175
  } catch {
208851
209176
  return encoded;
208852
209177
  }
@@ -208932,7 +209257,7 @@ var init_hermes = __esm(() => {
208932
209257
  });
208933
209258
  };
208934
209259
  if (row.role === "user") {
208935
- const content = contentText2(row.content);
209260
+ const content = contentText(row.content);
208936
209261
  if (content) {
208937
209262
  emit({
208938
209263
  type: "message",
@@ -208952,7 +209277,7 @@ var init_hermes = __esm(() => {
208952
209277
  ...timestamp ? { timestamp } : {}
208953
209278
  });
208954
209279
  }
208955
- const content = contentText2(row.content);
209280
+ const content = contentText(row.content);
208956
209281
  if (content) {
208957
209282
  emit({
208958
209283
  type: "message",
@@ -208975,7 +209300,7 @@ var init_hermes = __esm(() => {
208975
209300
  if (row.role === "tool") {
208976
209301
  emit({
208977
209302
  type: "tool_result",
208978
- content: contentText2(row.content),
209303
+ content: contentText(row.content),
208979
209304
  ...typeof row.tool_call_id === "string" && row.tool_call_id ? { callId: row.tool_call_id } : {},
208980
209305
  ...timestamp ? { timestamp } : {}
208981
209306
  });
@@ -213827,8 +214152,8 @@ var init_reflection_launcher = __esm(() => {
213827
214152
  });
213828
214153
 
213829
214154
  // src/cli/subcommands/dream.ts
213830
- import { parseArgs as parseArgs6 } from "node:util";
213831
- function printUsage5() {
214155
+ import { parseArgs as parseArgs7 } from "node:util";
214156
+ function printUsage6() {
213832
214157
  console.log(`
213833
214158
  Usage:
213834
214159
  letta dream [options]
@@ -213865,7 +214190,7 @@ Notes:
213865
214190
  `.trim());
213866
214191
  }
213867
214192
  function parseDreamArgs(argv) {
213868
- return parseArgs6({
214193
+ return parseArgs7({
213869
214194
  args: argv,
213870
214195
  options: DREAM_OPTIONS,
213871
214196
  strict: true,
@@ -213882,17 +214207,17 @@ async function runDreamSubcommand(argv) {
213882
214207
  } catch (error4) {
213883
214208
  const message = error4 instanceof Error ? error4.message : String(error4);
213884
214209
  console.error(`Error: ${message}`);
213885
- printUsage5();
214210
+ printUsage6();
213886
214211
  return 1;
213887
214212
  }
213888
214213
  const [action3] = parsed.positionals;
213889
214214
  if (parsed.values.help || action3 === "help") {
213890
- printUsage5();
214215
+ printUsage6();
213891
214216
  return 0;
213892
214217
  }
213893
214218
  if (action3) {
213894
214219
  console.error(`Unknown argument: ${action3}`);
213895
- printUsage5();
214220
+ printUsage6();
213896
214221
  return 1;
213897
214222
  }
213898
214223
  const asJson = Boolean(parsed.values.json);
@@ -214118,8 +214443,8 @@ var init_dream = __esm(() => {
214118
214443
  });
214119
214444
 
214120
214445
  // src/cli/subcommands/environments.ts
214121
- import { parseArgs as parseArgs7 } from "node:util";
214122
- function printUsage6() {
214446
+ import { parseArgs as parseArgs8 } from "node:util";
214447
+ function printUsage7() {
214123
214448
  console.log(`
214124
214449
  Usage:
214125
214450
  letta environments list [options]
@@ -214187,7 +214512,7 @@ function scoreCurrentEnvironment(environment2, options) {
214187
214512
  return score;
214188
214513
  }
214189
214514
  function parseEnvironmentsArgs(argv) {
214190
- return parseArgs7({
214515
+ return parseArgs8({
214191
214516
  args: argv,
214192
214517
  options: ENVIRONMENTS_OPTIONS,
214193
214518
  strict: true,
@@ -214201,17 +214526,17 @@ async function runEnvironmentsSubcommand(argv, deps = {}) {
214201
214526
  } catch (error4) {
214202
214527
  const message = error4 instanceof Error ? error4.message : String(error4);
214203
214528
  console.error(`Error: ${message}`);
214204
- printUsage6();
214529
+ printUsage7();
214205
214530
  return 1;
214206
214531
  }
214207
214532
  const [action3] = parsed.positionals;
214208
214533
  if (parsed.values.help || !action3 || action3 === "help") {
214209
- printUsage6();
214534
+ printUsage7();
214210
214535
  return 0;
214211
214536
  }
214212
214537
  if (action3 !== "list" && action3 !== "current") {
214213
214538
  console.error(`Unknown action: ${action3}`);
214214
- printUsage6();
214539
+ printUsage7();
214215
214540
  return 1;
214216
214541
  }
214217
214542
  await (deps.initializeSettings ?? (() => settingsManager.initialize()))();
@@ -241963,9 +242288,9 @@ ${lanes.join(`
241963
242288
  function isJsonEqual(a2, b3) {
241964
242289
  return a2 === b3 || typeof a2 === "object" && a2 !== null && typeof b3 === "object" && b3 !== null && equalOwnProperties(a2, b3, isJsonEqual);
241965
242290
  }
241966
- function parsePseudoBigInt(stringValue3) {
242291
+ function parsePseudoBigInt(stringValue4) {
241967
242292
  let log2Base;
241968
- switch (stringValue3.charCodeAt(1)) {
242293
+ switch (stringValue4.charCodeAt(1)) {
241969
242294
  case 98:
241970
242295
  case 66:
241971
242296
  log2Base = 1;
@@ -241979,19 +242304,19 @@ ${lanes.join(`
241979
242304
  log2Base = 4;
241980
242305
  break;
241981
242306
  default:
241982
- const nIndex = stringValue3.length - 1;
242307
+ const nIndex = stringValue4.length - 1;
241983
242308
  let nonZeroStart = 0;
241984
- while (stringValue3.charCodeAt(nonZeroStart) === 48) {
242309
+ while (stringValue4.charCodeAt(nonZeroStart) === 48) {
241985
242310
  nonZeroStart++;
241986
242311
  }
241987
- return stringValue3.slice(nonZeroStart, nIndex) || "0";
242312
+ return stringValue4.slice(nonZeroStart, nIndex) || "0";
241988
242313
  }
241989
- const startIndex = 2, endIndex = stringValue3.length - 1;
242314
+ const startIndex = 2, endIndex = stringValue4.length - 1;
241990
242315
  const bitsNeeded = (endIndex - startIndex) * log2Base;
241991
242316
  const segments = new Uint16Array((bitsNeeded >>> 4) + (bitsNeeded & 15 ? 1 : 0));
241992
242317
  for (let i4 = endIndex - 1, bitOffset = 0;i4 >= startIndex; i4--, bitOffset += log2Base) {
241993
242318
  const segment = bitOffset >>> 4;
241994
- const digitChar = stringValue3.charCodeAt(i4);
242319
+ const digitChar = stringValue4.charCodeAt(i4);
241995
242320
  const digit = digitChar <= 57 ? digitChar - 48 : 10 + digitChar - (digitChar <= 70 ? 65 : 97);
241996
242321
  const shiftedDigit = digit << (bitOffset & 15);
241997
242322
  segments[segment] |= shiftedDigit;
@@ -395054,7 +395379,7 @@ function toRunsArray(listResponse) {
395054
395379
  }
395055
395380
  return [];
395056
395381
  }
395057
- function withTimeout(promise, timeoutMs, timeoutMessage) {
395382
+ function withTimeout2(promise, timeoutMs, timeoutMessage) {
395058
395383
  return new Promise((resolve35, reject2) => {
395059
395384
  const timer = setTimeout(() => reject2(new Error(timeoutMessage)), timeoutMs);
395060
395385
  promise.then((value) => {
@@ -395068,7 +395393,7 @@ function withTimeout(promise, timeoutMs, timeoutMessage) {
395068
395393
  }
395069
395394
  async function discoverFallbackRunIdWithTimeout(ctx) {
395070
395395
  const client = await getClient();
395071
- return withTimeout(discoverFallbackRunIdForResume(client, ctx), FALLBACK_RUN_DISCOVERY_TIMEOUT_MS, `Fallback run discovery timed out after ${FALLBACK_RUN_DISCOVERY_TIMEOUT_MS}ms`);
395396
+ return withTimeout2(discoverFallbackRunIdForResume(client, ctx), FALLBACK_RUN_DISCOVERY_TIMEOUT_MS, `Fallback run discovery timed out after ${FALLBACK_RUN_DISCOVERY_TIMEOUT_MS}ms`);
395072
395397
  }
395073
395398
  async function discoverFallbackRunIdForResume(client, ctx) {
395074
395399
  const statuses = ["running"];
@@ -395796,7 +396121,7 @@ function formatMissingRequiredArgsReason(toolName, parsedArgs, missingRequiredAr
395796
396121
  }
395797
396122
  return base2;
395798
396123
  }
395799
- function parseToolArgs(rawArgs) {
396124
+ function parseToolArgs2(rawArgs) {
395800
396125
  const raw2 = rawArgs ?? "";
395801
396126
  const trimmed = raw2.trim();
395802
396127
  if (!trimmed) {
@@ -395841,7 +396166,7 @@ async function classifyApprovals(approvals, opts = {}) {
395841
396166
  });
395842
396167
  continue;
395843
396168
  }
395844
- const argsParse = parseToolArgs(approval.toolArgs);
396169
+ const argsParse = parseToolArgs2(approval.toolArgs);
395845
396170
  const parsedArgs = argsParse.parsedArgs;
395846
396171
  if (argsParse.parseFailed) {
395847
396172
  debugWarn("approval-classification", `Tool call ${approval.toolCallId} (${toolName}) had unparseable arguments ` + `(${argsParse.rawLength} chars); treating as empty`);
@@ -405803,7 +406128,7 @@ function getNumber(record3, keys3) {
405803
406128
  }
405804
406129
  return null;
405805
406130
  }
405806
- function getString(record3, keys3) {
406131
+ function getString2(record3, keys3) {
405807
406132
  const value = getValue(record3, keys3);
405808
406133
  if (typeof value === "string" && value.trim())
405809
406134
  return value.trim();
@@ -405889,7 +406214,7 @@ function normalizeCredits(raw2, rateLimit) {
405889
406214
  const resetCredits = getRecord(raw2, ["rate_limit_reset_credits", "rateLimitResetCredits"]) ?? getRecord(rateLimit, ["rate_limit_reset_credits", "rateLimitResetCredits"]);
405890
406215
  if (!credits && !resetCredits)
405891
406216
  return null;
405892
- const balance = getString(credits, ["balance", "credit_balance", "amount"]);
406217
+ const balance = getString2(credits, ["balance", "credit_balance", "amount"]);
405893
406218
  const availableCount = getNumber(credits, ["available_count", "availableCount", "count"]) ?? getNumber(resetCredits, ["available_count", "availableCount", "count"]);
405894
406219
  const hasCredits = getBoolean(credits, ["has_credits", "hasCredits"]);
405895
406220
  const unlimited = getBoolean(credits, ["unlimited", "is_unlimited"]);
@@ -405908,8 +406233,8 @@ function normalizeIndividualLimit(raw2, nowMs) {
405908
406233
  const record3 = getRecord(raw2, ["individual_limit", "individualLimit"]) ?? getRecord(spendControl, ["individual_limit", "individualLimit"]);
405909
406234
  if (!record3)
405910
406235
  return null;
405911
- const limit3 = getString(record3, ["limit"]);
405912
- const used = getString(record3, ["used"]);
406236
+ const limit3 = getString2(record3, ["limit"]);
406237
+ const used = getString2(record3, ["used"]);
405913
406238
  const remainingPercent = getNumber(record3, [
405914
406239
  "remaining_percent",
405915
406240
  "remainingPercent"
@@ -405938,10 +406263,10 @@ function normalizeCloudUsageWindow(value, fallbackLabel, nowMs) {
405938
406263
  const record3 = asRecord8(value);
405939
406264
  if (!record3)
405940
406265
  return null;
405941
- return normalizeUsageWindow(record3, getString(record3, ["label", "name"]) ?? fallbackLabel, nowMs);
406266
+ return normalizeUsageWindow(record3, getString2(record3, ["label", "name"]) ?? fallbackLabel, nowMs);
405942
406267
  }
405943
406268
  function normalizeAdditionalRateLimit(details, index, nowMs) {
405944
- const label = getString(details, [
406269
+ const label = getString2(details, [
405945
406270
  "limit_name",
405946
406271
  "limitName",
405947
406272
  "metered_feature",
@@ -405967,7 +406292,7 @@ function getRateLimitReachedType(raw2) {
405967
406292
  if (typeof value === "string" && value.trim())
405968
406293
  return value.trim();
405969
406294
  const record3 = asRecord8(value);
405970
- return getString(record3, ["type", "kind"]);
406295
+ return getString2(record3, ["type", "kind"]);
405971
406296
  }
405972
406297
  function formatPercent(value) {
405973
406298
  const rounded = Math.round(value);
@@ -406082,7 +406407,7 @@ function normalizeWhamUsageResponse(input) {
406082
406407
  const snapshotWithoutSummary = {
406083
406408
  providerName: input.providerName,
406084
406409
  fetchedAt,
406085
- planType: getString(raw2, ["plan_type", "planType"]),
406410
+ planType: getString2(raw2, ["plan_type", "planType"]),
406086
406411
  limitReached: getBoolean(rateLimit, ["limit_reached", "limitReached"]) ?? getBoolean(spendControl, ["reached"]),
406087
406412
  rateLimitReachedType: getRateLimitReachedType(raw2),
406088
406413
  primary,
@@ -406101,18 +406426,18 @@ function normalizeCloudChatGPTUsageResponse(input) {
406101
406426
  if (!raw2)
406102
406427
  return null;
406103
406428
  const nowMs = input.nowMs ?? Date.now();
406104
- const fetchedAt = getString(raw2, ["fetchedAt", "fetched_at"]) ?? new Date(nowMs).toISOString();
406429
+ const fetchedAt = getString2(raw2, ["fetchedAt", "fetched_at"]) ?? new Date(nowMs).toISOString();
406105
406430
  const additional = getRecordArray(raw2, [
406106
406431
  "additional",
406107
406432
  "additional_rate_limits",
406108
406433
  "additionalRateLimits"
406109
406434
  ]).map((window2, index) => normalizeCloudUsageWindow(window2, `limit ${index + 1}`, nowMs)).filter((window2) => !!window2);
406110
406435
  const snapshotWithoutSummary = {
406111
- providerName: getString(raw2, ["providerName", "provider_name"]) ?? input.providerName,
406436
+ providerName: getString2(raw2, ["providerName", "provider_name"]) ?? input.providerName,
406112
406437
  fetchedAt,
406113
- planType: getString(raw2, ["planType", "plan_type"]),
406438
+ planType: getString2(raw2, ["planType", "plan_type"]),
406114
406439
  limitReached: getBoolean(raw2, ["limitReached", "limit_reached"]),
406115
- rateLimitReachedType: getString(raw2, [
406440
+ rateLimitReachedType: getString2(raw2, [
406116
406441
  "rateLimitReachedType",
406117
406442
  "rate_limit_reached_type"
406118
406443
  ]),
@@ -406124,7 +406449,7 @@ function normalizeCloudChatGPTUsageResponse(input) {
406124
406449
  };
406125
406450
  return {
406126
406451
  ...snapshotWithoutSummary,
406127
- summary: getString(raw2, ["summary"]) ?? formatChatGPTUsageSnapshot(snapshotWithoutSummary, new Date(nowMs))
406452
+ summary: getString2(raw2, ["summary"]) ?? formatChatGPTUsageSnapshot(snapshotWithoutSummary, new Date(nowMs))
406128
406453
  };
406129
406454
  }
406130
406455
  function retryAfterMs(response) {
@@ -406149,7 +406474,7 @@ async function readJsonRecord(response) {
406149
406474
  }
406150
406475
  }
406151
406476
  function responseMessage(raw2, fallback) {
406152
- return getString(raw2 ?? undefined, ["message", "error", "detail"]) ?? fallback;
406477
+ return getString2(raw2 ?? undefined, ["message", "error", "detail"]) ?? fallback;
406153
406478
  }
406154
406479
  function chatGPTUsageError(code2, message, retryAfter) {
406155
406480
  return {
@@ -409908,7 +410233,7 @@ var init_app_server_openai_common = __esm(() => {
409908
410233
  function asRecord9(value) {
409909
410234
  return value !== null && typeof value === "object" ? value : null;
409910
410235
  }
409911
- function stringValue3(value) {
410236
+ function stringValue4(value) {
409912
410237
  return typeof value === "string" ? value : undefined;
409913
410238
  }
409914
410239
  function extractToolCallFragments(record3) {
@@ -409922,12 +410247,12 @@ function extractToolCallFragments(record3) {
409922
410247
  if (!toolCall) {
409923
410248
  continue;
409924
410249
  }
409925
- const toolCallId = stringValue3(toolCall.tool_call_id);
410250
+ const toolCallId = stringValue4(toolCall.tool_call_id);
409926
410251
  if (!toolCallId) {
409927
410252
  continue;
409928
410253
  }
409929
- const name = stringValue3(toolCall.name) ?? null;
409930
- const argumentsDelta = stringValue3(toolCall.arguments) ?? null;
410254
+ const name = stringValue4(toolCall.name) ?? null;
410255
+ const argumentsDelta = stringValue4(toolCall.arguments) ?? null;
409931
410256
  fragments.push({ toolCallId, name, argumentsDelta });
409932
410257
  }
409933
410258
  return fragments;
@@ -409967,7 +410292,7 @@ function extractToolReturns(record3) {
409967
410292
  if (!rec) {
409968
410293
  continue;
409969
410294
  }
409970
- const toolCallId = stringValue3(rec.tool_call_id);
410295
+ const toolCallId = stringValue4(rec.tool_call_id);
409971
410296
  const status = asToolReturnStatus2(rec.status);
409972
410297
  if (!toolCallId || !status) {
409973
410298
  continue;
@@ -409982,7 +410307,7 @@ function extractToolReturns(record3) {
409982
410307
  return results;
409983
410308
  }
409984
410309
  }
409985
- const topLevelToolCallId = stringValue3(record3.tool_call_id);
410310
+ const topLevelToolCallId = stringValue4(record3.tool_call_id);
409986
410311
  const topLevelStatus = asToolReturnStatus2(record3.status);
409987
410312
  if (!topLevelToolCallId || !topLevelStatus) {
409988
410313
  return [];
@@ -410070,13 +410395,13 @@ function createToolLifecycleTracker(onEvent) {
410070
410395
  return;
410071
410396
  }
410072
410397
  const record3 = delta2;
410073
- const messageType = stringValue3(record3.message_type);
410074
- const toolCallId = stringValue3(record3.tool_call_id);
410398
+ const messageType = stringValue4(record3.message_type);
410399
+ const toolCallId = stringValue4(record3.tool_call_id);
410075
410400
  if (messageType === "client_tool_start" && toolCallId) {
410076
410401
  const state = getOrCreate(toolCallId);
410077
410402
  state.clientManaged = true;
410078
410403
  if (!state.name)
410079
- state.name = stringValue3(record3.tool_name) ?? null;
410404
+ state.name = stringValue4(record3.tool_name) ?? null;
410080
410405
  return;
410081
410406
  }
410082
410407
  if (messageType === "client_tool_end" && toolCallId) {
@@ -411663,7 +411988,7 @@ var init_gateway_supervisor = __esm(() => {
411663
411988
 
411664
411989
  // src/cli/subcommands/listen.tsx
411665
411990
  import { hostname as hostname4 } from "node:os";
411666
- import { parseArgs as parseArgs8 } from "node:util";
411991
+ import { parseArgs as parseArgs9 } from "node:util";
411667
411992
  import { MessageChannel as MessageChannel2 } from "node:worker_threads";
411668
411993
  function PromptEnvName(props) {
411669
411994
  const [value, setValue] = import_react33.useState("");
@@ -411776,7 +412101,7 @@ function printListenUsage() {
411776
412101
  async function runListenSubcommand(argv) {
411777
412102
  let values3;
411778
412103
  try {
411779
- ({ values: values3 } = parseArgs8({
412104
+ ({ values: values3 } = parseArgs9({
411780
412105
  args: argv,
411781
412106
  options: LISTEN_OPTIONS,
411782
412107
  strict: true,
@@ -412684,15 +413009,15 @@ var init_transcript_migration = __esm(() => {
412684
413009
  });
412685
413010
 
412686
413011
  // src/cli/subcommands/local-backend.ts
412687
- import { parseArgs as parseArgs9 } from "node:util";
413012
+ import { parseArgs as parseArgs10 } from "node:util";
412688
413013
  function parseLocalBackendArgs(argv) {
412689
- return parseArgs9({
413014
+ return parseArgs10({
412690
413015
  args: argv,
412691
413016
  options: LOCAL_BACKEND_OPTIONS,
412692
413017
  strict: true
412693
413018
  });
412694
413019
  }
412695
- function printUsage7() {
413020
+ function printUsage8() {
412696
413021
  console.log(`
412697
413022
  Usage:
412698
413023
  letta local-backend migrate-transcripts [--storage-dir <path>] [--dry-run]
@@ -412705,12 +413030,12 @@ before it is replaced.
412705
413030
  async function runLocalBackendSubcommand(argv) {
412706
413031
  const [command, ...rest4] = argv;
412707
413032
  if (!command || command === "help" || command === "--help" || command === "-h") {
412708
- printUsage7();
413033
+ printUsage8();
412709
413034
  return command ? 0 : 1;
412710
413035
  }
412711
413036
  if (command !== "migrate-transcripts") {
412712
413037
  console.error(`Unknown local-backend command: ${command}`);
412713
- printUsage7();
413038
+ printUsage8();
412714
413039
  return 1;
412715
413040
  }
412716
413041
  let parsed;
@@ -412719,11 +413044,11 @@ async function runLocalBackendSubcommand(argv) {
412719
413044
  } catch (error4) {
412720
413045
  const message = error4 instanceof Error ? error4.message : String(error4);
412721
413046
  console.error(`Error: ${message}`);
412722
- printUsage7();
413047
+ printUsage8();
412723
413048
  return 1;
412724
413049
  }
412725
413050
  if (parsed.values.help) {
412726
- printUsage7();
413051
+ printUsage8();
412727
413052
  return 0;
412728
413053
  }
412729
413054
  const storageDir = parsed.values["storage-dir"] ?? getLocalBackendStorageDir();
@@ -412771,7 +413096,7 @@ function printText(total, files, top, quiet) {
412771
413096
  console.log(` ${formatNumber(row.tokens).padStart(8)} ${row.path}`);
412772
413097
  }
412773
413098
  }
412774
- function printJson(total, files) {
413099
+ function printJson2(total, files) {
412775
413100
  console.log(JSON.stringify({
412776
413101
  total_tokens: total,
412777
413102
  files
@@ -412812,7 +413137,7 @@ async function runMemoryTokensAction(options) {
412812
413137
  }
412813
413138
  const { total, files } = estimate;
412814
413139
  if (format5 === "json") {
412815
- printJson(total, files);
413140
+ printJson2(total, files);
412816
413141
  } else {
412817
413142
  printText(total, files, top, options.quiet);
412818
413143
  }
@@ -412827,8 +413152,8 @@ var init_memory_tokens = __esm(() => {
412827
413152
  import { cpSync, existsSync as existsSync55, mkdirSync as mkdirSync39, rmSync as rmSync12, statSync as statSync19 } from "node:fs";
412828
413153
  import { readdir as readdir13 } from "node:fs/promises";
412829
413154
  import { dirname as dirname32, join as join72 } from "node:path";
412830
- import { parseArgs as parseArgs10 } from "node:util";
412831
- function printUsage8() {
413155
+ import { parseArgs as parseArgs11 } from "node:util";
413156
+ function printUsage9() {
412832
413157
  console.log(`
412833
413158
  Usage:
412834
413159
  letta memory status [--agent <id>]
@@ -412861,7 +413186,7 @@ function getAgentId3(agentFromArgs, agentIdFromArgs) {
412861
413186
  return agentFromArgs || agentIdFromArgs || process.env.LETTA_AGENT_ID || "";
412862
413187
  }
412863
413188
  function parseMemoryArgs(argv) {
412864
- return parseArgs10({
413189
+ return parseArgs11({
412865
413190
  args: argv,
412866
413191
  options: MEMORY_OPTIONS,
412867
413192
  strict: true,
@@ -412922,12 +413247,12 @@ async function runMemorySubcommand(argv) {
412922
413247
  } catch (error4) {
412923
413248
  const message = error4 instanceof Error ? error4.message : String(error4);
412924
413249
  console.error(`Error: ${message}`);
412925
- printUsage8();
413250
+ printUsage9();
412926
413251
  return 1;
412927
413252
  }
412928
413253
  const [action3] = parsed.positionals;
412929
413254
  if (parsed.values.help || !action3 || action3 === "help") {
412930
- printUsage8();
413255
+ printUsage9();
412931
413256
  return 0;
412932
413257
  }
412933
413258
  const agentId = getAgentId3(parsed.values.agent, parsed.values["agent-id"]);
@@ -413070,7 +413395,7 @@ async function runMemorySubcommand(argv) {
413070
413395
  return 1;
413071
413396
  }
413072
413397
  console.error(`Unknown action: ${action3}`);
413073
- printUsage8();
413398
+ printUsage9();
413074
413399
  return 1;
413075
413400
  }
413076
413401
  var MEMORY_OPTIONS;
@@ -413429,8 +413754,8 @@ var init_message_search = __esm(() => {
413429
413754
  // src/cli/subcommands/messages.ts
413430
413755
  import { writeFile as writeFile17 } from "node:fs/promises";
413431
413756
  import { resolve as resolve35 } from "node:path";
413432
- import { parseArgs as parseArgs11 } from "node:util";
413433
- function printUsage9() {
413757
+ import { parseArgs as parseArgs12 } from "node:util";
413758
+ function printUsage10() {
413434
413759
  console.log(`
413435
413760
  Usage:
413436
413761
  letta messages search --query <text> [options]
@@ -413515,7 +413840,7 @@ function pageItems4(page) {
413515
413840
  return [];
413516
413841
  }
413517
413842
  function parseMessagesArgs(argv) {
413518
- return parseArgs11({
413843
+ return parseArgs12({
413519
413844
  args: argv,
413520
413845
  options: MESSAGES_OPTIONS,
413521
413846
  strict: true,
@@ -413529,12 +413854,12 @@ async function runMessagesSubcommand(argv, deps = {}) {
413529
413854
  } catch (error4) {
413530
413855
  const message = error4 instanceof Error ? error4.message : String(error4);
413531
413856
  console.error(`Error: ${message}`);
413532
- printUsage9();
413857
+ printUsage10();
413533
413858
  return 1;
413534
413859
  }
413535
413860
  const [action3] = parsed.positionals;
413536
413861
  if (parsed.values.help || !action3 || action3 === "help") {
413537
- printUsage9();
413862
+ printUsage10();
413538
413863
  return 0;
413539
413864
  }
413540
413865
  try {
@@ -413776,7 +414101,7 @@ async function runMessagesSubcommand(argv, deps = {}) {
413776
414101
  return 1;
413777
414102
  }
413778
414103
  console.error(`Unknown action: ${action3}`);
413779
- printUsage9();
414104
+ printUsage10();
413780
414105
  return 1;
413781
414106
  }
413782
414107
  var MESSAGES_OPTIONS;
@@ -414806,8 +415131,8 @@ var init_package_scaffolder = __esm(() => {
414806
415131
 
414807
415132
  // src/cli/subcommands/mods.ts
414808
415133
  import { dirname as dirname33, join as join74 } from "node:path";
414809
- import { parseArgs as parseArgs12 } from "node:util";
414810
- function printUsage10() {
415134
+ import { parseArgs as parseArgs13 } from "node:util";
415135
+ function printUsage11() {
414811
415136
  console.log(`
414812
415137
  Usage:
414813
415138
  letta mods list [--agent <id>]
@@ -414824,7 +415149,7 @@ Options:
414824
415149
  `.trim());
414825
415150
  }
414826
415151
  function parseModsArgs(argv) {
414827
- return parseArgs12({
415152
+ return parseArgs13({
414828
415153
  args: argv,
414829
415154
  options: MODS_OPTIONS,
414830
415155
  strict: true,
@@ -414832,7 +415157,7 @@ function parseModsArgs(argv) {
414832
415157
  });
414833
415158
  }
414834
415159
  function parseModsPackageArgs(argv) {
414835
- return parseArgs12({
415160
+ return parseArgs13({
414836
415161
  args: argv,
414837
415162
  options: MODS_PACKAGE_OPTIONS,
414838
415163
  strict: true,
@@ -414930,16 +415255,16 @@ async function runList(argv, options = {}) {
414930
415255
  parsed = parseModsArgs(argv);
414931
415256
  } catch (error4) {
414932
415257
  console.error(`Error: ${error4 instanceof Error ? error4.message : String(error4)}`);
414933
- printUsage10();
415258
+ printUsage11();
414934
415259
  return 1;
414935
415260
  }
414936
415261
  if (parsed.values.help) {
414937
- printUsage10();
415262
+ printUsage11();
414938
415263
  return 0;
414939
415264
  }
414940
415265
  if (parsed.positionals.length > 0) {
414941
415266
  console.error(`Unexpected argument: ${parsed.positionals[0]}`);
414942
- printUsage10();
415267
+ printUsage11();
414943
415268
  return 1;
414944
415269
  }
414945
415270
  const agentId = getExplicitAgentId(parsed.values);
@@ -414956,27 +415281,27 @@ async function runPackageMutation(action3, argv, options = {}) {
414956
415281
  parsed = parseModsArgs(argv);
414957
415282
  } catch (error4) {
414958
415283
  console.error(`Error: ${error4 instanceof Error ? error4.message : String(error4)}`);
414959
- printUsage10();
415284
+ printUsage11();
414960
415285
  return 1;
414961
415286
  }
414962
415287
  if (parsed.values.help) {
414963
- printUsage10();
415288
+ printUsage11();
414964
415289
  return 0;
414965
415290
  }
414966
415291
  if (getExplicitAgentId(parsed.values)) {
414967
415292
  console.error(`--agent is only supported for 'letta mods list'.`);
414968
- printUsage10();
415293
+ printUsage11();
414969
415294
  return 1;
414970
415295
  }
414971
415296
  const [specifier, extra] = parsed.positionals;
414972
415297
  if (!specifier) {
414973
415298
  console.error(`Missing package specifier.`);
414974
- printUsage10();
415299
+ printUsage11();
414975
415300
  return 1;
414976
415301
  }
414977
415302
  if (extra) {
414978
415303
  console.error(`Unexpected argument: ${extra}`);
414979
- printUsage10();
415304
+ printUsage11();
414980
415305
  return 1;
414981
415306
  }
414982
415307
  try {
@@ -415002,27 +415327,27 @@ async function runPackageUpdate(argv, options = {}) {
415002
415327
  parsed = parseModsArgs(argv);
415003
415328
  } catch (error4) {
415004
415329
  console.error(`Error: ${error4 instanceof Error ? error4.message : String(error4)}`);
415005
- printUsage10();
415330
+ printUsage11();
415006
415331
  return 1;
415007
415332
  }
415008
415333
  if (parsed.values.help) {
415009
- printUsage10();
415334
+ printUsage11();
415010
415335
  return 0;
415011
415336
  }
415012
415337
  if (getExplicitAgentId(parsed.values)) {
415013
415338
  console.error(`--agent is not supported for 'letta mods update'.`);
415014
- printUsage10();
415339
+ printUsage11();
415015
415340
  return 1;
415016
415341
  }
415017
415342
  const [specifier, extra] = parsed.positionals;
415018
415343
  if (!specifier) {
415019
415344
  console.error(`Missing package specifier.`);
415020
- printUsage10();
415345
+ printUsage11();
415021
415346
  return 1;
415022
415347
  }
415023
415348
  if (extra) {
415024
415349
  console.error(`Unexpected argument: ${extra}`);
415025
- printUsage10();
415350
+ printUsage11();
415026
415351
  return 1;
415027
415352
  }
415028
415353
  try {
@@ -415044,33 +415369,33 @@ async function runPackageScaffold(argv) {
415044
415369
  parsed = parseModsPackageArgs(argv);
415045
415370
  } catch (error4) {
415046
415371
  console.error(`Error: ${error4 instanceof Error ? error4.message : String(error4)}`);
415047
- printUsage10();
415372
+ printUsage11();
415048
415373
  return 1;
415049
415374
  }
415050
415375
  if (parsed.values.help) {
415051
- printUsage10();
415376
+ printUsage11();
415052
415377
  return 0;
415053
415378
  }
415054
415379
  if (getExplicitAgentId(parsed.values)) {
415055
415380
  console.error(`--agent is not supported for 'letta mods package'.`);
415056
- printUsage10();
415381
+ printUsage11();
415057
415382
  return 1;
415058
415383
  }
415059
415384
  const [sourceFile, extra] = parsed.positionals;
415060
415385
  if (!sourceFile) {
415061
415386
  console.error(`Missing mod file.`);
415062
- printUsage10();
415387
+ printUsage11();
415063
415388
  return 1;
415064
415389
  }
415065
415390
  if (extra) {
415066
415391
  console.error(`Unexpected argument: ${extra}`);
415067
- printUsage10();
415392
+ printUsage11();
415068
415393
  return 1;
415069
415394
  }
415070
415395
  const packageName = parsed.values.name;
415071
415396
  if (typeof packageName !== "string" || !packageName.trim()) {
415072
415397
  console.error(`Missing required --name <package-name>.`);
415073
- printUsage10();
415398
+ printUsage11();
415074
415399
  return 1;
415075
415400
  }
415076
415401
  try {
@@ -415092,7 +415417,7 @@ async function runPackageScaffold(argv) {
415092
415417
  async function runModsSubcommand(argv, options = {}) {
415093
415418
  const [action3, ...rest4] = argv;
415094
415419
  if (!action3 || action3 === "help" || action3 === "--help" || action3 === "-h") {
415095
- printUsage10();
415420
+ printUsage11();
415096
415421
  return 0;
415097
415422
  }
415098
415423
  switch (action3) {
@@ -415108,7 +415433,7 @@ async function runModsSubcommand(argv, options = {}) {
415108
415433
  return runPackageMutation(action3, rest4, options);
415109
415434
  default:
415110
415435
  console.error(`Unknown mods action: ${action3}`);
415111
- printUsage10();
415436
+ printUsage11();
415112
415437
  return 1;
415113
415438
  }
415114
415439
  }
@@ -415188,8 +415513,8 @@ var init_sandbox_files = __esm(() => {
415188
415513
  // src/cli/subcommands/sandbox.ts
415189
415514
  import { readFile as readFile25, stat as stat17, writeFile as writeFile18 } from "node:fs/promises";
415190
415515
  import { basename as basename26, resolve as resolve36 } from "node:path";
415191
- import { parseArgs as parseArgs13 } from "node:util";
415192
- function printUsage11() {
415516
+ import { parseArgs as parseArgs14 } from "node:util";
415517
+ function printUsage12() {
415193
415518
  console.log(`
415194
415519
  Usage:
415195
415520
  letta sandbox upload <local-path>
@@ -415203,7 +415528,7 @@ Notes:
415203
415528
  `.trim());
415204
415529
  }
415205
415530
  function parseSandboxArgs(argv) {
415206
- return parseArgs13({
415531
+ return parseArgs14({
415207
415532
  args: argv,
415208
415533
  options: SANDBOX_OPTIONS,
415209
415534
  strict: true,
@@ -415243,17 +415568,17 @@ async function runSandboxSubcommand(argv, deps = {}) {
415243
415568
  parsed = parseSandboxArgs(argv);
415244
415569
  } catch (error4) {
415245
415570
  console.error(`Error: ${error4 instanceof Error ? error4.message : error4}`);
415246
- printUsage11();
415571
+ printUsage12();
415247
415572
  return 1;
415248
415573
  }
415249
415574
  const [action3, path48] = parsed.positionals;
415250
415575
  if (parsed.values.help || !action3 || action3 === "help") {
415251
- printUsage11();
415576
+ printUsage12();
415252
415577
  return 0;
415253
415578
  }
415254
415579
  if (action3 !== "upload" && action3 !== "download" || !path48) {
415255
415580
  console.error("Error: expected upload or download with a file path");
415256
- printUsage11();
415581
+ printUsage12();
415257
415582
  return 1;
415258
415583
  }
415259
415584
  try {
@@ -415297,8 +415622,8 @@ var init_sandbox2 = __esm(() => {
415297
415622
  });
415298
415623
 
415299
415624
  // src/cli/subcommands/secret.ts
415300
- import { parseArgs as parseArgs14 } from "node:util";
415301
- function printUsage12() {
415625
+ import { parseArgs as parseArgs15 } from "node:util";
415626
+ function printUsage13() {
415302
415627
  console.log(`
415303
415628
  Usage:
415304
415629
  letta secret set KEY --env SOURCE_VAR Set KEY from environment variable SOURCE_VAR
@@ -415323,7 +415648,7 @@ Notes:
415323
415648
  `.trim());
415324
415649
  }
415325
415650
  function parseSecretArgs(argv) {
415326
- return parseArgs14({
415651
+ return parseArgs15({
415327
415652
  args: argv,
415328
415653
  options: SECRET_OPTIONS,
415329
415654
  strict: true,
@@ -415358,11 +415683,11 @@ async function runSecretSubcommand(argv, deps = {}) {
415358
415683
  parsed = parseSecretArgs(argv);
415359
415684
  } catch (error4) {
415360
415685
  printError(error4);
415361
- printUsage12();
415686
+ printUsage13();
415362
415687
  return 1;
415363
415688
  }
415364
415689
  if (parsed.values.help || parsed.positionals.length === 0) {
415365
- printUsage12();
415690
+ printUsage13();
415366
415691
  return parsed.values.help ? 0 : 1;
415367
415692
  }
415368
415693
  const [verb, rawKey, rawValue] = parsed.positionals;
@@ -415372,7 +415697,7 @@ async function runSecretSubcommand(argv, deps = {}) {
415372
415697
  }
415373
415698
  switch (verb) {
415374
415699
  case "help": {
415375
- printUsage12();
415700
+ printUsage13();
415376
415701
  return 0;
415377
415702
  }
415378
415703
  case "list": {
@@ -415480,7 +415805,7 @@ async function runSecretSubcommand(argv, deps = {}) {
415480
415805
  }
415481
415806
  default: {
415482
415807
  console.error(`Unknown subcommand '${verb ?? ""}'.`);
415483
- printUsage12();
415808
+ printUsage13();
415484
415809
  return 1;
415485
415810
  }
415486
415811
  }
@@ -415498,7 +415823,7 @@ var init_secret = __esm(() => {
415498
415823
  });
415499
415824
 
415500
415825
  // src/cli/subcommands/app-server.ts
415501
- import { parseArgs as parseArgs15 } from "node:util";
415826
+ import { parseArgs as parseArgs16 } from "node:util";
415502
415827
  function printAppServerHelp() {
415503
415828
  console.log(`Usage: letta server --listen [url]
415504
415829
 
@@ -415546,7 +415871,7 @@ Stopped App Server (${signal}).`);
415546
415871
  async function runAppServerSubcommand(argv) {
415547
415872
  let parsed;
415548
415873
  try {
415549
- parsed = parseArgs15({
415874
+ parsed = parseArgs16({
415550
415875
  args: argv,
415551
415876
  allowPositionals: false,
415552
415877
  options: {
@@ -415713,330 +416038,6 @@ var init_server = __esm(async () => {
415713
416038
  ]);
415714
416039
  });
415715
416040
 
415716
- // src/backend/api/mcp-servers.ts
415717
- function getString2(record3, key2) {
415718
- const value = record3[key2];
415719
- return typeof value === "string" ? value : null;
415720
- }
415721
- function parseAgentConnectedMcpServer(value) {
415722
- if (!isRecord(value)) {
415723
- return null;
415724
- }
415725
- const id2 = getString2(value, "id");
415726
- const serverName = getString2(value, "server_name");
415727
- const serverType = getString2(value, "mcp_server_type");
415728
- if (!id2 || !serverName || !serverType) {
415729
- return null;
415730
- }
415731
- const target2 = getString2(value, "server_url") ?? [
415732
- getString2(value, "command"),
415733
- ...Array.isArray(value.args) ? value.args : []
415734
- ].filter((item) => typeof item === "string").join(" ");
415735
- return { id: id2, serverName, serverType, target: target2 };
415736
- }
415737
- function parseAgentConnectedMcpTool(value) {
415738
- if (!isRecord(value)) {
415739
- return null;
415740
- }
415741
- const id2 = getString2(value, "id");
415742
- const name = getString2(value, "name");
415743
- if (!id2 || !name) {
415744
- return null;
415745
- }
415746
- const description = getString2(value, "description");
415747
- return { id: id2, name, description };
415748
- }
415749
- function parseAgentMcpToolRunResult(value) {
415750
- if (!isRecord(value)) {
415751
- throw new Error("MCP tool run returned an invalid response");
415752
- }
415753
- const status = getString2(value, "status") ?? "unknown";
415754
- return {
415755
- status,
415756
- funcReturn: value.func_return,
415757
- stdout: value.stdout,
415758
- stderr: value.stderr
415759
- };
415760
- }
415761
- function withTimeout2(promise, timeoutMs, label) {
415762
- let timer;
415763
- const timeout = new Promise((_4, reject2) => {
415764
- timer = setTimeout(() => reject2(new Error(`${label} timed out after ${timeoutMs}ms`)), timeoutMs);
415765
- });
415766
- return Promise.race([promise, timeout]).finally(() => {
415767
- if (timer !== undefined)
415768
- clearTimeout(timer);
415769
- });
415770
- }
415771
- function listServerMcpServers(client, timeoutMs = 1e4) {
415772
- return withTimeout2(client.mcpServers.list(), timeoutMs, "Listing server-side MCP servers");
415773
- }
415774
- async function listAgentConnectedMcpServers(client, agentId, timeoutMs = 1e4) {
415775
- const result2 = await withTimeout2(client.get(`/v1/agents/${encodeURIComponent(agentId)}/mcp-servers`), timeoutMs, "Listing agent-connected MCP servers");
415776
- if (!Array.isArray(result2)) {
415777
- return [];
415778
- }
415779
- return result2.map(parseAgentConnectedMcpServer).filter((server2) => server2 !== null);
415780
- }
415781
- async function listAgentConnectedMcpTools(client, agentId, mcpServerId, timeoutMs = 1e4) {
415782
- const result2 = await withTimeout2(client.get(`/v1/agents/${encodeURIComponent(agentId)}/mcp-servers/${encodeURIComponent(mcpServerId)}/tools`), timeoutMs, "Listing agent-connected MCP server tools");
415783
- if (!Array.isArray(result2)) {
415784
- return [];
415785
- }
415786
- return result2.map(parseAgentConnectedMcpTool).filter((tool) => tool !== null);
415787
- }
415788
- async function runAgentConnectedMcpTool(params) {
415789
- const result2 = await withTimeout2(params.client.post(`/v1/agents/${encodeURIComponent(params.agentId)}/mcp-servers/${encodeURIComponent(params.mcpServerId)}/tools/${encodeURIComponent(params.toolId)}/run`, { args: params.args }), params.timeoutMs ?? 60000, "Running agent-connected MCP tool");
415790
- return parseAgentMcpToolRunResult(result2);
415791
- }
415792
- async function listLiveServerMcpTools(client, serverName, timeoutMs = 15000) {
415793
- const result2 = await withTimeout2(client.get(`/v1/tools/mcp/servers/${encodeURIComponent(serverName)}/tools`), timeoutMs, `Listing tools for MCP server "${serverName}"`);
415794
- if (!Array.isArray(result2))
415795
- return [];
415796
- return result2.filter((tool) => typeof tool === "object" && tool !== null && typeof tool.name === "string");
415797
- }
415798
- async function loadServerMcpEntries(client, timeoutMs = 15000) {
415799
- const servers = await listServerMcpServers(client, timeoutMs);
415800
- return Promise.all(servers.map(async (server2) => {
415801
- try {
415802
- const tools = await listLiveServerMcpTools(client, server2.server_name, timeoutMs);
415803
- return { server: server2, tools };
415804
- } catch (cause) {
415805
- return {
415806
- server: server2,
415807
- tools: [],
415808
- toolsError: cause instanceof Error ? cause.message : String(cause)
415809
- };
415810
- }
415811
- }));
415812
- }
415813
- function parseMcpMetadata(tool) {
415814
- const metadata = tool.metadata_;
415815
- const mcp = metadata?.mcp;
415816
- if (typeof mcp !== "object" || mcp === null)
415817
- return null;
415818
- const { server_id, server_name } = mcp;
415819
- return {
415820
- ...typeof server_id === "string" && { serverId: server_id },
415821
- ...typeof server_name === "string" && { serverName: server_name }
415822
- };
415823
- }
415824
- async function listAgentMcpAttachments(client, agentId) {
415825
- const attachments = [];
415826
- for await (const tool of client.agents.tools.list(agentId, { limit: 100 })) {
415827
- if (tool.tool_type !== "external_mcp" || !tool.id || !tool.name)
415828
- continue;
415829
- attachments.push({
415830
- toolId: tool.id,
415831
- toolName: tool.name,
415832
- ...parseMcpMetadata(tool)
415833
- });
415834
- }
415835
- return attachments;
415836
- }
415837
- function attachmentsForEntry(entry, attachments) {
415838
- return attachments.filter((attachment) => attachment.serverId && entry.server.id ? attachment.serverId === entry.server.id : attachment.serverName === entry.server.server_name);
415839
- }
415840
- function attachedToolNamesForEntry(entry, attachments) {
415841
- return new Set(attachmentsForEntry(entry, attachments).map((attachment) => attachment.toolName));
415842
- }
415843
- async function registerServerMcpTool(client, serverName, toolName) {
415844
- const result2 = await client.post(`/v1/tools/mcp/servers/${encodeURIComponent(serverName)}/${encodeURIComponent(toolName)}`);
415845
- if (typeof result2?.id !== "string") {
415846
- throw new Error(`Registering MCP tool "${toolName}" on server "${serverName}" returned no tool id`);
415847
- }
415848
- return { id: result2.id };
415849
- }
415850
- async function attachServerMcpTools(client, agentId, serverName, toolNames) {
415851
- await Promise.all(toolNames.map(async (toolName) => {
415852
- const { id: id2 } = await registerServerMcpTool(client, serverName, toolName);
415853
- await client.agents.tools.attach(id2, { agent_id: agentId });
415854
- }));
415855
- }
415856
- async function detachServerMcpTools(client, agentId, toolIds) {
415857
- await Promise.all(toolIds.map((toolId) => client.agents.tools.detach(toolId, { agent_id: agentId })));
415858
- }
415859
- function refreshServerMcpServer(client, mcpServerId, agentId) {
415860
- return client.mcpServers.refresh(mcpServerId, { agent_id: agentId });
415861
- }
415862
- function planServerMcpToggle(entry, attachments) {
415863
- const attached = attachmentsForEntry(entry, attachments);
415864
- if (attached.length > 0) {
415865
- return {
415866
- action: "detach",
415867
- toolIds: attached.map((attachment) => attachment.toolId)
415868
- };
415869
- }
415870
- return { action: "attach", toolNames: entry.tools.map((tool) => tool.name) };
415871
- }
415872
- function describeServerMcpTarget(server2) {
415873
- if ("server_url" in server2 && server2.server_url) {
415874
- return server2.server_url;
415875
- }
415876
- if ("command" in server2 && server2.command) {
415877
- return [server2.command, ...server2.args ?? []].join(" ");
415878
- }
415879
- return "";
415880
- }
415881
- var init_mcp_servers2 = () => {};
415882
-
415883
- // src/cli/subcommands/server-mcp.ts
415884
- import { parseArgs as parseArgs16 } from "node:util";
415885
- function printUsage13(stdout = console.log) {
415886
- stdout(`
415887
- Usage:
415888
- letta server-mcp list [--agent <id>]
415889
- letta server-mcp tools <mcp-server-id> [--agent <id>]
415890
- letta server-mcp run <mcp-server-id> <tool-id> [--args '<json>'] [--agent <id>]
415891
-
415892
- Actions:
415893
- list List MCP servers connected to the agent
415894
- tools List registered tools for one connected MCP server
415895
- run Run one registered MCP tool through the agent-scoped server route
415896
-
415897
- Aliases:
415898
- list-servers, list_servers Alias for list
415899
- list-tools, list_tools Alias for tools
415900
- call, run-tool, run_tool Alias for run
415901
-
415902
- Options:
415903
- --agent <id> Agent ID. Defaults to LETTA_AGENT_ID or AGENT_ID
415904
- --agent-id <id> Alias for --agent
415905
- --args '<json>' JSON object passed as MCP tool arguments for run
415906
- -h, --help Show this help
415907
-
415908
- Notes:
415909
- - Output is JSON only.
415910
- - Requires a signed-in Letta Cloud agent with server-side MCP support.
415911
- - Uses CLI auth; override with LETTA_API_KEY/LETTA_BASE_URL if needed.
415912
- `.trim());
415913
- }
415914
- function parseServerMcpArgs(argv) {
415915
- return parseArgs16({
415916
- args: argv,
415917
- options: {
415918
- help: { type: "boolean", short: "h" },
415919
- agent: { type: "string" },
415920
- "agent-id": { type: "string" },
415921
- args: { type: "string" }
415922
- },
415923
- strict: true,
415924
- allowPositionals: true
415925
- });
415926
- }
415927
- function stringValue4(value) {
415928
- return typeof value === "string" ? value : undefined;
415929
- }
415930
- function resolveServerMcpAgentId(agent, agentId, env4 = process.env) {
415931
- return (agent || agentId || env4.LETTA_AGENT_ID || env4.AGENT_ID || "").trim();
415932
- }
415933
- function parseToolArgs2(value) {
415934
- const raw2 = stringValue4(value);
415935
- if (!raw2) {
415936
- return {};
415937
- }
415938
- let parsed;
415939
- try {
415940
- parsed = JSON.parse(raw2);
415941
- } catch (error4) {
415942
- const message = error4 instanceof Error ? error4.message : String(error4);
415943
- throw new Error(`Invalid --args JSON: ${message}`);
415944
- }
415945
- if (!isRecord(parsed)) {
415946
- throw new Error("Invalid --args JSON: expected a JSON object");
415947
- }
415948
- return parsed;
415949
- }
415950
- function printJson2(stdout, result2) {
415951
- stdout(JSON.stringify(result2, null, 2));
415952
- }
415953
- async function defaultGetClient() {
415954
- const client = await getClient();
415955
- return client;
415956
- }
415957
- async function runServerMcpSubcommand(argv, deps = {}) {
415958
- const stdout = deps.stdout ?? console.log;
415959
- const stderr = deps.stderr ?? console.error;
415960
- let parsed;
415961
- try {
415962
- parsed = parseServerMcpArgs(argv);
415963
- } catch (error4) {
415964
- const message = error4 instanceof Error ? error4.message : String(error4);
415965
- stderr(`Error: ${message}`);
415966
- printUsage13(stdout);
415967
- return 1;
415968
- }
415969
- const [action3, mcpServerId, toolId] = parsed.positionals;
415970
- if (parsed.values.help || !action3 || action3 === "help") {
415971
- printUsage13(stdout);
415972
- return 0;
415973
- }
415974
- const isAvailable = deps.isServerSideMcpAvailable ?? (() => getBackend().capabilities.serverSideToolManagement);
415975
- if (!isAvailable()) {
415976
- stderr("Server-side MCP requires a signed-in Letta Cloud agent; the local backend does not support it.");
415977
- return 1;
415978
- }
415979
- const agentId = resolveServerMcpAgentId(stringValue4(parsed.values.agent), stringValue4(parsed.values["agent-id"]));
415980
- if (!agentId) {
415981
- stderr("Agent id required: pass --agent <id> or set LETTA_AGENT_ID/AGENT_ID.");
415982
- return 1;
415983
- }
415984
- await (deps.initializeSettings ?? (() => settingsManager.initialize()))();
415985
- const client = await (deps.getClient ?? defaultGetClient)();
415986
- try {
415987
- if (action3 === "list" || action3 === "list-servers" || action3 === "list_servers") {
415988
- printJson2(stdout, {
415989
- agent_id: agentId,
415990
- servers: await listAgentConnectedMcpServers(client, agentId)
415991
- });
415992
- return 0;
415993
- }
415994
- if (action3 === "tools" || action3 === "list-tools" || action3 === "list_tools") {
415995
- if (!mcpServerId) {
415996
- stderr("Usage: letta server-mcp tools <mcp-server-id> [--agent <id>]");
415997
- return 1;
415998
- }
415999
- printJson2(stdout, {
416000
- agent_id: agentId,
416001
- mcp_server_id: mcpServerId,
416002
- tools: await listAgentConnectedMcpTools(client, agentId, mcpServerId)
416003
- });
416004
- return 0;
416005
- }
416006
- if (action3 === "run" || action3 === "call" || action3 === "run-tool" || action3 === "run_tool") {
416007
- if (!mcpServerId || !toolId) {
416008
- stderr("Usage: letta server-mcp run <mcp-server-id> <tool-id> [--args '<json>'] [--agent <id>]");
416009
- return 1;
416010
- }
416011
- printJson2(stdout, {
416012
- agent_id: agentId,
416013
- mcp_server_id: mcpServerId,
416014
- tool_id: toolId,
416015
- result: await runAgentConnectedMcpTool({
416016
- client,
416017
- agentId,
416018
- mcpServerId,
416019
- toolId,
416020
- args: parseToolArgs2(parsed.values.args)
416021
- })
416022
- });
416023
- return 0;
416024
- }
416025
- stderr(`Unknown server-mcp action: ${action3}`);
416026
- printUsage13(stdout);
416027
- return 1;
416028
- } catch (error4) {
416029
- stderr(error4 instanceof Error ? error4.message : String(error4));
416030
- return 1;
416031
- }
416032
- }
416033
- var init_server_mcp = __esm(() => {
416034
- init_backend2();
416035
- init_client2();
416036
- init_mcp_servers2();
416037
- init_settings_manager();
416038
- });
416039
-
416040
416041
  // src/auth/LettaLoginView.tsx
416041
416042
  import { hostname as hostname5 } from "node:os";
416042
416043
  async function completeLettaLogin(tokens, options) {
@@ -424808,7 +424809,7 @@ function subcommandNeedsEarlyBackendMode(command) {
424808
424809
  case "sandbox":
424809
424810
  case "secret":
424810
424811
  case "server":
424811
- case "server-mcp":
424812
+ case "cloud-mcp":
424812
424813
  case "shared-memory":
424813
424814
  case "skills":
424814
424815
  case "teleport":
@@ -424851,8 +424852,8 @@ async function runSubcommand(argv) {
424851
424852
  return runTeleportSubcommand(rest4);
424852
424853
  case "server":
424853
424854
  return runServerSubcommand(rest4);
424854
- case "server-mcp":
424855
- return runServerMcpSubcommand(rest4);
424855
+ case "cloud-mcp":
424856
+ return runCloudMcpSubcommand(rest4);
424856
424857
  case "remote":
424857
424858
  return runListenSubcommand(rest4);
424858
424859
  case "connect":
@@ -424890,6 +424891,7 @@ var init_router = __esm(async () => {
424890
424891
  init_agents6();
424891
424892
  init_backend3();
424892
424893
  init_channels();
424894
+ init_cloud_mcp();
424893
424895
  init_connect();
424894
424896
  init_dream();
424895
424897
  init_environments3();
@@ -424898,7 +424900,6 @@ var init_router = __esm(async () => {
424898
424900
  init_messages10();
424899
424901
  init_sandbox2();
424900
424902
  init_secret();
424901
- init_server_mcp();
424902
424903
  init_shared_memory();
424903
424904
  init_skills4();
424904
424905
  init_teleport2();
@@ -442858,7 +442859,7 @@ var init_mcp_client = __esm(() => {
442858
442859
  init_streamableHttp();
442859
442860
  DEFAULT_CLIENT_INFO = {
442860
442861
  name: "letta-code",
442861
- version: "0.31.2"
442862
+ version: "0.31.3"
442862
442863
  };
442863
442864
  });
442864
442865
 
@@ -506038,7 +506039,7 @@ USAGE
506038
506039
  letta mods ... List and manage local mods
506039
506040
  letta sandbox ... Transfer files to or from the current Cloud sandbox
506040
506041
  letta server ... Run a remote environment, channels, or the App Server
506041
- letta server-mcp ... Use MCP servers connected to an agent
506042
+ letta cloud-mcp ... Use MCP servers connected to an agent
506042
506043
  letta connect ... Connect providers from terminal
506043
506044
  letta backend ... Show or set the default backend
506044
506045
  letta setup Re-run first-run setup
@@ -506070,7 +506071,7 @@ SUBCOMMANDS
506070
506071
  letta mods enable <package-spec>
506071
506072
  letta mods disable <package-spec>
506072
506073
  letta mods remove <package-spec>
506073
- letta server-mcp list|tools|run ... [--agent <id>]
506074
+ letta cloud-mcp list|tools|run ... [--agent <id>]
506074
506075
  letta server [--env-name <name> | --listen [url]] [options]
506075
506076
  letta connect <provider> [options]
506076
506077
  letta install <thing> [--agent <id> | -n <name>]
@@ -509891,4 +509892,4 @@ function registerBunOAuthFlows() {
509891
509892
  registerBunOAuthFlows();
509892
509893
  await init_src5().then(() => exports_src2);
509893
509894
 
509894
- //# debugId=48BEECE3782D14CC64756E2164756E21
509895
+ //# debugId=B393760B54BCD06F64756E2164756E21