@letta-ai/letta-code 0.30.1 → 0.30.2
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/dist/mcp-client.js +2 -2
- package/dist/mcp-client.js.map +1 -1
- package/letta.js +161 -57
- package/package.json +1 -1
package/letta.js
CHANGED
|
@@ -5462,7 +5462,7 @@ var package_default;
|
|
|
5462
5462
|
var init_package = __esm(() => {
|
|
5463
5463
|
package_default = {
|
|
5464
5464
|
name: "@letta-ai/letta-code",
|
|
5465
|
-
version: "0.30.
|
|
5465
|
+
version: "0.30.2",
|
|
5466
5466
|
description: "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
|
|
5467
5467
|
type: "module",
|
|
5468
5468
|
packageManager: "bun@1.3.0",
|
|
@@ -5796,11 +5796,14 @@ function getNodeRoutingHeader() {
|
|
|
5796
5796
|
const enabled = NODE_HEADER_ENABLED_VALUES.has(raw.trim().toLowerCase());
|
|
5797
5797
|
return { "x-letta-node": enabled ? "1" : "0" };
|
|
5798
5798
|
}
|
|
5799
|
+
function getRuntimeEnvironmentDeviceId() {
|
|
5800
|
+
return process.env[RUNTIME_ENVIRONMENT_DEVICE_ID_ENV]?.trim() || settingsManager.getOrCreateDeviceId();
|
|
5801
|
+
}
|
|
5799
5802
|
function getClientDefaultHeaders() {
|
|
5800
5803
|
return {
|
|
5801
5804
|
"X-Letta-Source": "letta-code",
|
|
5802
5805
|
"User-Agent": `letta-code/${package_default.version}`,
|
|
5803
|
-
"X-Letta-Environment-Device-Id":
|
|
5806
|
+
"X-Letta-Environment-Device-Id": getRuntimeEnvironmentDeviceId(),
|
|
5804
5807
|
...getNodeRoutingHeader(),
|
|
5805
5808
|
...process.env.LETTA_MEMFS_BACKEND === "hosted" ? { "x-letta-memfs-backend": "hosted" } : {}
|
|
5806
5809
|
};
|
|
@@ -5894,7 +5897,7 @@ If you experience this issue multiple times, move ~/.letta to ~/.letta_backup, a
|
|
|
5894
5897
|
};
|
|
5895
5898
|
return client;
|
|
5896
5899
|
}
|
|
5897
|
-
var SDK_DIAGNOSTIC_MAX_LEN = 400, SDK_DIAGNOSTIC_MAX_LINES = 4, lastSDKDiagnostic = null, _cachedApiKey, _testClientOverride = null, sdkLogger, NODE_HEADER_ENABLED_VALUES;
|
|
5900
|
+
var SDK_DIAGNOSTIC_MAX_LEN = 400, SDK_DIAGNOSTIC_MAX_LINES = 4, lastSDKDiagnostic = null, _cachedApiKey, _testClientOverride = null, sdkLogger, NODE_HEADER_ENABLED_VALUES, RUNTIME_ENVIRONMENT_DEVICE_ID_ENV = "LETTA_RUNTIME_ENVIRONMENT_DEVICE_ID";
|
|
5898
5901
|
var init_client2 = __esm(() => {
|
|
5899
5902
|
init_letta_client();
|
|
5900
5903
|
init_oauth();
|
|
@@ -437818,6 +437821,57 @@ function buildCloudScheduleInput(params) {
|
|
|
437818
437821
|
}
|
|
437819
437822
|
var CLOUD_EXECUTION_TARGET = "cloud-sandbox", SYNTHETIC_CLOUD_DEVICE_ID = "__letta_cloud__", SYNTHETIC_LOCAL_PLACEHOLDER_ID = "local", CLOUD_CRON_UTC_NOTE = "Recurring Cloud schedules currently interpret cron expressions in UTC (timezone support is tracked in LET-9815).", CLOUD_DEVICE_FALLBACK_NOTE = "If the target computer is offline when the schedule fires, execution falls back to the agent's cloud sandbox.";
|
|
437820
437823
|
|
|
437824
|
+
// src/cli/subcommands/cron-task-ref.ts
|
|
437825
|
+
async function ensureSettingsForCloud() {
|
|
437826
|
+
const { settingsManager: settingsManager2 } = await Promise.resolve().then(() => (init_settings_manager(), exports_settings_manager));
|
|
437827
|
+
await settingsManager2.initialize();
|
|
437828
|
+
}
|
|
437829
|
+
async function resolveTaskName(name, options3) {
|
|
437830
|
+
const matches2 = [];
|
|
437831
|
+
if (options3.runner !== "cloud") {
|
|
437832
|
+
for (const task2 of listTasks2()) {
|
|
437833
|
+
if (task2.name === name) {
|
|
437834
|
+
matches2.push({ id: task2.id, store: "local" });
|
|
437835
|
+
}
|
|
437836
|
+
}
|
|
437837
|
+
}
|
|
437838
|
+
if (options3.runner !== "local" && options3.agentId) {
|
|
437839
|
+
const backendMode = resolveBackendMode();
|
|
437840
|
+
const preliminary = resolveCronRunner({
|
|
437841
|
+
agentId: options3.agentId,
|
|
437842
|
+
backendMode
|
|
437843
|
+
});
|
|
437844
|
+
const cloudCandidate = !("error" in preliminary) && preliminary.runner === "cloud";
|
|
437845
|
+
if (cloudCandidate || options3.runner === "cloud") {
|
|
437846
|
+
try {
|
|
437847
|
+
await ensureSettingsForCloud();
|
|
437848
|
+
const response = await listCloudSchedules(options3.agentId);
|
|
437849
|
+
for (const schedule of response.scheduled_messages) {
|
|
437850
|
+
if (schedule.name === name) {
|
|
437851
|
+
matches2.push({ id: schedule.id, store: "cloud" });
|
|
437852
|
+
}
|
|
437853
|
+
}
|
|
437854
|
+
} catch {}
|
|
437855
|
+
}
|
|
437856
|
+
}
|
|
437857
|
+
if (matches2.length === 0)
|
|
437858
|
+
return null;
|
|
437859
|
+
if (matches2.length === 1)
|
|
437860
|
+
return matches2[0] ?? null;
|
|
437861
|
+
return { ambiguous: matches2 };
|
|
437862
|
+
}
|
|
437863
|
+
function printAmbiguousTaskName(name, matches2) {
|
|
437864
|
+
console.error(`Error: multiple tasks are named "${name}". Use an ID instead:`);
|
|
437865
|
+
for (const match4 of matches2) {
|
|
437866
|
+
console.error(` ${match4.id} (${match4.store})`);
|
|
437867
|
+
}
|
|
437868
|
+
}
|
|
437869
|
+
var init_cron_task_ref = __esm(async () => {
|
|
437870
|
+
init_schedules2();
|
|
437871
|
+
init_backend_mode();
|
|
437872
|
+
await init_cron();
|
|
437873
|
+
});
|
|
437874
|
+
|
|
437821
437875
|
// src/backend/api/environments.ts
|
|
437822
437876
|
var exports_environments2 = {};
|
|
437823
437877
|
__export(exports_environments2, {
|
|
@@ -437921,9 +437975,9 @@ Usage:
|
|
|
437921
437975
|
letta cron add --prompt <text> --at <time> [--once] [options]
|
|
437922
437976
|
letta cron add --prompt <text> --cron <expr> [options]
|
|
437923
437977
|
letta cron list [options]
|
|
437924
|
-
letta cron get <id> [--runner local|cloud]
|
|
437978
|
+
letta cron get <id|name> [--runner local|cloud]
|
|
437925
437979
|
letta cron runs --id <id> [--limit <n>] [--runner local|cloud]
|
|
437926
|
-
letta cron delete <id> [--runner local|cloud]
|
|
437980
|
+
letta cron delete <id|name> [--runner local|cloud] (alias: remove)
|
|
437927
437981
|
letta cron delete --all [--agent <id>] [--runner local|cloud]
|
|
437928
437982
|
|
|
437929
437983
|
Add options:
|
|
@@ -437983,10 +438037,6 @@ async function probeCloudScheduleSupport(agentId) {
|
|
|
437983
438037
|
return true;
|
|
437984
438038
|
}
|
|
437985
438039
|
}
|
|
437986
|
-
async function ensureSettingsForCloud() {
|
|
437987
|
-
const { settingsManager: settingsManager2 } = await Promise.resolve().then(() => (init_settings_manager(), exports_settings_manager));
|
|
437988
|
-
await settingsManager2.initialize();
|
|
437989
|
-
}
|
|
437990
438040
|
async function getRunnerForAgent(explicit, agentId) {
|
|
437991
438041
|
const backendMode = resolveBackendMode();
|
|
437992
438042
|
const preliminary = resolveCronRunner({ explicit, agentId, backendMode });
|
|
@@ -438252,11 +438302,13 @@ async function handleList(values2) {
|
|
|
438252
438302
|
}
|
|
438253
438303
|
}
|
|
438254
438304
|
if (includeCloud && agentId) {
|
|
438255
|
-
const resolved = await getRunnerForAgent(undefined, agentId);
|
|
438256
|
-
const cloudCapable = !("error" in resolved) && resolved.runner === "cloud";
|
|
438257
438305
|
const cloudExplicit = values2.runner === "cloud";
|
|
438258
|
-
|
|
438306
|
+
const backendMode = resolveBackendMode();
|
|
438307
|
+
const preliminary = resolveCronRunner({ agentId, backendMode });
|
|
438308
|
+
const cloudCandidate = !("error" in preliminary) && preliminary.runner === "cloud";
|
|
438309
|
+
if (cloudCandidate || cloudExplicit) {
|
|
438259
438310
|
try {
|
|
438311
|
+
await ensureSettingsForCloud();
|
|
438260
438312
|
const response = await listCloudSchedules(agentId);
|
|
438261
438313
|
for (const schedule of response.scheduled_messages) {
|
|
438262
438314
|
if (conversationId && (schedule.conversation_id ?? "default") !== conversationId) {
|
|
@@ -438265,7 +438317,11 @@ async function handleList(values2) {
|
|
|
438265
438317
|
output.push(formatCloudScheduleOutput(schedule));
|
|
438266
438318
|
}
|
|
438267
438319
|
} catch (err) {
|
|
438268
|
-
|
|
438320
|
+
if (err instanceof ApiRequestError && (err.status === 404 || err.status === 405)) {
|
|
438321
|
+
console.error("Note: Cloud schedules not listed (server does not serve the schedule routes, or this agent is not visible to the current credential).");
|
|
438322
|
+
} else {
|
|
438323
|
+
console.error(`Warning: Cloud schedules not listed: ${err instanceof Error ? err.message : String(err)}`);
|
|
438324
|
+
}
|
|
438269
438325
|
if (cloudExplicit) {
|
|
438270
438326
|
return 1;
|
|
438271
438327
|
}
|
|
@@ -438283,40 +438339,60 @@ async function handleGet(values2, positionals) {
|
|
|
438283
438339
|
console.error(`Error: invalid --runner "${values2.runner}". Expected "local" or "cloud".`);
|
|
438284
438340
|
return 1;
|
|
438285
438341
|
}
|
|
438286
|
-
const
|
|
438287
|
-
if (!
|
|
438288
|
-
console.error("Error: task ID required. Usage: letta cron get <id>");
|
|
438342
|
+
const taskRef = positionals[1];
|
|
438343
|
+
if (!taskRef) {
|
|
438344
|
+
console.error("Error: task ID or name required. Usage: letta cron get <id|name>");
|
|
438289
438345
|
return 1;
|
|
438290
438346
|
}
|
|
438347
|
+
const agentId = getAgentId3(values2.agent);
|
|
438291
438348
|
if (values2.runner !== "cloud") {
|
|
438292
|
-
const task2 = getTask2(
|
|
438349
|
+
const task2 = getTask2(taskRef);
|
|
438293
438350
|
if (task2) {
|
|
438294
438351
|
console.log(JSON.stringify({ ...task2, runner: "local" }, null, 2));
|
|
438295
438352
|
return 0;
|
|
438296
438353
|
}
|
|
438297
|
-
|
|
438298
|
-
|
|
438299
|
-
|
|
438354
|
+
}
|
|
438355
|
+
if (values2.runner !== "local" && agentId) {
|
|
438356
|
+
try {
|
|
438357
|
+
await ensureSettingsForCloud();
|
|
438358
|
+
const schedule = await getCloudSchedule(agentId, taskRef);
|
|
438359
|
+
console.log(JSON.stringify(formatCloudScheduleOutput(schedule), null, 2));
|
|
438360
|
+
return 0;
|
|
438361
|
+
} catch (err) {
|
|
438362
|
+
if (!(err instanceof ApiRequestError && err.status === 404)) {
|
|
438363
|
+
console.error(`Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
438364
|
+
return 1;
|
|
438365
|
+
}
|
|
438300
438366
|
}
|
|
438301
438367
|
}
|
|
438302
|
-
|
|
438303
|
-
|
|
438304
|
-
console.error(`Error: task ${taskId} not found locally, and --agent or LETTA_AGENT_ID is required to look up Cloud schedules.`);
|
|
438368
|
+
if (values2.runner !== "local" && !agentId) {
|
|
438369
|
+
console.error(`Error: task ${taskRef} not found locally, and --agent or LETTA_AGENT_ID is required to look up Cloud schedules.`);
|
|
438305
438370
|
return 1;
|
|
438306
438371
|
}
|
|
438307
|
-
|
|
438308
|
-
|
|
438309
|
-
|
|
438310
|
-
|
|
438311
|
-
|
|
438312
|
-
|
|
438313
|
-
if (err instanceof ApiRequestError && err.status === 404) {
|
|
438314
|
-
console.error(`Error: task ${taskId} not found.`);
|
|
438315
|
-
} else {
|
|
438316
|
-
console.error(`Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
438317
|
-
}
|
|
438372
|
+
const resolved = await resolveTaskName(taskRef, {
|
|
438373
|
+
runner: values2.runner,
|
|
438374
|
+
agentId
|
|
438375
|
+
});
|
|
438376
|
+
if (resolved && "ambiguous" in resolved) {
|
|
438377
|
+
printAmbiguousTaskName(taskRef, resolved.ambiguous);
|
|
438318
438378
|
return 1;
|
|
438319
438379
|
}
|
|
438380
|
+
if (resolved?.store === "local") {
|
|
438381
|
+
const task2 = getTask2(resolved.id);
|
|
438382
|
+
if (task2) {
|
|
438383
|
+
console.log(JSON.stringify({ ...task2, runner: "local" }, null, 2));
|
|
438384
|
+
return 0;
|
|
438385
|
+
}
|
|
438386
|
+
}
|
|
438387
|
+
if (resolved?.store === "cloud" && agentId) {
|
|
438388
|
+
try {
|
|
438389
|
+
const schedule = await getCloudSchedule(agentId, resolved.id);
|
|
438390
|
+
console.log(JSON.stringify(formatCloudScheduleOutput(schedule), null, 2));
|
|
438391
|
+
return 0;
|
|
438392
|
+
} catch {}
|
|
438393
|
+
}
|
|
438394
|
+
console.error(`Error: task ${taskRef} not found.`);
|
|
438395
|
+
return 1;
|
|
438320
438396
|
}
|
|
438321
438397
|
async function handleRuns(values2) {
|
|
438322
438398
|
if (!isRunnerFlagValid(values2.runner)) {
|
|
@@ -438377,41 +438453,65 @@ async function handleDelete(values2, positionals) {
|
|
|
438377
438453
|
if (values2.all) {
|
|
438378
438454
|
return handleDeleteAll(values2);
|
|
438379
438455
|
}
|
|
438380
|
-
const
|
|
438381
|
-
if (!
|
|
438382
|
-
console.error("Error: task ID required. Usage: letta cron delete <id> or --all --agent <id>");
|
|
438456
|
+
const taskRef = positionals[1];
|
|
438457
|
+
if (!taskRef) {
|
|
438458
|
+
console.error("Error: task ID or name required. Usage: letta cron delete <id|name> or --all --agent <id>");
|
|
438383
438459
|
return 1;
|
|
438384
438460
|
}
|
|
438385
438461
|
if (values2.runner !== "cloud") {
|
|
438386
|
-
const found = deleteTask(
|
|
438462
|
+
const found = deleteTask(taskRef);
|
|
438387
438463
|
if (found) {
|
|
438388
|
-
console.log(JSON.stringify({ deleted:
|
|
438464
|
+
console.log(JSON.stringify({ deleted: taskRef, runner: "local" }));
|
|
438389
438465
|
return 0;
|
|
438390
438466
|
}
|
|
438391
|
-
|
|
438392
|
-
|
|
438467
|
+
}
|
|
438468
|
+
const agentId = getAgentId3(values2.agent);
|
|
438469
|
+
if (values2.runner !== "local") {
|
|
438470
|
+
if (!agentId) {
|
|
438471
|
+
console.error(`Error: task ${taskRef} not found locally, and --agent or LETTA_AGENT_ID is required to delete Cloud schedules.`);
|
|
438393
438472
|
return 1;
|
|
438394
438473
|
}
|
|
438474
|
+
try {
|
|
438475
|
+
await ensureSettingsForCloud();
|
|
438476
|
+
await getCloudSchedule(agentId, taskRef);
|
|
438477
|
+
await deleteCloudSchedule(agentId, taskRef);
|
|
438478
|
+
console.log(JSON.stringify({ deleted: taskRef, runner: "cloud" }));
|
|
438479
|
+
return 0;
|
|
438480
|
+
} catch (err) {
|
|
438481
|
+
if (!(err instanceof ApiRequestError && err.status === 404)) {
|
|
438482
|
+
console.error(`Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
438483
|
+
return 1;
|
|
438484
|
+
}
|
|
438485
|
+
}
|
|
438395
438486
|
}
|
|
438396
|
-
const
|
|
438397
|
-
|
|
438398
|
-
|
|
438487
|
+
const resolved = await resolveTaskName(taskRef, {
|
|
438488
|
+
runner: values2.runner,
|
|
438489
|
+
agentId
|
|
438490
|
+
});
|
|
438491
|
+
if (resolved && "ambiguous" in resolved) {
|
|
438492
|
+
printAmbiguousTaskName(taskRef, resolved.ambiguous);
|
|
438399
438493
|
return 1;
|
|
438400
438494
|
}
|
|
438401
|
-
|
|
438402
|
-
|
|
438403
|
-
await getCloudSchedule(agentId, taskId);
|
|
438404
|
-
await deleteCloudSchedule(agentId, taskId);
|
|
438405
|
-
console.log(JSON.stringify({ deleted: taskId, runner: "cloud" }));
|
|
438495
|
+
if (resolved?.store === "local" && deleteTask(resolved.id)) {
|
|
438496
|
+
console.log(JSON.stringify({ deleted: resolved.id, name: taskRef, runner: "local" }));
|
|
438406
438497
|
return 0;
|
|
438407
|
-
}
|
|
438408
|
-
|
|
438409
|
-
|
|
438410
|
-
|
|
438498
|
+
}
|
|
438499
|
+
if (resolved?.store === "cloud" && agentId) {
|
|
438500
|
+
try {
|
|
438501
|
+
await deleteCloudSchedule(agentId, resolved.id);
|
|
438502
|
+
console.log(JSON.stringify({
|
|
438503
|
+
deleted: resolved.id,
|
|
438504
|
+
name: taskRef,
|
|
438505
|
+
runner: "cloud"
|
|
438506
|
+
}));
|
|
438507
|
+
return 0;
|
|
438508
|
+
} catch (err) {
|
|
438411
438509
|
console.error(`Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
438510
|
+
return 1;
|
|
438412
438511
|
}
|
|
438413
|
-
return 1;
|
|
438414
438512
|
}
|
|
438513
|
+
console.error(`Error: task ${taskRef} not found.`);
|
|
438514
|
+
return 1;
|
|
438415
438515
|
}
|
|
438416
438516
|
async function handleDeleteAll(values2) {
|
|
438417
438517
|
const agentId = getAgentId3(values2.agent);
|
|
@@ -438476,6 +438576,7 @@ async function runCronSubcommand(argv) {
|
|
|
438476
438576
|
case "runs":
|
|
438477
438577
|
return handleRuns(parsed.values);
|
|
438478
438578
|
case "delete":
|
|
438579
|
+
case "remove":
|
|
438479
438580
|
return handleDelete(parsed.values, parsed.positionals);
|
|
438480
438581
|
default:
|
|
438481
438582
|
console.error(`Unknown action: ${action3}`);
|
|
@@ -438488,7 +438589,10 @@ var init_cron2 = __esm(async () => {
|
|
|
438488
438589
|
init_request();
|
|
438489
438590
|
init_schedules2();
|
|
438490
438591
|
init_backend_mode();
|
|
438491
|
-
await
|
|
438592
|
+
await __promiseAll([
|
|
438593
|
+
init_cron(),
|
|
438594
|
+
init_cron_task_ref()
|
|
438595
|
+
]);
|
|
438492
438596
|
CRON_OPTIONS = {
|
|
438493
438597
|
help: { type: "boolean", short: "h" },
|
|
438494
438598
|
name: { type: "string" },
|
|
@@ -488563,7 +488667,7 @@ var init_mcp_client = __esm(() => {
|
|
|
488563
488667
|
init_streamableHttp();
|
|
488564
488668
|
DEFAULT_CLIENT_INFO = {
|
|
488565
488669
|
name: "letta-code",
|
|
488566
|
-
version: "0.30.
|
|
488670
|
+
version: "0.30.2"
|
|
488567
488671
|
};
|
|
488568
488672
|
});
|
|
488569
488673
|
|
|
@@ -555586,4 +555690,4 @@ function registerBunOAuthFlows() {
|
|
|
555586
555690
|
registerBunOAuthFlows();
|
|
555587
555691
|
await init_src5().then(() => exports_src2);
|
|
555588
555692
|
|
|
555589
|
-
//# debugId=
|
|
555693
|
+
//# debugId=F9C406BD13E4AE1D64756E2164756E21
|
package/package.json
CHANGED