@letta-ai/letta-code 0.30.0 → 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/dist/schedules.js +189 -0
- package/dist/schedules.js.map +10 -0
- package/dist/types/cron/scheduled-task-prompt.d.ts +35 -0
- package/dist/types/cron/scheduled-task-prompt.d.ts.map +1 -0
- package/dist/types/schedules.d.ts +8 -0
- package/dist/types/schedules.d.ts.map +1 -0
- package/letta.js +218 -74
- package/package.json +12 -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",
|
|
@@ -5488,6 +5488,8 @@ var init_package = __esm(() => {
|
|
|
5488
5488
|
"dist/mcp-client.js.map",
|
|
5489
5489
|
"dist/agent-presets.js",
|
|
5490
5490
|
"dist/agent-presets.js.map",
|
|
5491
|
+
"dist/schedules.js",
|
|
5492
|
+
"dist/schedules.js.map",
|
|
5491
5493
|
"dist/channels-public.js",
|
|
5492
5494
|
"dist/channels-public.js.map",
|
|
5493
5495
|
"dist/channels-slack.js",
|
|
@@ -5532,6 +5534,12 @@ var init_package = __esm(() => {
|
|
|
5532
5534
|
import: "./dist/agent-presets.js",
|
|
5533
5535
|
default: "./dist/agent-presets.js"
|
|
5534
5536
|
},
|
|
5537
|
+
"./schedules": {
|
|
5538
|
+
types: "./dist/types/schedules.d.ts",
|
|
5539
|
+
browser: "./dist/schedules.js",
|
|
5540
|
+
import: "./dist/schedules.js",
|
|
5541
|
+
default: "./dist/schedules.js"
|
|
5542
|
+
},
|
|
5535
5543
|
"./channels": {
|
|
5536
5544
|
types: "./dist/types/channels-public.d.ts",
|
|
5537
5545
|
browser: "./dist/channels-public.js",
|
|
@@ -5634,6 +5642,9 @@ var init_package = __esm(() => {
|
|
|
5634
5642
|
"agent-presets": [
|
|
5635
5643
|
"./dist/types/agent-presets.d.ts"
|
|
5636
5644
|
],
|
|
5645
|
+
schedules: [
|
|
5646
|
+
"./dist/types/schedules.d.ts"
|
|
5647
|
+
],
|
|
5637
5648
|
"app-server-protocol": [
|
|
5638
5649
|
"./dist/types/types/app-server-protocol.d.ts"
|
|
5639
5650
|
],
|
|
@@ -5785,11 +5796,14 @@ function getNodeRoutingHeader() {
|
|
|
5785
5796
|
const enabled = NODE_HEADER_ENABLED_VALUES.has(raw.trim().toLowerCase());
|
|
5786
5797
|
return { "x-letta-node": enabled ? "1" : "0" };
|
|
5787
5798
|
}
|
|
5799
|
+
function getRuntimeEnvironmentDeviceId() {
|
|
5800
|
+
return process.env[RUNTIME_ENVIRONMENT_DEVICE_ID_ENV]?.trim() || settingsManager.getOrCreateDeviceId();
|
|
5801
|
+
}
|
|
5788
5802
|
function getClientDefaultHeaders() {
|
|
5789
5803
|
return {
|
|
5790
5804
|
"X-Letta-Source": "letta-code",
|
|
5791
5805
|
"User-Agent": `letta-code/${package_default.version}`,
|
|
5792
|
-
"X-Letta-Environment-Device-Id":
|
|
5806
|
+
"X-Letta-Environment-Device-Id": getRuntimeEnvironmentDeviceId(),
|
|
5793
5807
|
...getNodeRoutingHeader(),
|
|
5794
5808
|
...process.env.LETTA_MEMFS_BACKEND === "hosted" ? { "x-letta-memfs-backend": "hosted" } : {}
|
|
5795
5809
|
};
|
|
@@ -5883,7 +5897,7 @@ If you experience this issue multiple times, move ~/.letta to ~/.letta_backup, a
|
|
|
5883
5897
|
};
|
|
5884
5898
|
return client;
|
|
5885
5899
|
}
|
|
5886
|
-
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";
|
|
5887
5901
|
var init_client2 = __esm(() => {
|
|
5888
5902
|
init_letta_client();
|
|
5889
5903
|
init_oauth();
|
|
@@ -437141,7 +437155,7 @@ var init_conversation_runtime = __esm(async () => {
|
|
|
437141
437155
|
]);
|
|
437142
437156
|
});
|
|
437143
437157
|
|
|
437144
|
-
// src/cron/prompt.ts
|
|
437158
|
+
// src/cron/scheduled-task-prompt.ts
|
|
437145
437159
|
function pad(value, width) {
|
|
437146
437160
|
return String(value).padStart(width, "0");
|
|
437147
437161
|
}
|
|
@@ -437223,6 +437237,34 @@ function formatTimezoneQualifiedIso(date6, timezone) {
|
|
|
437223
437237
|
const offsetMinutes = Math.round((zonedAsUtcMs - date6.getTime()) / 60000);
|
|
437224
437238
|
return `${pad(parts.year, 4)}-${pad(parts.month, 2)}-${pad(parts.day, 2)}T${pad(parts.hour, 2)}:${pad(parts.minute, 2)}:${pad(parts.second, 2)}.${pad(millis, 3)}${formatOffset(offsetMinutes)}[${effectiveTimezone ?? "local"}]`;
|
|
437225
437239
|
}
|
|
437240
|
+
function formatRecurrence(recurrence) {
|
|
437241
|
+
if (recurrence.type === "one-off") {
|
|
437242
|
+
return "This is a one-off scheduled task.";
|
|
437243
|
+
}
|
|
437244
|
+
if (recurrence.fireNumber !== undefined) {
|
|
437245
|
+
return `This is fire #${recurrence.fireNumber} (cron: ${recurrence.cron}).`;
|
|
437246
|
+
}
|
|
437247
|
+
return `This is a recurring scheduled task (cron: ${recurrence.cron}).`;
|
|
437248
|
+
}
|
|
437249
|
+
function formatScheduledTaskPrompt(input) {
|
|
437250
|
+
const lines = [
|
|
437251
|
+
`Scheduled task "${input.name}" is firing.`,
|
|
437252
|
+
...input.description ? [`Description: ${input.description}`] : [],
|
|
437253
|
+
`Timezone: ${formatTimezoneDisplay(input.timezone)}`,
|
|
437254
|
+
`Scheduled for: ${formatTimezoneQualifiedIso(input.scheduledFor, input.timezone)}`,
|
|
437255
|
+
`Current time: ${formatTimezoneQualifiedIso(input.currentTime, input.timezone)}`,
|
|
437256
|
+
formatRecurrence(input.recurrence),
|
|
437257
|
+
"",
|
|
437258
|
+
AUTONOMOUS_NOTICE,
|
|
437259
|
+
"",
|
|
437260
|
+
`Prompt: ${input.prompt}`
|
|
437261
|
+
];
|
|
437262
|
+
return lines.join(`
|
|
437263
|
+
`);
|
|
437264
|
+
}
|
|
437265
|
+
var AUTONOMOUS_NOTICE = "You are running autonomously: no user is watching this turn and questions will not be answered. Deliver results through your available channels or record them in memory, and work until the task is done or genuinely blocked.";
|
|
437266
|
+
|
|
437267
|
+
// src/cron/prompt.ts
|
|
437226
437268
|
function getIntendedCronOccurrence(task2, matchedAt) {
|
|
437227
437269
|
if (!task2.recurring && task2.scheduled_for) {
|
|
437228
437270
|
const scheduledFor = new Date(task2.scheduled_for);
|
|
@@ -437235,22 +437277,21 @@ function getIntendedCronOccurrence(task2, matchedAt) {
|
|
|
437235
437277
|
return occurrence;
|
|
437236
437278
|
}
|
|
437237
437279
|
function formatCronPrompt(task2, timing) {
|
|
437238
|
-
|
|
437239
|
-
|
|
437240
|
-
|
|
437241
|
-
|
|
437242
|
-
|
|
437243
|
-
|
|
437244
|
-
|
|
437245
|
-
|
|
437246
|
-
|
|
437247
|
-
|
|
437248
|
-
"",
|
|
437249
|
-
|
|
437250
|
-
|
|
437251
|
-
|
|
437252
|
-
|
|
437253
|
-
}
|
|
437280
|
+
return formatScheduledTaskPrompt({
|
|
437281
|
+
name: task2.name,
|
|
437282
|
+
description: task2.description,
|
|
437283
|
+
timezone: typeof task2.timezone === "string" ? task2.timezone : "",
|
|
437284
|
+
scheduledFor: timing.intendedOccurrence,
|
|
437285
|
+
currentTime: timing.schedulerNow,
|
|
437286
|
+
recurrence: task2.recurring ? {
|
|
437287
|
+
type: "recurring",
|
|
437288
|
+
cron: task2.cron,
|
|
437289
|
+
fireNumber: task2.fire_count + 1
|
|
437290
|
+
} : { type: "one-off" },
|
|
437291
|
+
prompt: task2.prompt
|
|
437292
|
+
});
|
|
437293
|
+
}
|
|
437294
|
+
var init_prompt = () => {};
|
|
437254
437295
|
|
|
437255
437296
|
// src/cron/scheduler.ts
|
|
437256
437297
|
function minuteKey(date6) {
|
|
@@ -437671,7 +437712,9 @@ var init_scheduler = __esm(async () => {
|
|
|
437671
437712
|
init_runtime6();
|
|
437672
437713
|
init_cron_file();
|
|
437673
437714
|
init_parse_interval();
|
|
437715
|
+
init_prompt();
|
|
437674
437716
|
init_run_log();
|
|
437717
|
+
init_prompt();
|
|
437675
437718
|
await __promiseAll([
|
|
437676
437719
|
init_conversation_runtime(),
|
|
437677
437720
|
init_protocol_outbound(),
|
|
@@ -437778,6 +437821,57 @@ function buildCloudScheduleInput(params) {
|
|
|
437778
437821
|
}
|
|
437779
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.";
|
|
437780
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
|
+
|
|
437781
437875
|
// src/backend/api/environments.ts
|
|
437782
437876
|
var exports_environments2 = {};
|
|
437783
437877
|
__export(exports_environments2, {
|
|
@@ -437881,9 +437975,9 @@ Usage:
|
|
|
437881
437975
|
letta cron add --prompt <text> --at <time> [--once] [options]
|
|
437882
437976
|
letta cron add --prompt <text> --cron <expr> [options]
|
|
437883
437977
|
letta cron list [options]
|
|
437884
|
-
letta cron get <id> [--runner local|cloud]
|
|
437978
|
+
letta cron get <id|name> [--runner local|cloud]
|
|
437885
437979
|
letta cron runs --id <id> [--limit <n>] [--runner local|cloud]
|
|
437886
|
-
letta cron delete <id> [--runner local|cloud]
|
|
437980
|
+
letta cron delete <id|name> [--runner local|cloud] (alias: remove)
|
|
437887
437981
|
letta cron delete --all [--agent <id>] [--runner local|cloud]
|
|
437888
437982
|
|
|
437889
437983
|
Add options:
|
|
@@ -437943,10 +438037,6 @@ async function probeCloudScheduleSupport(agentId) {
|
|
|
437943
438037
|
return true;
|
|
437944
438038
|
}
|
|
437945
438039
|
}
|
|
437946
|
-
async function ensureSettingsForCloud() {
|
|
437947
|
-
const { settingsManager: settingsManager2 } = await Promise.resolve().then(() => (init_settings_manager(), exports_settings_manager));
|
|
437948
|
-
await settingsManager2.initialize();
|
|
437949
|
-
}
|
|
437950
438040
|
async function getRunnerForAgent(explicit, agentId) {
|
|
437951
438041
|
const backendMode = resolveBackendMode();
|
|
437952
438042
|
const preliminary = resolveCronRunner({ explicit, agentId, backendMode });
|
|
@@ -438212,11 +438302,13 @@ async function handleList(values2) {
|
|
|
438212
438302
|
}
|
|
438213
438303
|
}
|
|
438214
438304
|
if (includeCloud && agentId) {
|
|
438215
|
-
const resolved = await getRunnerForAgent(undefined, agentId);
|
|
438216
|
-
const cloudCapable = !("error" in resolved) && resolved.runner === "cloud";
|
|
438217
438305
|
const cloudExplicit = values2.runner === "cloud";
|
|
438218
|
-
|
|
438306
|
+
const backendMode = resolveBackendMode();
|
|
438307
|
+
const preliminary = resolveCronRunner({ agentId, backendMode });
|
|
438308
|
+
const cloudCandidate = !("error" in preliminary) && preliminary.runner === "cloud";
|
|
438309
|
+
if (cloudCandidate || cloudExplicit) {
|
|
438219
438310
|
try {
|
|
438311
|
+
await ensureSettingsForCloud();
|
|
438220
438312
|
const response = await listCloudSchedules(agentId);
|
|
438221
438313
|
for (const schedule of response.scheduled_messages) {
|
|
438222
438314
|
if (conversationId && (schedule.conversation_id ?? "default") !== conversationId) {
|
|
@@ -438225,7 +438317,11 @@ async function handleList(values2) {
|
|
|
438225
438317
|
output.push(formatCloudScheduleOutput(schedule));
|
|
438226
438318
|
}
|
|
438227
438319
|
} catch (err) {
|
|
438228
|
-
|
|
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
|
+
}
|
|
438229
438325
|
if (cloudExplicit) {
|
|
438230
438326
|
return 1;
|
|
438231
438327
|
}
|
|
@@ -438243,40 +438339,60 @@ async function handleGet(values2, positionals) {
|
|
|
438243
438339
|
console.error(`Error: invalid --runner "${values2.runner}". Expected "local" or "cloud".`);
|
|
438244
438340
|
return 1;
|
|
438245
438341
|
}
|
|
438246
|
-
const
|
|
438247
|
-
if (!
|
|
438248
|
-
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>");
|
|
438249
438345
|
return 1;
|
|
438250
438346
|
}
|
|
438347
|
+
const agentId = getAgentId3(values2.agent);
|
|
438251
438348
|
if (values2.runner !== "cloud") {
|
|
438252
|
-
const task2 = getTask2(
|
|
438349
|
+
const task2 = getTask2(taskRef);
|
|
438253
438350
|
if (task2) {
|
|
438254
438351
|
console.log(JSON.stringify({ ...task2, runner: "local" }, null, 2));
|
|
438255
438352
|
return 0;
|
|
438256
438353
|
}
|
|
438257
|
-
|
|
438258
|
-
|
|
438259
|
-
|
|
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
|
+
}
|
|
438260
438366
|
}
|
|
438261
438367
|
}
|
|
438262
|
-
|
|
438263
|
-
|
|
438264
|
-
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.`);
|
|
438265
438370
|
return 1;
|
|
438266
438371
|
}
|
|
438267
|
-
|
|
438268
|
-
|
|
438269
|
-
|
|
438270
|
-
|
|
438271
|
-
|
|
438272
|
-
|
|
438273
|
-
if (err instanceof ApiRequestError && err.status === 404) {
|
|
438274
|
-
console.error(`Error: task ${taskId} not found.`);
|
|
438275
|
-
} else {
|
|
438276
|
-
console.error(`Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
438277
|
-
}
|
|
438372
|
+
const resolved = await resolveTaskName(taskRef, {
|
|
438373
|
+
runner: values2.runner,
|
|
438374
|
+
agentId
|
|
438375
|
+
});
|
|
438376
|
+
if (resolved && "ambiguous" in resolved) {
|
|
438377
|
+
printAmbiguousTaskName(taskRef, resolved.ambiguous);
|
|
438278
438378
|
return 1;
|
|
438279
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;
|
|
438280
438396
|
}
|
|
438281
438397
|
async function handleRuns(values2) {
|
|
438282
438398
|
if (!isRunnerFlagValid(values2.runner)) {
|
|
@@ -438337,41 +438453,65 @@ async function handleDelete(values2, positionals) {
|
|
|
438337
438453
|
if (values2.all) {
|
|
438338
438454
|
return handleDeleteAll(values2);
|
|
438339
438455
|
}
|
|
438340
|
-
const
|
|
438341
|
-
if (!
|
|
438342
|
-
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>");
|
|
438343
438459
|
return 1;
|
|
438344
438460
|
}
|
|
438345
438461
|
if (values2.runner !== "cloud") {
|
|
438346
|
-
const found = deleteTask(
|
|
438462
|
+
const found = deleteTask(taskRef);
|
|
438347
438463
|
if (found) {
|
|
438348
|
-
console.log(JSON.stringify({ deleted:
|
|
438464
|
+
console.log(JSON.stringify({ deleted: taskRef, runner: "local" }));
|
|
438349
438465
|
return 0;
|
|
438350
438466
|
}
|
|
438351
|
-
|
|
438352
|
-
|
|
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.`);
|
|
438353
438472
|
return 1;
|
|
438354
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
|
+
}
|
|
438355
438486
|
}
|
|
438356
|
-
const
|
|
438357
|
-
|
|
438358
|
-
|
|
438487
|
+
const resolved = await resolveTaskName(taskRef, {
|
|
438488
|
+
runner: values2.runner,
|
|
438489
|
+
agentId
|
|
438490
|
+
});
|
|
438491
|
+
if (resolved && "ambiguous" in resolved) {
|
|
438492
|
+
printAmbiguousTaskName(taskRef, resolved.ambiguous);
|
|
438359
438493
|
return 1;
|
|
438360
438494
|
}
|
|
438361
|
-
|
|
438362
|
-
|
|
438363
|
-
await getCloudSchedule(agentId, taskId);
|
|
438364
|
-
await deleteCloudSchedule(agentId, taskId);
|
|
438365
|
-
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" }));
|
|
438366
438497
|
return 0;
|
|
438367
|
-
}
|
|
438368
|
-
|
|
438369
|
-
|
|
438370
|
-
|
|
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) {
|
|
438371
438509
|
console.error(`Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
438510
|
+
return 1;
|
|
438372
438511
|
}
|
|
438373
|
-
return 1;
|
|
438374
438512
|
}
|
|
438513
|
+
console.error(`Error: task ${taskRef} not found.`);
|
|
438514
|
+
return 1;
|
|
438375
438515
|
}
|
|
438376
438516
|
async function handleDeleteAll(values2) {
|
|
438377
438517
|
const agentId = getAgentId3(values2.agent);
|
|
@@ -438436,6 +438576,7 @@ async function runCronSubcommand(argv) {
|
|
|
438436
438576
|
case "runs":
|
|
438437
438577
|
return handleRuns(parsed.values);
|
|
438438
438578
|
case "delete":
|
|
438579
|
+
case "remove":
|
|
438439
438580
|
return handleDelete(parsed.values, parsed.positionals);
|
|
438440
438581
|
default:
|
|
438441
438582
|
console.error(`Unknown action: ${action3}`);
|
|
@@ -438448,7 +438589,10 @@ var init_cron2 = __esm(async () => {
|
|
|
438448
438589
|
init_request();
|
|
438449
438590
|
init_schedules2();
|
|
438450
438591
|
init_backend_mode();
|
|
438451
|
-
await
|
|
438592
|
+
await __promiseAll([
|
|
438593
|
+
init_cron(),
|
|
438594
|
+
init_cron_task_ref()
|
|
438595
|
+
]);
|
|
438452
438596
|
CRON_OPTIONS = {
|
|
438453
438597
|
help: { type: "boolean", short: "h" },
|
|
438454
438598
|
name: { type: "string" },
|
|
@@ -488523,7 +488667,7 @@ var init_mcp_client = __esm(() => {
|
|
|
488523
488667
|
init_streamableHttp();
|
|
488524
488668
|
DEFAULT_CLIENT_INFO = {
|
|
488525
488669
|
name: "letta-code",
|
|
488526
|
-
version: "0.30.
|
|
488670
|
+
version: "0.30.2"
|
|
488527
488671
|
};
|
|
488528
488672
|
});
|
|
488529
488673
|
|
|
@@ -555546,4 +555690,4 @@ function registerBunOAuthFlows() {
|
|
|
555546
555690
|
registerBunOAuthFlows();
|
|
555547
555691
|
await init_src5().then(() => exports_src2);
|
|
555548
555692
|
|
|
555549
|
-
//# debugId=
|
|
555693
|
+
//# debugId=F9C406BD13E4AE1D64756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@letta-ai/letta-code",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.2",
|
|
4
4
|
"description": "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "bun@1.3.0",
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
"dist/mcp-client.js.map",
|
|
27
27
|
"dist/agent-presets.js",
|
|
28
28
|
"dist/agent-presets.js.map",
|
|
29
|
+
"dist/schedules.js",
|
|
30
|
+
"dist/schedules.js.map",
|
|
29
31
|
"dist/channels-public.js",
|
|
30
32
|
"dist/channels-public.js.map",
|
|
31
33
|
"dist/channels-slack.js",
|
|
@@ -70,6 +72,12 @@
|
|
|
70
72
|
"import": "./dist/agent-presets.js",
|
|
71
73
|
"default": "./dist/agent-presets.js"
|
|
72
74
|
},
|
|
75
|
+
"./schedules": {
|
|
76
|
+
"types": "./dist/types/schedules.d.ts",
|
|
77
|
+
"browser": "./dist/schedules.js",
|
|
78
|
+
"import": "./dist/schedules.js",
|
|
79
|
+
"default": "./dist/schedules.js"
|
|
80
|
+
},
|
|
73
81
|
"./channels": {
|
|
74
82
|
"types": "./dist/types/channels-public.d.ts",
|
|
75
83
|
"browser": "./dist/channels-public.js",
|
|
@@ -172,6 +180,9 @@
|
|
|
172
180
|
"agent-presets": [
|
|
173
181
|
"./dist/types/agent-presets.d.ts"
|
|
174
182
|
],
|
|
183
|
+
"schedules": [
|
|
184
|
+
"./dist/types/schedules.d.ts"
|
|
185
|
+
],
|
|
175
186
|
"app-server-protocol": [
|
|
176
187
|
"./dist/types/types/app-server-protocol.d.ts"
|
|
177
188
|
],
|