@letta-ai/letta-code 0.30.32 → 0.31.1
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/agent-presets-agent-presets.js +11 -0
- package/dist/agent-presets-agent-presets.js.map +9 -0
- package/dist/agent-presets-personality-asset-content.js +42 -0
- package/dist/agent-presets-personality-asset-content.js.map +10 -0
- package/dist/agent-presets.js +17 -2
- package/dist/agent-presets.js.map +3 -3
- package/dist/channels-public.js +16 -1
- package/dist/channels-public.js.map +5 -4
- package/dist/gateway-core.js +5 -4
- package/dist/gateway-core.js.map +3 -3
- package/dist/mcp-client.js +2 -2
- package/dist/mcp-client.js.map +1 -1
- package/dist/types/agent/create-agent-request.d.ts +3 -0
- package/dist/types/agent/create-agent-request.d.ts.map +1 -1
- package/dist/types/agent/model.d.ts.map +1 -1
- package/dist/types/agent/personality-asset-content.d.ts +3 -0
- package/dist/types/agent/personality-asset-content.d.ts.map +1 -0
- package/dist/types/agent/skills.d.ts.map +1 -1
- package/dist/types/agent/subagents/manager.d.ts.map +1 -1
- package/dist/types/channels/gateway-core.d.ts.map +1 -1
- package/dist/types/channels/route-thread-key.d.ts +20 -0
- package/dist/types/channels/route-thread-key.d.ts.map +1 -0
- package/dist/types/channels-public.d.ts +1 -0
- package/dist/types/channels-public.d.ts.map +1 -1
- package/dist/types/tools/impl/shell-runner.d.ts.map +1 -1
- package/dist/types/tools/impl/skill.d.ts.map +1 -1
- package/dist/types/types/protocol_v2.d.ts +3 -144
- package/dist/types/types/protocol_v2.d.ts.map +1 -1
- package/dist/types/types/schedule-protocol.d.ts +151 -1
- package/dist/types/types/schedule-protocol.d.ts.map +1 -1
- package/dist/types/utils/frontmatter.d.ts.map +1 -1
- package/dist/types/utils/systemd-workload-scope.d.ts +15 -0
- package/dist/types/utils/systemd-workload-scope.d.ts.map +1 -0
- package/dist/types/websocket/listener/cwd-change.d.ts.map +1 -1
- package/letta.js +275 -94
- package/package.json +4 -2
- package/scripts/builtin-skills-watch/agent-watch.test.ts +104 -0
- package/scripts/builtin-skills-watch/agent-watch.ts +337 -0
- package/scripts/builtin-skills-watch/aggregate-results.test.ts +79 -0
- package/scripts/builtin-skills-watch/aggregate-results.ts +326 -0
- package/scripts/builtin-skills-watch/analysis.test.ts +70 -0
- package/scripts/builtin-skills-watch/analysis.ts +228 -0
- package/scripts/builtin-skills-watch/evidence.test.ts +114 -0
- package/scripts/builtin-skills-watch/evidence.ts +145 -0
- package/scripts/builtin-skills-watch/github.ts +161 -0
- package/scripts/builtin-skills-watch/tracker.test.ts +249 -0
- package/scripts/builtin-skills-watch/tracker.ts +506 -0
- package/scripts/builtin-skills-watch/update-tracker.test.ts +234 -0
- package/scripts/builtin-skills-watch/update-tracker.ts +508 -0
- package/scripts/claude-watch/release-source.test.ts +16 -4
- package/scripts/claude-watch/release-source.ts +41 -2
- package/scripts/codex-watch/agent-watch.ts +8 -5
- package/scripts/codex-watch/release-analysis.test.ts +18 -16
- package/scripts/codex-watch/release-analysis.ts +31 -9
- package/scripts/codex-watch/tracker.test.ts +5 -5
- package/scripts/codex-watch/tracker.ts +7 -8
- package/scripts/pi-ai-watch/agent-watch.ts +9 -14
- package/scripts/pi-ai-watch/release-analysis.test.ts +24 -18
- package/scripts/pi-ai-watch/release-analysis.ts +85 -45
- package/scripts/pi-ai-watch/tracker.test.ts +25 -18
- package/scripts/pi-ai-watch/tracker.ts +7 -19
- package/scripts/pi-ai-watch/update-tracker.ts +2 -2
- package/scripts/source-file-size-baseline.json +2 -2
- package/skills/dispatching-coding-agents/SKILL.md +16 -7
- package/skills/syncing-memory-filesystem/SKILL.md +118 -226
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.
|
|
5512
|
+
version: "0.31.1",
|
|
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",
|
|
@@ -5546,7 +5546,9 @@ var init_package = __esm(() => {
|
|
|
5546
5546
|
"dist/channels-telegram.js",
|
|
5547
5547
|
"dist/channels-telegram.js.map",
|
|
5548
5548
|
"dist/types",
|
|
5549
|
-
"docs"
|
|
5549
|
+
"docs",
|
|
5550
|
+
"dist/agent-presets-*.js",
|
|
5551
|
+
"dist/agent-presets-*.js.map"
|
|
5550
5552
|
],
|
|
5551
5553
|
exports: {
|
|
5552
5554
|
".": "./letta.js",
|
|
@@ -79793,7 +79795,7 @@ var init_pi_provider_registry = __esm(() => {
|
|
|
79793
79795
|
headers: () => ({
|
|
79794
79796
|
"HTTP-Referer": "https://letta.com",
|
|
79795
79797
|
"X-OpenRouter-Title": "Letta Code",
|
|
79796
|
-
"X-OpenRouter-Categories": "
|
|
79798
|
+
"X-OpenRouter-Categories": "cloud-agent,personal-agent"
|
|
79797
79799
|
})
|
|
79798
79800
|
},
|
|
79799
79801
|
zai: {
|
|
@@ -81320,14 +81322,15 @@ function getReasoningTierOptionsForHandle(modelHandle, contextWindow, reasoningC
|
|
|
81320
81322
|
if (providerOptions.length > 0)
|
|
81321
81323
|
return providerOptions;
|
|
81322
81324
|
const byEffort = new Map;
|
|
81323
|
-
const
|
|
81325
|
+
const normalizedHandle = normalizeModelHandleForRegistry(modelHandle) ?? modelHandle;
|
|
81326
|
+
const catalogHandle = [...new Set([modelHandle, normalizedHandle])].find((candidate) => models2.some((model) => model.handle === candidate)) ?? normalizedHandle;
|
|
81324
81327
|
const effectiveContextWindow = contextWindow ?? (() => {
|
|
81325
|
-
const contextWindows = models2.filter((model) => model.handle ===
|
|
81328
|
+
const contextWindows = models2.filter((model) => model.handle === catalogHandle).map((model) => model.updateArgs?.context_window).filter((value) => typeof value === "number");
|
|
81326
81329
|
const uniqueContextWindows = [...new Set(contextWindows)];
|
|
81327
81330
|
return uniqueContextWindows.length > 1 ? Math.min(...uniqueContextWindows) : undefined;
|
|
81328
81331
|
})();
|
|
81329
81332
|
for (const model of models2) {
|
|
81330
|
-
if (model.handle !==
|
|
81333
|
+
if (model.handle !== catalogHandle)
|
|
81331
81334
|
continue;
|
|
81332
81335
|
if (effectiveContextWindow !== undefined) {
|
|
81333
81336
|
const mCtx = model.updateArgs?.context_window;
|
|
@@ -81341,10 +81344,10 @@ function getReasoningTierOptionsForHandle(modelHandle, contextWindow, reasoningC
|
|
|
81341
81344
|
byEffort.set(effort, model.id);
|
|
81342
81345
|
}
|
|
81343
81346
|
}
|
|
81344
|
-
if (byEffort.size === 0 && isLocalModelHandle(
|
|
81347
|
+
if (byEffort.size === 0 && isLocalModelHandle(catalogHandle)) {
|
|
81345
81348
|
return LOCAL_REASONING_EFFORT_ORDER.map((effort) => ({
|
|
81346
81349
|
effort,
|
|
81347
|
-
modelId:
|
|
81350
|
+
modelId: catalogHandle
|
|
81348
81351
|
}));
|
|
81349
81352
|
}
|
|
81350
81353
|
return REASONING_EFFORT_ORDER.flatMap((effort) => {
|
|
@@ -81611,9 +81614,13 @@ function parseFrontmatter(content) {
|
|
|
81611
81614
|
currentArray = [];
|
|
81612
81615
|
};
|
|
81613
81616
|
for (const line of lines) {
|
|
81614
|
-
|
|
81615
|
-
|
|
81616
|
-
|
|
81617
|
+
const trimmedLine = line.trim();
|
|
81618
|
+
const indentation = line.length - line.trimStart().length;
|
|
81619
|
+
if (indentation > 0) {
|
|
81620
|
+
if (indentation <= 2 && trimmedLine.startsWith("-") && currentKey) {
|
|
81621
|
+
const value = trimmedLine.slice(1).trim();
|
|
81622
|
+
currentArray.push(value);
|
|
81623
|
+
}
|
|
81617
81624
|
continue;
|
|
81618
81625
|
}
|
|
81619
81626
|
savePendingKey();
|
|
@@ -92330,6 +92337,27 @@ var init_shell_env = __esm(() => {
|
|
|
92330
92337
|
init_ripgrep_manager();
|
|
92331
92338
|
});
|
|
92332
92339
|
|
|
92340
|
+
// src/utils/systemd-workload-scope.ts
|
|
92341
|
+
function wrapManagedWorkloadLauncher(launcher, options = {}) {
|
|
92342
|
+
const env2 = options.env ?? process.env;
|
|
92343
|
+
const platform2 = options.platform ?? process.platform;
|
|
92344
|
+
const slice = env2[WORKLOAD_SYSTEMD_SLICE_ENV]?.trim();
|
|
92345
|
+
if (launcher.length === 0 || platform2 !== "linux" || !slice) {
|
|
92346
|
+
return launcher;
|
|
92347
|
+
}
|
|
92348
|
+
return [
|
|
92349
|
+
"systemd-run",
|
|
92350
|
+
"--scope",
|
|
92351
|
+
"--quiet",
|
|
92352
|
+
"--collect",
|
|
92353
|
+
"--property=TimeoutStopSec=5s",
|
|
92354
|
+
`--slice=${slice}`,
|
|
92355
|
+
"--",
|
|
92356
|
+
...launcher
|
|
92357
|
+
];
|
|
92358
|
+
}
|
|
92359
|
+
var WORKLOAD_SYSTEMD_SLICE_ENV = "LETTA_WORKLOAD_SYSTEMD_SLICE";
|
|
92360
|
+
|
|
92333
92361
|
// src/tools/impl/github-pull-request-tracker.ts
|
|
92334
92362
|
function conversationTags(conversation) {
|
|
92335
92363
|
const tags = typeof conversation === "object" && conversation !== null ? Reflect.get(conversation, "tags") : undefined;
|
|
@@ -92765,7 +92793,10 @@ function spawnPtyProcess(launcher, options, events) {
|
|
|
92765
92793
|
return typeof Bun !== "undefined" ? spawnPtyBridgeProcess(launcher, options, events) : spawnNativePtyProcess(launcher, options, events);
|
|
92766
92794
|
}
|
|
92767
92795
|
function startShellProcess(launcher, options) {
|
|
92768
|
-
const
|
|
92796
|
+
const managedLauncher = wrapManagedWorkloadLauncher(launcher, {
|
|
92797
|
+
env: options.env
|
|
92798
|
+
});
|
|
92799
|
+
const [executable] = managedLauncher;
|
|
92769
92800
|
if (!executable) {
|
|
92770
92801
|
throw new ShellExecutionError("Executable is required");
|
|
92771
92802
|
}
|
|
@@ -92871,7 +92902,7 @@ function startShellProcess(launcher, options) {
|
|
|
92871
92902
|
}
|
|
92872
92903
|
};
|
|
92873
92904
|
try {
|
|
92874
|
-
processHandle = options.tty ? spawnPtyProcess(
|
|
92905
|
+
processHandle = options.tty ? spawnPtyProcess(managedLauncher, options, events) : spawnPipeProcess(managedLauncher, options, events);
|
|
92875
92906
|
} catch (error4) {
|
|
92876
92907
|
completed = true;
|
|
92877
92908
|
cleanup();
|
|
@@ -97113,15 +97144,19 @@ async function switchConversationWorkingDirectory(params) {
|
|
|
97113
97144
|
const { runtime, workingDirectory } = params;
|
|
97114
97145
|
const agentId = normalizeCwdAgentId(params.agentId);
|
|
97115
97146
|
const conversationId = normalizeConversationId(params.conversationId);
|
|
97147
|
+
const currentWorkingDirectory = getConversationWorkingDirectory(runtime, agentId, conversationId);
|
|
97148
|
+
const workingDirectoryChanged = canonicalizeRoot(currentWorkingDirectory) !== canonicalizeRoot(workingDirectory);
|
|
97116
97149
|
await loadSettingsForWorkingDirectory(workingDirectory);
|
|
97117
|
-
|
|
97150
|
+
if (workingDirectoryChanged) {
|
|
97151
|
+
setConversationWorkingDirectory(runtime, agentId, conversationId, workingDirectory);
|
|
97152
|
+
}
|
|
97118
97153
|
if (params.updateCurrentRuntimeContext !== false) {
|
|
97119
97154
|
updateRuntimeContext({ workingDirectory });
|
|
97120
97155
|
}
|
|
97121
97156
|
const conversationRuntime = getConversationRuntime(runtime, agentId, conversationId);
|
|
97122
97157
|
const scopeKey = getWorkingDirectoryScopeKey(agentId, conversationId);
|
|
97123
97158
|
const reminderState = conversationRuntime?.reminderState ?? runtime.reminderStateByConversation.get(scopeKey);
|
|
97124
|
-
if (reminderState) {
|
|
97159
|
+
if (workingDirectoryChanged && reminderState) {
|
|
97125
97160
|
reminderState.hasSentSessionContext = false;
|
|
97126
97161
|
reminderState.pendingSessionContextReason = "cwd_changed";
|
|
97127
97162
|
}
|
|
@@ -97134,6 +97169,7 @@ async function switchConversationWorkingDirectory(params) {
|
|
|
97134
97169
|
}
|
|
97135
97170
|
}
|
|
97136
97171
|
var init_cwd_change = __esm(() => {
|
|
97172
|
+
init_sandbox_policy();
|
|
97137
97173
|
init_runtime_context();
|
|
97138
97174
|
init_settings_manager();
|
|
97139
97175
|
init_connection();
|
|
@@ -111766,8 +111802,9 @@ async function parseSkillFile(filePath, rootPath, source) {
|
|
|
111766
111802
|
const relativePath = filePath.slice(normalizedRoot.length + 1);
|
|
111767
111803
|
const dirPath = relativePath.slice(0, -"/SKILL.MD".length);
|
|
111768
111804
|
const defaultId = dirPath || "root";
|
|
111769
|
-
const
|
|
111770
|
-
const
|
|
111805
|
+
const frontmatterName = getFrontmatterString(frontmatter, "name");
|
|
111806
|
+
const id2 = getFrontmatterString(frontmatter, "id") || frontmatterName || defaultId;
|
|
111807
|
+
const name = frontmatterName || (typeof frontmatter.title === "string" ? frontmatter.title : null) || (id2.split("/").pop() ?? "").replace(/-/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
|
|
111771
111808
|
let description = getFrontmatterString(frontmatter, "description") ?? null;
|
|
111772
111809
|
if (!description) {
|
|
111773
111810
|
const firstParagraph = body.trim().split(`
|
|
@@ -111979,6 +112016,22 @@ __export(exports_skill, {
|
|
|
111979
112016
|
import { existsSync as existsSync19, readdirSync as readdirSync7 } from "node:fs";
|
|
111980
112017
|
import { readFile as readFile12 } from "node:fs/promises";
|
|
111981
112018
|
import { dirname as dirname16, join as join25 } from "node:path";
|
|
112019
|
+
async function readSkillFromRoot(skillsRoot, skillId) {
|
|
112020
|
+
const discovery = await discoverSkills(skillsRoot, undefined, {
|
|
112021
|
+
sources: ["project"],
|
|
112022
|
+
skipBundled: true
|
|
112023
|
+
});
|
|
112024
|
+
const discoveredSkill = discovery.skills.find((candidate) => candidate.id === skillId);
|
|
112025
|
+
if (!discoveredSkill) {
|
|
112026
|
+
return null;
|
|
112027
|
+
}
|
|
112028
|
+
try {
|
|
112029
|
+
const content = await readFile12(discoveredSkill.path, "utf-8");
|
|
112030
|
+
return { content, path: discoveredSkill.path };
|
|
112031
|
+
} catch {
|
|
112032
|
+
return null;
|
|
112033
|
+
}
|
|
112034
|
+
}
|
|
111982
112035
|
function getMemorySkillsDirs(agentId) {
|
|
111983
112036
|
const dirs = new Set;
|
|
111984
112037
|
const scopedMemoryDir = resolveScopedMemoryDir({ agentId });
|
|
@@ -112031,25 +112084,22 @@ async function readSkillContent(skillId, skillsDir, agentId, options = {}) {
|
|
|
112031
112084
|
skillsDir
|
|
112032
112085
|
]);
|
|
112033
112086
|
for (const projectSkillsDir of projectSkillsDirs) {
|
|
112034
|
-
const
|
|
112035
|
-
|
|
112036
|
-
|
|
112037
|
-
|
|
112038
|
-
} catch {}
|
|
112087
|
+
const result = await readSkillFromRoot(projectSkillsDir, skillId);
|
|
112088
|
+
if (result) {
|
|
112089
|
+
return result;
|
|
112090
|
+
}
|
|
112039
112091
|
}
|
|
112040
112092
|
if (agentId) {
|
|
112041
|
-
const
|
|
112042
|
-
|
|
112043
|
-
|
|
112044
|
-
|
|
112045
|
-
} catch {}
|
|
112093
|
+
const result = await readSkillFromRoot(getAgentSkillsDir(agentId), skillId);
|
|
112094
|
+
if (result) {
|
|
112095
|
+
return result;
|
|
112096
|
+
}
|
|
112046
112097
|
}
|
|
112047
112098
|
for (const memorySkillsDir of getMemorySkillsDirs(agentId)) {
|
|
112048
|
-
const
|
|
112049
|
-
|
|
112050
|
-
|
|
112051
|
-
|
|
112052
|
-
} catch {}
|
|
112099
|
+
const result = await readSkillFromRoot(memorySkillsDir, skillId);
|
|
112100
|
+
if (result) {
|
|
112101
|
+
return result;
|
|
112102
|
+
}
|
|
112053
112103
|
}
|
|
112054
112104
|
const sharedMemoryContext = await resolveSharedMemorySkillsContext({
|
|
112055
112105
|
agentId,
|
|
@@ -112064,11 +112114,10 @@ async function readSkillContent(skillId, skillsDir, agentId, options = {}) {
|
|
|
112064
112114
|
return { content, path: sharedSkill.path };
|
|
112065
112115
|
} catch {}
|
|
112066
112116
|
}
|
|
112067
|
-
const
|
|
112068
|
-
|
|
112069
|
-
|
|
112070
|
-
|
|
112071
|
-
} catch {}
|
|
112117
|
+
const globalResult = await readSkillFromRoot(GLOBAL_SKILLS_DIR, skillId);
|
|
112118
|
+
if (globalResult) {
|
|
112119
|
+
return globalResult;
|
|
112120
|
+
}
|
|
112072
112121
|
const bundledSkills = await getBundledSkills();
|
|
112073
112122
|
const bundledSkill = bundledSkills.find((s2) => s2.id === skillId);
|
|
112074
112123
|
if (bundledSkill?.path && isSkillAvailableForAgent(bundledSkill, agentId)) {
|
|
@@ -113233,7 +113282,12 @@ async function executeSubagent(type3, config, model, userPrompt, subagentId, isR
|
|
|
113233
113282
|
if (sandbox) {
|
|
113234
113283
|
debugLog("subagent", `memory subagent child sandboxed via ${sandbox.backend}`);
|
|
113235
113284
|
}
|
|
113236
|
-
const
|
|
113285
|
+
const managedLauncher = wrapManagedWorkloadLauncher([spawnLauncher.command, ...spawnLauncher.args], { env: spawnEnv });
|
|
113286
|
+
const [managedCommand, ...managedArgs] = managedLauncher;
|
|
113287
|
+
if (!managedCommand) {
|
|
113288
|
+
throw new Error("Subagent executable is required");
|
|
113289
|
+
}
|
|
113290
|
+
const proc2 = spawn5(managedCommand, managedArgs, {
|
|
113237
113291
|
cwd: subagentWorkingDirectory,
|
|
113238
113292
|
env: spawnEnv
|
|
113239
113293
|
});
|
|
@@ -192293,6 +192347,13 @@ var init_plugin_registry = __esm(() => {
|
|
|
192293
192347
|
loadedUserPlugins = new Map;
|
|
192294
192348
|
});
|
|
192295
192349
|
|
|
192350
|
+
// src/channels/route-thread-key.ts
|
|
192351
|
+
function resolveChannelRouteThreadKey(threadId) {
|
|
192352
|
+
const trimmed = threadId?.trim();
|
|
192353
|
+
return trimmed && trimmed.length > 0 ? trimmed : CHANNEL_ROOT_THREAD_KEY;
|
|
192354
|
+
}
|
|
192355
|
+
var CHANNEL_ROOT_THREAD_KEY = "__root__";
|
|
192356
|
+
|
|
192296
192357
|
// src/channels/routing.ts
|
|
192297
192358
|
var exports_routing = {};
|
|
192298
192359
|
__export(exports_routing, {
|
|
@@ -192327,12 +192388,8 @@ function notifyChannelRoutesChanged(channelId) {
|
|
|
192327
192388
|
for (const listener of routeChangeListeners)
|
|
192328
192389
|
listener(channelId);
|
|
192329
192390
|
}
|
|
192330
|
-
function normalizeThreadId(threadId) {
|
|
192331
|
-
const trimmed = threadId?.trim();
|
|
192332
|
-
return trimmed && trimmed.length > 0 ? trimmed : "__root__";
|
|
192333
|
-
}
|
|
192334
192391
|
function routeKey(channel, chatId, accountId, threadId) {
|
|
192335
|
-
return `${channel}:${normalizeAccountId3(accountId)}:${chatId}:${
|
|
192392
|
+
return `${channel}:${normalizeAccountId3(accountId)}:${chatId}:${resolveChannelRouteThreadKey(threadId)}`;
|
|
192336
192393
|
}
|
|
192337
192394
|
function loadRoutes(channelId) {
|
|
192338
192395
|
if (loadRoutesOverride) {
|
|
@@ -205581,9 +205638,9 @@ function addTask(input) {
|
|
|
205581
205638
|
const data = readCronFile();
|
|
205582
205639
|
const agentId = input.agent_id;
|
|
205583
205640
|
const conversationId = input.conversation_id ?? "new";
|
|
205584
|
-
const
|
|
205585
|
-
if (
|
|
205586
|
-
throw new Error(`Agent ${agentId} has ${
|
|
205641
|
+
const scheduledCount = data.tasks.filter((task3) => task3.agent_id === agentId && !TERMINAL_TASK_STATUSES.has(task3.status)).length;
|
|
205642
|
+
if (scheduledCount >= MAX_ACTIVE_TASKS_PER_AGENT) {
|
|
205643
|
+
throw new Error(`Agent ${agentId} has ${scheduledCount} active or paused tasks (max ${MAX_ACTIVE_TASKS_PER_AGENT}). Delete some before adding more.`);
|
|
205587
205644
|
}
|
|
205588
205645
|
assertValidCronForPersistence(input.cron);
|
|
205589
205646
|
const now2 = new Date;
|
|
@@ -205718,13 +205775,97 @@ function updateTask2(taskId, updater) {
|
|
|
205718
205775
|
return { ...task2 };
|
|
205719
205776
|
});
|
|
205720
205777
|
}
|
|
205778
|
+
function recordTaskQueued(taskId, trigger, queuedAt) {
|
|
205779
|
+
return updateTask2(taskId, (task2) => {
|
|
205780
|
+
const queuedAtIso = queuedAt.toISOString();
|
|
205781
|
+
if (trigger === "automatic" && !task2.recurring) {
|
|
205782
|
+
task2.status = "fired";
|
|
205783
|
+
task2.fired_at = queuedAtIso;
|
|
205784
|
+
}
|
|
205785
|
+
task2.last_fired_at = queuedAtIso;
|
|
205786
|
+
task2.fire_count += 1;
|
|
205787
|
+
task2.last_run_at = queuedAtIso;
|
|
205788
|
+
task2.last_run_outcome = "queued";
|
|
205789
|
+
task2.last_run_reason = task2.recurring ? "scheduled_time_matched" : "one_off_due";
|
|
205790
|
+
task2.last_run_error = null;
|
|
205791
|
+
});
|
|
205792
|
+
}
|
|
205793
|
+
function pauseTask(taskId) {
|
|
205794
|
+
return withLock(() => {
|
|
205795
|
+
const data = readCronFile();
|
|
205796
|
+
const task2 = data.tasks.find((candidate) => candidate.id === taskId);
|
|
205797
|
+
if (!task2) {
|
|
205798
|
+
return { success: false, found: false, error: "Schedule not found" };
|
|
205799
|
+
}
|
|
205800
|
+
if (task2.status === "paused") {
|
|
205801
|
+
return { success: true, found: true, task: { ...task2 } };
|
|
205802
|
+
}
|
|
205803
|
+
if (task2.status !== "active") {
|
|
205804
|
+
return {
|
|
205805
|
+
success: false,
|
|
205806
|
+
found: true,
|
|
205807
|
+
task: { ...task2 },
|
|
205808
|
+
error: "Completed schedules cannot be paused"
|
|
205809
|
+
};
|
|
205810
|
+
}
|
|
205811
|
+
task2.status = "paused";
|
|
205812
|
+
writeCronFile(data);
|
|
205813
|
+
return { success: true, found: true, task: { ...task2 } };
|
|
205814
|
+
});
|
|
205815
|
+
}
|
|
205816
|
+
function resumeTask(taskId, scheduledFor, now2 = new Date) {
|
|
205817
|
+
return withLock(() => {
|
|
205818
|
+
const data = readCronFile();
|
|
205819
|
+
const task2 = data.tasks.find((candidate) => candidate.id === taskId);
|
|
205820
|
+
if (!task2) {
|
|
205821
|
+
return { success: false, found: false, error: "Schedule not found" };
|
|
205822
|
+
}
|
|
205823
|
+
if (task2.status === "active") {
|
|
205824
|
+
return { success: true, found: true, task: { ...task2 } };
|
|
205825
|
+
}
|
|
205826
|
+
if (task2.status !== "paused") {
|
|
205827
|
+
return {
|
|
205828
|
+
success: false,
|
|
205829
|
+
found: true,
|
|
205830
|
+
task: { ...task2 },
|
|
205831
|
+
error: "Completed schedules cannot be resumed"
|
|
205832
|
+
};
|
|
205833
|
+
}
|
|
205834
|
+
if (!task2.recurring) {
|
|
205835
|
+
const resumeAt = scheduledFor ?? (task2.scheduled_for ? new Date(task2.scheduled_for) : null);
|
|
205836
|
+
if (!resumeAt || Number.isNaN(resumeAt.getTime())) {
|
|
205837
|
+
return {
|
|
205838
|
+
success: false,
|
|
205839
|
+
found: true,
|
|
205840
|
+
task: { ...task2 },
|
|
205841
|
+
error: "A one-off schedule requires a valid scheduled_for timestamp"
|
|
205842
|
+
};
|
|
205843
|
+
}
|
|
205844
|
+
if (resumeAt.getTime() <= now2.getTime()) {
|
|
205845
|
+
return {
|
|
205846
|
+
success: false,
|
|
205847
|
+
found: true,
|
|
205848
|
+
task: { ...task2 },
|
|
205849
|
+
error: "An overdue one-off schedule requires a new future scheduled_for timestamp"
|
|
205850
|
+
};
|
|
205851
|
+
}
|
|
205852
|
+
if (scheduledFor) {
|
|
205853
|
+
task2.scheduled_for = scheduledFor.toISOString();
|
|
205854
|
+
task2.jitter_offset_ms = computeJitter(task2.id, task2.cron, false, scheduledFor, new Date(task2.created_at));
|
|
205855
|
+
}
|
|
205856
|
+
}
|
|
205857
|
+
task2.status = "active";
|
|
205858
|
+
writeCronFile(data);
|
|
205859
|
+
return { success: true, found: true, task: { ...task2 } };
|
|
205860
|
+
});
|
|
205861
|
+
}
|
|
205721
205862
|
function garbageCollect() {
|
|
205722
205863
|
return withLock(() => {
|
|
205723
205864
|
const data = readCronFile();
|
|
205724
205865
|
const cutoff = Date.now() - GC_AGE_MS;
|
|
205725
205866
|
const before2 = data.tasks.length;
|
|
205726
205867
|
data.tasks = data.tasks.filter((t2) => {
|
|
205727
|
-
if (t2.status
|
|
205868
|
+
if (!TERMINAL_TASK_STATUSES.has(t2.status))
|
|
205728
205869
|
return true;
|
|
205729
205870
|
const createdAt = new Date(t2.created_at).getTime();
|
|
205730
205871
|
const terminalAt = Math.max(t2.last_fired_at ? new Date(t2.last_fired_at).getTime() : 0, t2.fired_at ? new Date(t2.fired_at).getTime() : 0, t2.missed_at ? new Date(t2.missed_at).getTime() : 0, createdAt);
|
|
@@ -205748,10 +205889,15 @@ function getCronFileMtime() {
|
|
|
205748
205889
|
return 0;
|
|
205749
205890
|
}
|
|
205750
205891
|
}
|
|
205751
|
-
var CRON_FILE_NAME = "crons.json", LOCK_DIR_NAME = "crons.lock", LOCK_TOKEN_FILE = "owner.json", LOCK_TIMEOUT_MS = 5000, LOCK_RETRY_MS = 50, LOCK_STALE_AGE_MS = 30000, MAX_ACTIVE_TASKS_PER_AGENT = 50, TASK_ID_BYTES = 4, GC_AGE_MS, readProcessIdentityOverride = null;
|
|
205892
|
+
var CRON_FILE_NAME = "crons.json", LOCK_DIR_NAME = "crons.lock", LOCK_TOKEN_FILE = "owner.json", LOCK_TIMEOUT_MS = 5000, LOCK_RETRY_MS = 50, LOCK_STALE_AGE_MS = 30000, MAX_ACTIVE_TASKS_PER_AGENT = 50, TASK_ID_BYTES = 4, GC_AGE_MS, readProcessIdentityOverride = null, TERMINAL_TASK_STATUSES;
|
|
205752
205893
|
var init_cron_file = __esm(() => {
|
|
205753
205894
|
init_parse_interval();
|
|
205754
205895
|
GC_AGE_MS = 24 * 60 * 60 * 1000;
|
|
205896
|
+
TERMINAL_TASK_STATUSES = new Set([
|
|
205897
|
+
"fired",
|
|
205898
|
+
"missed",
|
|
205899
|
+
"cancelled"
|
|
205900
|
+
]);
|
|
205755
205901
|
});
|
|
205756
205902
|
|
|
205757
205903
|
// src/cron/run-log.ts
|
|
@@ -206820,7 +206966,7 @@ function handleInvalidRecurringTask(task2, now2) {
|
|
|
206820
206966
|
});
|
|
206821
206967
|
return true;
|
|
206822
206968
|
}
|
|
206823
|
-
async function fireCronTask(task2, timing2, socket, opts, processQueuedTurn) {
|
|
206969
|
+
async function fireCronTask(task2, timing2, socket, opts, processQueuedTurn, trigger) {
|
|
206824
206970
|
const listener = getActiveRuntime();
|
|
206825
206971
|
if (!listener) {
|
|
206826
206972
|
setLastRunOutcome(task2.id, {
|
|
@@ -206870,6 +207016,9 @@ async function fireCronTask(task2, timing2, socket, opts, processQueuedTurn) {
|
|
|
206870
207016
|
return false;
|
|
206871
207017
|
}
|
|
206872
207018
|
const conversationRuntime = ensureConversationQueueRuntime(listener, rawRuntime);
|
|
207019
|
+
if (trigger === "automatic" && getTask2(task2.id)?.status !== "active") {
|
|
207020
|
+
return false;
|
|
207021
|
+
}
|
|
206873
207022
|
const text2 = wrapCronPrompt(task2, timing2);
|
|
206874
207023
|
const queuedItem = conversationRuntime.queueRuntime.enqueue({
|
|
206875
207024
|
kind: "cron_prompt",
|
|
@@ -206898,31 +207047,12 @@ async function fireCronTask(task2, timing2, socket, opts, processQueuedTurn) {
|
|
|
206898
207047
|
}
|
|
206899
207048
|
scheduleQueuePump(conversationRuntime, socket, opts, processQueuedTurn);
|
|
206900
207049
|
const nowIso = timing2.schedulerNow.toISOString();
|
|
206901
|
-
|
|
206902
|
-
|
|
206903
|
-
t2.last_fired_at = nowIso;
|
|
206904
|
-
t2.fire_count += 1;
|
|
206905
|
-
t2.last_run_at = nowIso;
|
|
206906
|
-
t2.last_run_outcome = "queued";
|
|
206907
|
-
t2.last_run_reason = "scheduled_time_matched";
|
|
206908
|
-
t2.last_run_error = null;
|
|
206909
|
-
});
|
|
206910
|
-
} else {
|
|
206911
|
-
updateTask2(task2.id, (t2) => {
|
|
206912
|
-
t2.status = "fired";
|
|
206913
|
-
t2.fired_at = nowIso;
|
|
206914
|
-
t2.last_fired_at = nowIso;
|
|
206915
|
-
t2.fire_count = 1;
|
|
206916
|
-
t2.last_run_at = nowIso;
|
|
206917
|
-
t2.last_run_outcome = "queued";
|
|
206918
|
-
t2.last_run_reason = "one_off_due";
|
|
206919
|
-
t2.last_run_error = null;
|
|
206920
|
-
});
|
|
206921
|
-
}
|
|
207050
|
+
recordTaskQueued(task2.id, trigger, timing2.schedulerNow);
|
|
207051
|
+
const runReason = task2.recurring ? "scheduled_time_matched" : "one_off_due";
|
|
206922
207052
|
safeAppendCronRunLogForTask(task2, {
|
|
206923
207053
|
status: "ok",
|
|
206924
207054
|
outcome: "queued",
|
|
206925
|
-
reason:
|
|
207055
|
+
reason: runReason,
|
|
206926
207056
|
runAtMs: timing2.schedulerNow.getTime(),
|
|
206927
207057
|
queueItemId: queuedItem.id,
|
|
206928
207058
|
scheduledFor: task2.scheduled_for,
|
|
@@ -206972,12 +207102,12 @@ async function runCronTaskNow(taskId) {
|
|
|
206972
207102
|
if (!task2) {
|
|
206973
207103
|
return { success: false, found: false, error: "Schedule not found" };
|
|
206974
207104
|
}
|
|
206975
|
-
if (task2.status !== "active") {
|
|
207105
|
+
if (task2.status !== "active" && task2.status !== "paused") {
|
|
206976
207106
|
return {
|
|
206977
207107
|
success: false,
|
|
206978
207108
|
found: true,
|
|
206979
207109
|
task: task2,
|
|
206980
|
-
error: "
|
|
207110
|
+
error: "Completed schedules cannot run again"
|
|
206981
207111
|
};
|
|
206982
207112
|
}
|
|
206983
207113
|
const ctx = schedulerState ?? listenerFireContext;
|
|
@@ -206993,7 +207123,7 @@ async function runCronTaskNow(taskId) {
|
|
|
206993
207123
|
const fired = await fireCronTask(task2, {
|
|
206994
207124
|
intendedOccurrence: getIntendedCronOccurrence(task2, schedulerNow),
|
|
206995
207125
|
schedulerNow
|
|
206996
|
-
}, ctx.socket, ctx.opts, ctx.processQueuedTurn);
|
|
207126
|
+
}, ctx.socket, ctx.opts, ctx.processQueuedTurn, "manual");
|
|
206997
207127
|
if (!fired) {
|
|
206998
207128
|
return {
|
|
206999
207129
|
success: false,
|
|
@@ -207045,7 +207175,7 @@ function tick2(state, socket, opts, processQueuedTurn) {
|
|
|
207045
207175
|
if (!freshTask || freshTask.status !== "active")
|
|
207046
207176
|
return;
|
|
207047
207177
|
const schedulerNow = new Date;
|
|
207048
|
-
fireCronTask(freshTask, { intendedOccurrence, schedulerNow }, socket, opts, processQueuedTurn).catch((err) => {
|
|
207178
|
+
fireCronTask(freshTask, { intendedOccurrence, schedulerNow }, socket, opts, processQueuedTurn, "automatic").catch((err) => {
|
|
207049
207179
|
console.error(`[Cron] Error firing task ${taskId}:`, err);
|
|
207050
207180
|
setLastRunOutcome(freshTask.id, {
|
|
207051
207181
|
outcome: "failed",
|
|
@@ -208704,12 +208834,12 @@ function rowToolCalls(row, index, diagnostics2) {
|
|
|
208704
208834
|
}
|
|
208705
208835
|
return calls;
|
|
208706
208836
|
}
|
|
208707
|
-
function
|
|
208837
|
+
function contentText(content) {
|
|
208708
208838
|
if (typeof content === "string") {
|
|
208709
208839
|
if (content.startsWith(CONTENT_JSON_PREFIX)) {
|
|
208710
208840
|
const encoded = content.slice(CONTENT_JSON_PREFIX.length);
|
|
208711
208841
|
try {
|
|
208712
|
-
return
|
|
208842
|
+
return contentText(JSON.parse(encoded));
|
|
208713
208843
|
} catch {
|
|
208714
208844
|
return encoded;
|
|
208715
208845
|
}
|
|
@@ -208795,7 +208925,7 @@ var init_hermes = __esm(() => {
|
|
|
208795
208925
|
});
|
|
208796
208926
|
};
|
|
208797
208927
|
if (row.role === "user") {
|
|
208798
|
-
const content =
|
|
208928
|
+
const content = contentText(row.content);
|
|
208799
208929
|
if (content) {
|
|
208800
208930
|
emit({
|
|
208801
208931
|
type: "message",
|
|
@@ -208815,7 +208945,7 @@ var init_hermes = __esm(() => {
|
|
|
208815
208945
|
...timestamp ? { timestamp } : {}
|
|
208816
208946
|
});
|
|
208817
208947
|
}
|
|
208818
|
-
const content =
|
|
208948
|
+
const content = contentText(row.content);
|
|
208819
208949
|
if (content) {
|
|
208820
208950
|
emit({
|
|
208821
208951
|
type: "message",
|
|
@@ -208838,7 +208968,7 @@ var init_hermes = __esm(() => {
|
|
|
208838
208968
|
if (row.role === "tool") {
|
|
208839
208969
|
emit({
|
|
208840
208970
|
type: "tool_result",
|
|
208841
|
-
content:
|
|
208971
|
+
content: contentText(row.content),
|
|
208842
208972
|
...typeof row.tool_call_id === "string" && row.tool_call_id ? { callId: row.tool_call_id } : {},
|
|
208843
208973
|
...timestamp ? { timestamp } : {}
|
|
208844
208974
|
});
|
|
@@ -216944,6 +217074,26 @@ var init_channel_service_validation = __esm(() => {
|
|
|
216944
217074
|
]);
|
|
216945
217075
|
});
|
|
216946
217076
|
|
|
217077
|
+
// src/websocket/listener/cron-protocol-inbound.ts
|
|
217078
|
+
function isCronTriggerCommand(value) {
|
|
217079
|
+
if (!value || typeof value !== "object")
|
|
217080
|
+
return false;
|
|
217081
|
+
const command = value;
|
|
217082
|
+
return command.type === "cron_trigger" && typeof command.request_id === "string" && typeof command.task_id === "string";
|
|
217083
|
+
}
|
|
217084
|
+
function isCronPauseCommand(value) {
|
|
217085
|
+
if (!value || typeof value !== "object")
|
|
217086
|
+
return false;
|
|
217087
|
+
const command = value;
|
|
217088
|
+
return command.type === "cron_pause" && typeof command.request_id === "string" && typeof command.task_id === "string";
|
|
217089
|
+
}
|
|
217090
|
+
function isCronResumeCommand(value) {
|
|
217091
|
+
if (!value || typeof value !== "object")
|
|
217092
|
+
return false;
|
|
217093
|
+
const command = value;
|
|
217094
|
+
return command.type === "cron_resume" && typeof command.request_id === "string" && typeof command.task_id === "string" && (command.scheduled_for === undefined || typeof command.scheduled_for === "string");
|
|
217095
|
+
}
|
|
217096
|
+
|
|
216947
217097
|
// src/websocket/listener/cwd-protocol-inbound.ts
|
|
216948
217098
|
function isGetCwdMapCommand(value) {
|
|
216949
217099
|
if (!value || typeof value !== "object")
|
|
@@ -217468,12 +217618,6 @@ function isCronRunsCommand(value) {
|
|
|
217468
217618
|
const c = value;
|
|
217469
217619
|
return c.type === "cron_runs" && typeof c.request_id === "string" && typeof c.task_id === "string" && (c.limit === undefined || typeof c.limit === "number") && (c.offset === undefined || typeof c.offset === "number") && (c.run_id === undefined || typeof c.run_id === "string");
|
|
217470
217620
|
}
|
|
217471
|
-
function isCronTriggerCommand(value) {
|
|
217472
|
-
if (!value || typeof value !== "object")
|
|
217473
|
-
return false;
|
|
217474
|
-
const c = value;
|
|
217475
|
-
return c.type === "cron_trigger" && typeof c.request_id === "string" && typeof c.task_id === "string";
|
|
217476
|
-
}
|
|
217477
217621
|
function isCronUpdateCommand(value) {
|
|
217478
217622
|
if (!value || typeof value !== "object")
|
|
217479
217623
|
return false;
|
|
@@ -217825,7 +217969,7 @@ function parseServerMessage(data) {
|
|
|
217825
217969
|
const teleportCommand = parseTeleportCommand(parsed);
|
|
217826
217970
|
if (teleportCommand)
|
|
217827
217971
|
return teleportCommand;
|
|
217828
|
-
if (isInputCommand(parsed) || isChangeDeviceStateCommand(parsed) || isAbortMessageCommand(parsed) || isSyncCommand(parsed) || isRuntimeStartCommand(parsed) || isRuntimeExternalToolsUpdateCommand(parsed) || isExternalToolCallResponseCommand(parsed) || isTerminalSpawnCommand(parsed) || isTerminalInputCommand(parsed) || isTerminalResizeCommand(parsed) || isTerminalKillCommand(parsed) || isSearchFilesCommand(parsed) || isGrepInFilesCommand(parsed) || isListInDirectoryCommand(parsed) || isGetTreeCommand(parsed) || isReadFileCommand(parsed) || isWriteFileCommand(parsed) || isWatchFileCommand(parsed) || isUnwatchFileCommand(parsed) || isEditFileCommand(parsed) || isFileOpsCommand(parsed) || isListMemoryCommand(parsed) || isMemoryHistoryCommand(parsed) || isMemoryFileAtRefCommand(parsed) || isMemoryCommitDiffCommand(parsed) || isReadMemoryFileCommand(parsed) || isWriteMemoryFileCommand(parsed) || isDeleteMemoryFileCommand(parsed) || isEnableMemfsCommand(parsed) || isListModelsCommand(parsed) || isListConnectProvidersCommand(parsed) || isConnectProviderCommand(parsed) || isDisconnectProviderCommand(parsed) || isChatGPTUsageReadCommand(parsed) || isUpdateModelCommand(parsed) || isUpdateToolsetCommand(parsed) || isCronListCommand(parsed) || isCronAddCommand(parsed) || isCronGetCommand(parsed) || isCronRunsCommand(parsed) || isCronTriggerCommand(parsed) || isCronUpdateCommand(parsed) || isCronDeleteCommand(parsed) || isCronDeleteAllCommand(parsed) || isSkillEnableCommand(parsed) || isSkillDisableCommand(parsed) || isAppServerInfoCommand(parsed) || isCreateAgentCommand(parsed) || isAgentListCommand(parsed) || isAgentRetrieveCommand(parsed) || isAgentCreateCommand(parsed) || isAgentUpdateCommand(parsed) || isAgentDeleteCommand(parsed) || isConversationListCommand(parsed) || isConversationRetrieveCommand(parsed) || isConversationCreateCommand(parsed) || isConversationUpdateCommand(parsed) || isConversationRecompileCommand(parsed) || isConversationForkCommand(parsed) || isConversationMessagesListCommand(parsed) || isConversationCompactCommand(parsed) || isSetBootWorkingDirectoryCommand(parsed) || isGetCwdMapCommand(parsed) || isGetExperimentsCommand(parsed) || isSetExperimentCommand(parsed) || isGetReflectionSettingsCommand(parsed) || isSetReflectionSettingsCommand(parsed) || isChannelsListCommand(parsed) || isChannelAccountsListCommand(parsed) || isChannelAccountCreateCommand(parsed) || isChannelAccountUpdateCommand(parsed) || isChannelAccountBindCommand(parsed) || isChannelAccountUnbindCommand(parsed) || isChannelAccountDeleteCommand(parsed) || isChannelAccountStartCommand(parsed) || isChannelAccountStopCommand(parsed) || isChannelGetConfigCommand(parsed) || isChannelSetConfigCommand(parsed) || isChannelStartCommand(parsed) || isChannelStopCommand(parsed) || isChannelPairingsListCommand(parsed) || isChannelPairingBindCommand(parsed) || isChannelRoutesListCommand(parsed) || isChannelTargetsListCommand(parsed) || isChannelTargetBindCommand(parsed) || isChannelRouteUpdateCommand(parsed) || isChannelRouteRemoveCommand(parsed) || isExecuteCommandCommand(parsed) || isRemoveQueueItemCommand(parsed) || isSearchBranchesCommand(parsed) || isCheckoutBranchCommand(parsed) || isSecretListCommand(parsed) || isSecretApplyCommand(parsed)) {
|
|
217972
|
+
if (isInputCommand(parsed) || isChangeDeviceStateCommand(parsed) || isAbortMessageCommand(parsed) || isSyncCommand(parsed) || isRuntimeStartCommand(parsed) || isRuntimeExternalToolsUpdateCommand(parsed) || isExternalToolCallResponseCommand(parsed) || isTerminalSpawnCommand(parsed) || isTerminalInputCommand(parsed) || isTerminalResizeCommand(parsed) || isTerminalKillCommand(parsed) || isSearchFilesCommand(parsed) || isGrepInFilesCommand(parsed) || isListInDirectoryCommand(parsed) || isGetTreeCommand(parsed) || isReadFileCommand(parsed) || isWriteFileCommand(parsed) || isWatchFileCommand(parsed) || isUnwatchFileCommand(parsed) || isEditFileCommand(parsed) || isFileOpsCommand(parsed) || isListMemoryCommand(parsed) || isMemoryHistoryCommand(parsed) || isMemoryFileAtRefCommand(parsed) || isMemoryCommitDiffCommand(parsed) || isReadMemoryFileCommand(parsed) || isWriteMemoryFileCommand(parsed) || isDeleteMemoryFileCommand(parsed) || isEnableMemfsCommand(parsed) || isListModelsCommand(parsed) || isListConnectProvidersCommand(parsed) || isConnectProviderCommand(parsed) || isDisconnectProviderCommand(parsed) || isChatGPTUsageReadCommand(parsed) || isUpdateModelCommand(parsed) || isUpdateToolsetCommand(parsed) || isCronListCommand(parsed) || isCronAddCommand(parsed) || isCronGetCommand(parsed) || isCronRunsCommand(parsed) || isCronTriggerCommand(parsed) || isCronPauseCommand(parsed) || isCronResumeCommand(parsed) || isCronUpdateCommand(parsed) || isCronDeleteCommand(parsed) || isCronDeleteAllCommand(parsed) || isSkillEnableCommand(parsed) || isSkillDisableCommand(parsed) || isAppServerInfoCommand(parsed) || isCreateAgentCommand(parsed) || isAgentListCommand(parsed) || isAgentRetrieveCommand(parsed) || isAgentCreateCommand(parsed) || isAgentUpdateCommand(parsed) || isAgentDeleteCommand(parsed) || isConversationListCommand(parsed) || isConversationRetrieveCommand(parsed) || isConversationCreateCommand(parsed) || isConversationUpdateCommand(parsed) || isConversationRecompileCommand(parsed) || isConversationForkCommand(parsed) || isConversationMessagesListCommand(parsed) || isConversationCompactCommand(parsed) || isSetBootWorkingDirectoryCommand(parsed) || isGetCwdMapCommand(parsed) || isGetExperimentsCommand(parsed) || isSetExperimentCommand(parsed) || isGetReflectionSettingsCommand(parsed) || isSetReflectionSettingsCommand(parsed) || isChannelsListCommand(parsed) || isChannelAccountsListCommand(parsed) || isChannelAccountCreateCommand(parsed) || isChannelAccountUpdateCommand(parsed) || isChannelAccountBindCommand(parsed) || isChannelAccountUnbindCommand(parsed) || isChannelAccountDeleteCommand(parsed) || isChannelAccountStartCommand(parsed) || isChannelAccountStopCommand(parsed) || isChannelGetConfigCommand(parsed) || isChannelSetConfigCommand(parsed) || isChannelStartCommand(parsed) || isChannelStopCommand(parsed) || isChannelPairingsListCommand(parsed) || isChannelPairingBindCommand(parsed) || isChannelRoutesListCommand(parsed) || isChannelTargetsListCommand(parsed) || isChannelTargetBindCommand(parsed) || isChannelRouteUpdateCommand(parsed) || isChannelRouteRemoveCommand(parsed) || isExecuteCommandCommand(parsed) || isRemoveQueueItemCommand(parsed) || isSearchBranchesCommand(parsed) || isCheckoutBranchCommand(parsed) || isSecretListCommand(parsed) || isSecretApplyCommand(parsed)) {
|
|
217829
217973
|
return parsed;
|
|
217830
217974
|
}
|
|
217831
217975
|
const invalidInput = getInvalidInputReason(parsed);
|
|
@@ -218346,6 +218490,42 @@ async function handleCronCommand(parsed, socket, safeSocketSend) {
|
|
|
218346
218490
|
}
|
|
218347
218491
|
return true;
|
|
218348
218492
|
}
|
|
218493
|
+
if (parsed.type === "cron_pause" || parsed.type === "cron_resume") {
|
|
218494
|
+
const responseType = parsed.type === "cron_pause" ? "cron_pause_response" : "cron_resume_response";
|
|
218495
|
+
try {
|
|
218496
|
+
let scheduledFor;
|
|
218497
|
+
if (parsed.type === "cron_resume" && parsed.scheduled_for !== undefined) {
|
|
218498
|
+
scheduledFor = new Date(parsed.scheduled_for);
|
|
218499
|
+
if (Number.isNaN(scheduledFor.getTime())) {
|
|
218500
|
+
throw new Error("Invalid scheduled_for timestamp");
|
|
218501
|
+
}
|
|
218502
|
+
}
|
|
218503
|
+
const result2 = parsed.type === "cron_pause" ? pauseTask(parsed.task_id) : resumeTask(parsed.task_id, scheduledFor);
|
|
218504
|
+
safeSocketSend(socket, {
|
|
218505
|
+
type: responseType,
|
|
218506
|
+
request_id: parsed.request_id,
|
|
218507
|
+
success: result2.success,
|
|
218508
|
+
found: result2.found,
|
|
218509
|
+
...result2.task ? { task: result2.task } : {},
|
|
218510
|
+
...result2.error ? { error: result2.error } : {}
|
|
218511
|
+
}, "listener_cron_send_failed", "listener_cron_command");
|
|
218512
|
+
if (result2.success && result2.task) {
|
|
218513
|
+
emitCronsUpdated2(socket, safeSocketSend, {
|
|
218514
|
+
agent_id: result2.task.agent_id,
|
|
218515
|
+
conversation_id: result2.task.conversation_id
|
|
218516
|
+
});
|
|
218517
|
+
}
|
|
218518
|
+
} catch (err) {
|
|
218519
|
+
safeSocketSend(socket, {
|
|
218520
|
+
type: responseType,
|
|
218521
|
+
request_id: parsed.request_id,
|
|
218522
|
+
success: false,
|
|
218523
|
+
found: getTask2(parsed.task_id) !== null,
|
|
218524
|
+
error: err instanceof Error ? err.message : `Failed to ${parsed.type === "cron_pause" ? "pause" : "resume"} cron`
|
|
218525
|
+
}, "listener_cron_send_failed", "listener_cron_command");
|
|
218526
|
+
}
|
|
218527
|
+
return true;
|
|
218528
|
+
}
|
|
218349
218529
|
if (parsed.type === "cron_update") {
|
|
218350
218530
|
try {
|
|
218351
218531
|
let scheduledForIso;
|
|
@@ -218456,7 +218636,7 @@ async function handleCronCommand(parsed, socket, safeSocketSend) {
|
|
|
218456
218636
|
}
|
|
218457
218637
|
function handleCronProtocolCommand(parsed, context3) {
|
|
218458
218638
|
const { socket, safeSocketSend, runDetachedListenerTask } = context3;
|
|
218459
|
-
if (isCronListCommand(parsed) || isCronAddCommand(parsed) || isCronGetCommand(parsed) || isCronRunsCommand(parsed) || isCronTriggerCommand(parsed) || isCronUpdateCommand(parsed) || isCronDeleteCommand(parsed) || isCronDeleteAllCommand(parsed)) {
|
|
218639
|
+
if (isCronListCommand(parsed) || isCronAddCommand(parsed) || isCronGetCommand(parsed) || isCronRunsCommand(parsed) || isCronTriggerCommand(parsed) || isCronPauseCommand(parsed) || isCronResumeCommand(parsed) || isCronUpdateCommand(parsed) || isCronDeleteCommand(parsed) || isCronDeleteAllCommand(parsed)) {
|
|
218460
218640
|
runDetachedListenerTask("cron_command", async () => {
|
|
218461
218641
|
await handleCronCommand(parsed, socket, safeSocketSend);
|
|
218462
218642
|
});
|
|
@@ -421796,7 +421976,9 @@ class ChannelGateway {
|
|
|
421796
421976
|
return false;
|
|
421797
421977
|
}
|
|
421798
421978
|
this.rememberAcceptedClientMessageId(state, delivery.clientMessageId);
|
|
421799
|
-
const
|
|
421979
|
+
for (const source of delivery.sources) {
|
|
421980
|
+
this.enqueueHook(state, () => this.hooks.onLifecycle({ type: "queued", source }));
|
|
421981
|
+
}
|
|
421800
421982
|
if (response.disposition === "started") {
|
|
421801
421983
|
this.activateSources(state, delivery.clientMessageId, delivery.sources);
|
|
421802
421984
|
state.pendingSourcesByClientMessageId.delete(delivery.clientMessageId);
|
|
@@ -421807,7 +421989,6 @@ class ChannelGateway {
|
|
|
421807
421989
|
}
|
|
421808
421990
|
this.reconcileExplicitQueueRemovals(state);
|
|
421809
421991
|
}
|
|
421810
|
-
await Promise.all(queuedEvents);
|
|
421811
421992
|
return true;
|
|
421812
421993
|
} catch (error4) {
|
|
421813
421994
|
state.pendingSourcesByClientMessageId.delete(delivery.clientMessageId);
|
|
@@ -421907,7 +422088,7 @@ class ChannelGateway {
|
|
|
421907
422088
|
batchId,
|
|
421908
422089
|
sources: routingSources
|
|
421909
422090
|
}) ?? null;
|
|
421910
|
-
|
|
422091
|
+
this.enqueueHook(state, () => this.hooks.onLifecycle({
|
|
421911
422092
|
type: "processing",
|
|
421912
422093
|
batchId,
|
|
421913
422094
|
sources: active.lifecycleSources
|
|
@@ -442342,7 +442523,7 @@ var init_mcp_client = __esm(() => {
|
|
|
442342
442523
|
init_streamableHttp();
|
|
442343
442524
|
DEFAULT_CLIENT_INFO = {
|
|
442344
442525
|
name: "letta-code",
|
|
442345
|
-
version: "0.
|
|
442526
|
+
version: "0.31.1"
|
|
442346
442527
|
};
|
|
442347
442528
|
});
|
|
442348
442529
|
|
|
@@ -491587,7 +491768,7 @@ function useConfigurationHandlers(ctx) {
|
|
|
491587
491768
|
registryHandle,
|
|
491588
491769
|
contextWindow: selectedContextWindow,
|
|
491589
491770
|
reasoningCapabilities
|
|
491590
|
-
}) : getReasoningTierOptionsForHandle2(
|
|
491771
|
+
}) : getReasoningTierOptionsForHandle2(modelHandle, selectedContextWindow, reasoningCapabilities);
|
|
491591
491772
|
const reasoningTierOptions = baseReasoningTierOptions.map((option2) => {
|
|
491592
491773
|
const optionModel = models3.find((entry) => entry.id === option2.modelId);
|
|
491593
491774
|
const serviceTier = modelUpdateArgs?.service_tier;
|
|
@@ -509478,4 +509659,4 @@ function registerBunOAuthFlows() {
|
|
|
509478
509659
|
registerBunOAuthFlows();
|
|
509479
509660
|
await init_src5().then(() => exports_src2);
|
|
509480
509661
|
|
|
509481
|
-
//# debugId=
|
|
509662
|
+
//# debugId=1177A2820C3BD72164756E2164756E21
|