@letta-ai/letta-code 0.34.28 → 0.34.30
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/mcp-oauth.js +2 -2
- package/dist/mcp-oauth.js.map +1 -1
- package/dist/types/agent/memory-git-process.d.ts +10 -0
- package/dist/types/agent/memory-git-process.d.ts.map +1 -0
- package/dist/types/agent/memory-git.d.ts.map +1 -1
- package/dist/types/tools/impl/monitor-timeout.d.ts +3 -0
- package/dist/types/tools/impl/monitor-timeout.d.ts.map +1 -0
- package/dist/types/tools/impl/monitor.d.ts +1 -2
- package/dist/types/tools/impl/monitor.d.ts.map +1 -1
- package/dist/types/tools/impl/shell-runner.d.ts.map +1 -1
- package/dist/types/tools/impl/watch-pr.d.ts.map +1 -1
- package/dist/types/tools/impl/workflow.d.ts +1 -0
- package/dist/types/tools/impl/workflow.d.ts.map +1 -1
- package/dist/types/tools/script-tool-scope.d.ts +2 -0
- package/dist/types/tools/script-tool-scope.d.ts.map +1 -1
- package/dist/types/tools/workflow/types.d.ts +2 -0
- package/dist/types/tools/workflow/types.d.ts.map +1 -1
- package/dist/types/tools/workflow/workflow-engine.d.ts +1 -1
- package/dist/types/tools/workflow/workflow-engine.d.ts.map +1 -1
- package/dist/types/websocket/listener/durable-file-lock.d.ts +2 -0
- package/dist/types/websocket/listener/durable-file-lock.d.ts.map +1 -1
- package/dist/types/websocket/listener/queue.d.ts +0 -1
- package/dist/types/websocket/listener/queue.d.ts.map +1 -1
- package/dist/types/websocket/listener/types.d.ts +6 -0
- package/dist/types/websocket/listener/types.d.ts.map +1 -1
- package/letta.js +374 -229
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/scripts/run-api-integration-tests.ts +20 -1
- package/scripts/source-file-size-baseline.json +2 -2
- package/skills/video-generation/SKILL.md +21 -3
- package/skills/video-generation/references/cinematography.md +217 -0
- package/skills/video-generation/references/example-prompts.md +55 -0
- package/skills/video-generation/references/storytelling.md +269 -0
package/letta.js
CHANGED
|
@@ -6044,7 +6044,7 @@ var package_default;
|
|
|
6044
6044
|
var init_package = __esm(() => {
|
|
6045
6045
|
package_default = {
|
|
6046
6046
|
name: "@letta-ai/letta-code",
|
|
6047
|
-
version: "0.34.
|
|
6047
|
+
version: "0.34.30",
|
|
6048
6048
|
lettaStartupLogProtocol: 1,
|
|
6049
6049
|
lettaConfigDirProtocol: 1,
|
|
6050
6050
|
description: "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
|
|
@@ -102800,6 +102800,83 @@ async function getMemoryGitDir(memoryDir) {
|
|
|
102800
102800
|
}
|
|
102801
102801
|
var init_memory_git_dir = () => {};
|
|
102802
102802
|
|
|
102803
|
+
// src/agent/memory-git-process.ts
|
|
102804
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
102805
|
+
async function execGit(args, options) {
|
|
102806
|
+
let termination = Promise.resolve();
|
|
102807
|
+
let timedOut = false;
|
|
102808
|
+
const child = spawn2("git", args, {
|
|
102809
|
+
cwd: options.cwd,
|
|
102810
|
+
env: options.env,
|
|
102811
|
+
detached: process.platform !== "win32",
|
|
102812
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
102813
|
+
windowsHide: true
|
|
102814
|
+
});
|
|
102815
|
+
let stdout = "";
|
|
102816
|
+
let stderr = "";
|
|
102817
|
+
let bufferError;
|
|
102818
|
+
const collect = (stream11, data) => {
|
|
102819
|
+
if (bufferError)
|
|
102820
|
+
return;
|
|
102821
|
+
if (stream11 === "stdout")
|
|
102822
|
+
stdout += data;
|
|
102823
|
+
else
|
|
102824
|
+
stderr += data;
|
|
102825
|
+
if (Buffer.byteLength(stream11 === "stdout" ? stdout : stderr) > 10 * 1024 * 1024) {
|
|
102826
|
+
bufferError = new Error(`git ${stream11} exceeded maxBuffer`);
|
|
102827
|
+
terminate();
|
|
102828
|
+
}
|
|
102829
|
+
};
|
|
102830
|
+
child.stdout.setEncoding("utf8").on("data", (data) => collect("stdout", data));
|
|
102831
|
+
child.stderr.setEncoding("utf8").on("data", (data) => collect("stderr", data));
|
|
102832
|
+
const closed = new Promise((resolve7) => child.once("close", resolve7));
|
|
102833
|
+
const result = new Promise((resolve7, reject) => {
|
|
102834
|
+
child.once("error", reject);
|
|
102835
|
+
child.once("close", (code2, signal) => {
|
|
102836
|
+
if (timedOut || bufferError || code2 !== 0) {
|
|
102837
|
+
reject(Object.assign(bufferError ?? new Error(`git ${args.join(" ")} failed${timedOut ? " (ETIMEDOUT)" : ""}: ${stderr}`), { code: timedOut ? "ETIMEDOUT" : code2, signal, stdout, stderr }));
|
|
102838
|
+
} else
|
|
102839
|
+
resolve7({ stdout, stderr });
|
|
102840
|
+
});
|
|
102841
|
+
});
|
|
102842
|
+
function terminate() {
|
|
102843
|
+
if (!child.pid)
|
|
102844
|
+
return;
|
|
102845
|
+
if (process.platform === "win32") {
|
|
102846
|
+
termination = new Promise((resolve7) => {
|
|
102847
|
+
const killer = spawn2("taskkill.exe", ["/pid", String(child.pid), "/t", "/f"], { stdio: "ignore", windowsHide: true });
|
|
102848
|
+
killer.once("error", () => {
|
|
102849
|
+
child.kill("SIGKILL");
|
|
102850
|
+
resolve7();
|
|
102851
|
+
});
|
|
102852
|
+
killer.once("close", (code2) => {
|
|
102853
|
+
if (code2 !== 0)
|
|
102854
|
+
child.kill("SIGKILL");
|
|
102855
|
+
resolve7();
|
|
102856
|
+
});
|
|
102857
|
+
});
|
|
102858
|
+
} else {
|
|
102859
|
+
try {
|
|
102860
|
+
process.kill(-child.pid, "SIGKILL");
|
|
102861
|
+
} catch {
|
|
102862
|
+
child.kill("SIGKILL");
|
|
102863
|
+
}
|
|
102864
|
+
}
|
|
102865
|
+
}
|
|
102866
|
+
const timer = options.timeoutMs > 0 ? setTimeout(() => {
|
|
102867
|
+
timedOut = true;
|
|
102868
|
+
terminate();
|
|
102869
|
+
}, options.timeoutMs) : undefined;
|
|
102870
|
+
try {
|
|
102871
|
+
return await result;
|
|
102872
|
+
} finally {
|
|
102873
|
+
clearTimeout(timer);
|
|
102874
|
+
await termination;
|
|
102875
|
+
await closed;
|
|
102876
|
+
}
|
|
102877
|
+
}
|
|
102878
|
+
var init_memory_git_process = () => {};
|
|
102879
|
+
|
|
102803
102880
|
// src/backend/api/memfs-git-proxy.ts
|
|
102804
102881
|
var exports_memfs_git_proxy = {};
|
|
102805
102882
|
__export(exports_memfs_git_proxy, {
|
|
@@ -103472,7 +103549,6 @@ __export(exports_memory_git, {
|
|
|
103472
103549
|
buildGitAuthArgs: () => buildGitAuthArgs,
|
|
103473
103550
|
addGitMemoryTag: () => addGitMemoryTag
|
|
103474
103551
|
});
|
|
103475
|
-
import { execFile as execFileCb } from "node:child_process";
|
|
103476
103552
|
import {
|
|
103477
103553
|
existsSync as existsSync8,
|
|
103478
103554
|
mkdirSync as mkdirSync6,
|
|
@@ -103483,7 +103559,6 @@ import {
|
|
|
103483
103559
|
} from "node:fs";
|
|
103484
103560
|
import { platform } from "node:os";
|
|
103485
103561
|
import { dirname as dirname8, join as join14 } from "node:path";
|
|
103486
|
-
import { promisify as promisify4 } from "node:util";
|
|
103487
103562
|
function getAgentRootDir(agentId) {
|
|
103488
103563
|
return join14(resolveGlobalConfigDir(), "agents", agentId);
|
|
103489
103564
|
}
|
|
@@ -103746,11 +103821,10 @@ async function runGit(cwd, args, token, options) {
|
|
|
103746
103821
|
const timeoutMs = options?.timeoutMs ?? GIT_DEFAULT_TIMEOUT_MS;
|
|
103747
103822
|
let result;
|
|
103748
103823
|
try {
|
|
103749
|
-
result = await
|
|
103824
|
+
result = await execGit(allArgs, {
|
|
103750
103825
|
cwd,
|
|
103751
103826
|
env: buildNonInteractiveGitEnv(),
|
|
103752
|
-
|
|
103753
|
-
timeout: timeoutMs
|
|
103827
|
+
timeoutMs
|
|
103754
103828
|
});
|
|
103755
103829
|
} catch (error4) {
|
|
103756
103830
|
throw redactGitAuthError(error4);
|
|
@@ -104622,10 +104696,11 @@ async function addGitMemoryTag(agentId, prefetchedAgent) {
|
|
|
104622
104696
|
debugWarn("memfs-git", `Failed to add git-memory tag: ${err instanceof Error ? err.message : String(err)}`);
|
|
104623
104697
|
}
|
|
104624
104698
|
}
|
|
104625
|
-
var
|
|
104699
|
+
var RETRYABLE_GIT_HTTP_ERROR_RE, RETRYABLE_GIT_NETWORK_ERROR_RE, MISSING_CWD_GIT_ERROR_RE, NON_FAST_FORWARD_PUSH_ERROR_RE, UNRELATED_HISTORY_PULL_ERROR_RE, NO_UPSTREAM_PULL_ERROR_RE, AGENT_DISPLAY_NAME_TIMEOUT_MS = 3000, HOSTED_BACKEND_HEADER = "x-letta-memfs-backend", HOSTED_BACKEND_VALUE = "hosted", GIT_DEFAULT_TIMEOUT_MS = 60000, GIT_CLONE_TIMEOUT_MS = 180000, gitConfig = (dir, args) => withSerializedGitConfigMutation(dir, () => runGit(dir, args)), MEMORY_REPOSITORY_CONFIG_KEY = "letta.memoryRepository.url", MEMORY_REPOSITORY_PUSH_LOG = "memory-repository-push.log";
|
|
104626
104700
|
var init_memory_git = __esm(() => {
|
|
104627
104701
|
init_memory_constraints_audit();
|
|
104628
104702
|
init_memory_git_dir();
|
|
104703
|
+
init_memory_git_process();
|
|
104629
104704
|
init_memfs_git_proxy();
|
|
104630
104705
|
init_checkout_readiness();
|
|
104631
104706
|
init_debug();
|
|
@@ -104638,7 +104713,6 @@ var init_memory_git = __esm(() => {
|
|
|
104638
104713
|
init_memory_git_hooks();
|
|
104639
104714
|
init_memory_git_signing();
|
|
104640
104715
|
init_memory_git_windows_credentials();
|
|
104641
|
-
execFile3 = promisify4(execFileCb);
|
|
104642
104716
|
RETRYABLE_GIT_HTTP_ERROR_RE = /(?:\bHTTP\s+(?:503|520|521|522|523|524)\b|The requested URL returned error:\s*(?:503|520|521|522|523|524))/i;
|
|
104643
104717
|
RETRYABLE_GIT_NETWORK_ERROR_RE = /(remote end hung up unexpectedly|connection reset by peer|operation timed out|timed out|SIGTERM|ETIMEDOUT)/i;
|
|
104644
104718
|
MISSING_CWD_GIT_ERROR_RE = /(Unable to read current working directory: No such file or directory|\buv_cwd\b|\bcwd\b.*\bENOENT\b)/i;
|
|
@@ -104654,7 +104728,7 @@ __export(exports_personality_default_files, {
|
|
|
104654
104728
|
seedPersonalityDefaultMemoryFiles: () => seedPersonalityDefaultMemoryFiles,
|
|
104655
104729
|
getPersonalityAssetPath: () => getPersonalityAssetPath
|
|
104656
104730
|
});
|
|
104657
|
-
import { execFile as
|
|
104731
|
+
import { execFile as execFileCb } from "node:child_process";
|
|
104658
104732
|
import {
|
|
104659
104733
|
constants as constants2,
|
|
104660
104734
|
copyFileSync,
|
|
@@ -104664,7 +104738,7 @@ import {
|
|
|
104664
104738
|
} from "node:fs";
|
|
104665
104739
|
import { dirname as dirname9, isAbsolute as isAbsolute4, join as join15, relative } from "node:path";
|
|
104666
104740
|
import { fileURLToPath } from "node:url";
|
|
104667
|
-
import { promisify as
|
|
104741
|
+
import { promisify as promisify4 } from "node:util";
|
|
104668
104742
|
function getBundledPersonalityAssetsPath() {
|
|
104669
104743
|
const thisDir = dirname9(fileURLToPath(import.meta.url));
|
|
104670
104744
|
if (thisDir.replaceAll("\\", "/").endsWith("/src/agent")) {
|
|
@@ -104705,7 +104779,7 @@ function resolveMemoryPath(memoryDir, path8) {
|
|
|
104705
104779
|
}
|
|
104706
104780
|
async function hasMemoryFileHistory(memoryDir, relativePath) {
|
|
104707
104781
|
try {
|
|
104708
|
-
const { stdout } = await
|
|
104782
|
+
const { stdout } = await execFile3("git", ["log", "-1", "--format=%H", "--all", "--", relativePath], { cwd: memoryDir, timeout: 1e4 });
|
|
104709
104783
|
return stdout.trim().length > 0;
|
|
104710
104784
|
} catch {
|
|
104711
104785
|
return false;
|
|
@@ -104716,7 +104790,7 @@ async function discardUncommittedFile(memoryDir, relativePath, absolutePath) {
|
|
|
104716
104790
|
unlinkSync3(absolutePath);
|
|
104717
104791
|
} catch {}
|
|
104718
104792
|
try {
|
|
104719
|
-
await
|
|
104793
|
+
await execFile3("git", ["reset", "--quiet", "--", relativePath], {
|
|
104720
104794
|
cwd: memoryDir,
|
|
104721
104795
|
timeout: 1e4
|
|
104722
104796
|
});
|
|
@@ -104811,13 +104885,13 @@ async function seedPersonalityDefaultMemoryFilesBestEffort(params) {
|
|
|
104811
104885
|
};
|
|
104812
104886
|
}
|
|
104813
104887
|
}
|
|
104814
|
-
var
|
|
104888
|
+
var execFile3;
|
|
104815
104889
|
var init_personality_default_files = __esm(() => {
|
|
104816
104890
|
init_backend2();
|
|
104817
104891
|
init_debug();
|
|
104818
104892
|
init_memory_git();
|
|
104819
104893
|
init_personality_presets();
|
|
104820
|
-
|
|
104894
|
+
execFile3 = promisify4(execFileCb);
|
|
104821
104895
|
});
|
|
104822
104896
|
|
|
104823
104897
|
// src/backend/api/providers.ts
|
|
@@ -120370,10 +120444,10 @@ __export(exports_personality, {
|
|
|
120370
120444
|
buildCreateAgentOptionsForPersonality: () => buildCreateAgentOptionsForPersonality,
|
|
120371
120445
|
applyPersonalityToMemory: () => applyPersonalityToMemory
|
|
120372
120446
|
});
|
|
120373
|
-
import { execFile as
|
|
120447
|
+
import { execFile as execFileCb2 } from "node:child_process";
|
|
120374
120448
|
import { existsSync as existsSync17, mkdirSync as mkdirSync11, readFileSync as readFileSync10, writeFileSync as writeFileSync10 } from "node:fs";
|
|
120375
120449
|
import { dirname as dirname11, join as join24 } from "node:path";
|
|
120376
|
-
import { promisify as
|
|
120450
|
+
import { promisify as promisify5 } from "node:util";
|
|
120377
120451
|
function ensureTrailingNewline2(content) {
|
|
120378
120452
|
return `${content.trimEnd()}
|
|
120379
120453
|
`;
|
|
@@ -120532,7 +120606,7 @@ async function applyPersonalityToMemory(params) {
|
|
|
120532
120606
|
const isLocalMemfs = getBackend().capabilities.localMemfs;
|
|
120533
120607
|
const blockDefinitions = getPersonalityBlockDefinitions(params.personalityId, isLocalMemfs ? "local" : "cloud");
|
|
120534
120608
|
const repoDir = isLocalMemfs ? getScopedMemoryFilesystemRoot(params.agentId) : getMemoryRepoDir(params.agentId);
|
|
120535
|
-
const statusResult = await
|
|
120609
|
+
const statusResult = await execFile4("git", ["status", "--porcelain"], {
|
|
120536
120610
|
cwd: repoDir,
|
|
120537
120611
|
timeout: 1e4
|
|
120538
120612
|
});
|
|
@@ -120596,7 +120670,7 @@ async function applyPersonalityToMemory(params) {
|
|
|
120596
120670
|
commitMessage
|
|
120597
120671
|
};
|
|
120598
120672
|
}
|
|
120599
|
-
var
|
|
120673
|
+
var execFile4, PRIMARY_PERSONA_RELATIVE_PATH = "system/persona.md", LEGACY_PERSONA_RELATIVE_PATH = "memory/system/persona.md", PRIMARY_HUMAN_RELATIVE_PATH = "system/human.md", LEGACY_HUMAN_RELATIVE_PATH = "memory/system/human.md";
|
|
120600
120674
|
var init_personality = __esm(() => {
|
|
120601
120675
|
init_backend2();
|
|
120602
120676
|
init_server_url();
|
|
@@ -120605,7 +120679,7 @@ var init_personality = __esm(() => {
|
|
|
120605
120679
|
init_memory_filesystem2();
|
|
120606
120680
|
init_memory_git();
|
|
120607
120681
|
init_personality_presets();
|
|
120608
|
-
|
|
120682
|
+
execFile4 = promisify5(execFileCb2);
|
|
120609
120683
|
});
|
|
120610
120684
|
|
|
120611
120685
|
// src/browser-discovery-server.ts
|
|
@@ -157665,13 +157739,13 @@ var exports_image_resize_sips = {};
|
|
|
157665
157739
|
__export(exports_image_resize_sips, {
|
|
157666
157740
|
convertHeicToJpegWithSips: () => convertHeicToJpegWithSips
|
|
157667
157741
|
});
|
|
157668
|
-
import { execFile as
|
|
157742
|
+
import { execFile as execFile5 } from "node:child_process";
|
|
157669
157743
|
import { mkdtemp as mkdtemp2, readFile as readFile5, rm as rm2, writeFile as writeFile4 } from "node:fs/promises";
|
|
157670
157744
|
import { tmpdir as tmpdir5 } from "node:os";
|
|
157671
157745
|
import { join as join27 } from "node:path";
|
|
157672
157746
|
function execFileAsync2(file, args) {
|
|
157673
157747
|
return new Promise((resolve11, reject2) => {
|
|
157674
|
-
|
|
157748
|
+
execFile5(file, args, (error4) => {
|
|
157675
157749
|
if (error4) {
|
|
157676
157750
|
reject2(error4);
|
|
157677
157751
|
return;
|
|
@@ -157705,7 +157779,7 @@ async function convertHeicToJpegWithSips(buffer) {
|
|
|
157705
157779
|
var init_image_resize_sips = () => {};
|
|
157706
157780
|
|
|
157707
157781
|
// src/utils/image-resize.ts
|
|
157708
|
-
import { spawn as
|
|
157782
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
157709
157783
|
import { existsSync as existsSync19 } from "node:fs";
|
|
157710
157784
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
157711
157785
|
function resolveImageWorkerPath() {
|
|
@@ -157722,7 +157796,7 @@ function resolveImageWorkerPath() {
|
|
|
157722
157796
|
function resizeWithSharpWorker(buffer, inputMediaType) {
|
|
157723
157797
|
return new Promise((resolve11, reject2) => {
|
|
157724
157798
|
const workerPath = resolveImageWorkerPath();
|
|
157725
|
-
const child =
|
|
157799
|
+
const child = spawn3(process.execPath, [workerPath, inputMediaType], {
|
|
157726
157800
|
shell: false,
|
|
157727
157801
|
stdio: ["pipe", "pipe", "pipe"],
|
|
157728
157802
|
windowsHide: true
|
|
@@ -159325,7 +159399,7 @@ function parsePositiveIntFlag(options) {
|
|
|
159325
159399
|
}
|
|
159326
159400
|
|
|
159327
159401
|
// src/cli/helpers/file-autocomplete.ts
|
|
159328
|
-
import { spawn as
|
|
159402
|
+
import { spawn as spawn4, spawnSync as spawnSync3 } from "node:child_process";
|
|
159329
159403
|
import {
|
|
159330
159404
|
chmodSync as chmodSync4,
|
|
159331
159405
|
createWriteStream as createWriteStream2,
|
|
@@ -159471,7 +159545,7 @@ async function walkDirectoryWithFd(baseDir, fdPath, query3, maxResults, signal)
|
|
|
159471
159545
|
resolve12([]);
|
|
159472
159546
|
return;
|
|
159473
159547
|
}
|
|
159474
|
-
const child =
|
|
159548
|
+
const child = spawn4(fdPath, args, {
|
|
159475
159549
|
stdio: ["ignore", "pipe", "pipe"]
|
|
159476
159550
|
});
|
|
159477
159551
|
let stdout = "";
|
|
@@ -163489,7 +163563,7 @@ __export(exports_auto_update, {
|
|
|
163489
163563
|
acquireUpdateLock: () => acquireUpdateLock
|
|
163490
163564
|
});
|
|
163491
163565
|
import {
|
|
163492
|
-
execFile as
|
|
163566
|
+
execFile as execFile6
|
|
163493
163567
|
} from "node:child_process";
|
|
163494
163568
|
import { randomUUID as randomUUID12 } from "node:crypto";
|
|
163495
163569
|
import {
|
|
@@ -163509,7 +163583,7 @@ import {
|
|
|
163509
163583
|
import { readdir as readdir3, rm as rm3 } from "node:fs/promises";
|
|
163510
163584
|
import { homedir as homedir8 } from "node:os";
|
|
163511
163585
|
import { dirname as dirname12, join as join32 } from "node:path";
|
|
163512
|
-
import { promisify as
|
|
163586
|
+
import { promisify as promisify6 } from "node:util";
|
|
163513
163587
|
function debugLog2(...args) {
|
|
163514
163588
|
if (DEBUG) {
|
|
163515
163589
|
console.error("[auto-update]", ...args);
|
|
@@ -164041,7 +164115,7 @@ var init_auto_update = __esm(() => {
|
|
|
164041
164115
|
init_error_reporting();
|
|
164042
164116
|
init_process_liveness();
|
|
164043
164117
|
init_version();
|
|
164044
|
-
execFileAsync3 =
|
|
164118
|
+
execFileAsync3 = promisify6(execFile6);
|
|
164045
164119
|
DEBUG = process.env.LETTA_DEBUG_AUTOUPDATE === "1";
|
|
164046
164120
|
INSTALL_ARG_PREFIX = {
|
|
164047
164121
|
npm: ["install", "-g"],
|
|
@@ -164489,7 +164563,7 @@ var require_cross_spawn = __commonJS((exports, module3) => {
|
|
|
164489
164563
|
var cp3 = __require("child_process");
|
|
164490
164564
|
var parse4 = require_parse2();
|
|
164491
164565
|
var enoent = require_enoent();
|
|
164492
|
-
function
|
|
164566
|
+
function spawn5(command, args, options) {
|
|
164493
164567
|
const parsed = parse4(command, args, options);
|
|
164494
164568
|
const spawned = cp3.spawn(parsed.command, parsed.args, parsed.options);
|
|
164495
164569
|
enoent.hookChildProcess(spawned, parsed);
|
|
@@ -164501,8 +164575,8 @@ var require_cross_spawn = __commonJS((exports, module3) => {
|
|
|
164501
164575
|
result2.error = result2.error || enoent.verifyENOENTSync(result2.status, parsed);
|
|
164502
164576
|
return result2;
|
|
164503
164577
|
}
|
|
164504
|
-
module3.exports =
|
|
164505
|
-
module3.exports.spawn =
|
|
164578
|
+
module3.exports = spawn5;
|
|
164579
|
+
module3.exports.spawn = spawn5;
|
|
164506
164580
|
module3.exports.sync = spawnSync4;
|
|
164507
164581
|
module3.exports._parse = parse4;
|
|
164508
164582
|
module3.exports._enoent = enoent;
|
|
@@ -164510,13 +164584,13 @@ var require_cross_spawn = __commonJS((exports, module3) => {
|
|
|
164510
164584
|
|
|
164511
164585
|
// src/utils/package-manager-spawn.ts
|
|
164512
164586
|
import {
|
|
164513
|
-
spawn as
|
|
164587
|
+
spawn as spawn5
|
|
164514
164588
|
} from "node:child_process";
|
|
164515
164589
|
function isWindowsCommandShim(command) {
|
|
164516
164590
|
return /\.(?:cmd|bat)$/i.test(command);
|
|
164517
164591
|
}
|
|
164518
164592
|
function getPackageManagerProcessFactory({
|
|
164519
|
-
nativeSpawn =
|
|
164593
|
+
nativeSpawn = spawn5,
|
|
164520
164594
|
platform: platform4 = process.platform,
|
|
164521
164595
|
windowsSpawn = import_cross_spawn.default
|
|
164522
164596
|
} = {}) {
|
|
@@ -179295,7 +179369,7 @@ var init_runtime5 = __esm(() => {
|
|
|
179295
179369
|
});
|
|
179296
179370
|
|
|
179297
179371
|
// src/channels/signal/setup-runtime.ts
|
|
179298
|
-
import { execFileSync as execFileSync6, spawn as
|
|
179372
|
+
import { execFileSync as execFileSync6, spawn as spawn6 } from "node:child_process";
|
|
179299
179373
|
import { existsSync as existsSync28 } from "node:fs";
|
|
179300
179374
|
function getSignalDockerRunCommand() {
|
|
179301
179375
|
return [
|
|
@@ -179357,7 +179431,7 @@ function runNativeSignalCli(args) {
|
|
|
179357
179431
|
}
|
|
179358
179432
|
function runNativeSignalCliInteractive(args, onOutput) {
|
|
179359
179433
|
return new Promise((resolve13) => {
|
|
179360
|
-
const child =
|
|
179434
|
+
const child = spawn6("signal-cli", args, {
|
|
179361
179435
|
stdio: ["ignore", "pipe", "pipe"]
|
|
179362
179436
|
});
|
|
179363
179437
|
let output = "";
|
|
@@ -185691,9 +185765,9 @@ function defineLazyProperty(object3, propertyName, valueGetter) {
|
|
|
185691
185765
|
}
|
|
185692
185766
|
|
|
185693
185767
|
// node_modules/default-browser-id/index.js
|
|
185694
|
-
import { promisify as
|
|
185768
|
+
import { promisify as promisify7 } from "node:util";
|
|
185695
185769
|
import process15 from "node:process";
|
|
185696
|
-
import { execFile as
|
|
185770
|
+
import { execFile as execFile7 } from "node:child_process";
|
|
185697
185771
|
async function defaultBrowserId() {
|
|
185698
185772
|
if (process15.platform !== "darwin") {
|
|
185699
185773
|
throw new Error("macOS only");
|
|
@@ -185704,13 +185778,13 @@ async function defaultBrowserId() {
|
|
|
185704
185778
|
}
|
|
185705
185779
|
var execFileAsync4;
|
|
185706
185780
|
var init_default_browser_id = __esm(() => {
|
|
185707
|
-
execFileAsync4 =
|
|
185781
|
+
execFileAsync4 = promisify7(execFile7);
|
|
185708
185782
|
});
|
|
185709
185783
|
|
|
185710
185784
|
// node_modules/run-applescript/index.js
|
|
185711
185785
|
import process16 from "node:process";
|
|
185712
|
-
import { promisify as
|
|
185713
|
-
import { execFile as
|
|
185786
|
+
import { promisify as promisify8 } from "node:util";
|
|
185787
|
+
import { execFile as execFile8, execFileSync as execFileSync7 } from "node:child_process";
|
|
185714
185788
|
async function runAppleScript(script4, { humanReadableOutput = true, signal } = {}) {
|
|
185715
185789
|
if (process16.platform !== "darwin") {
|
|
185716
185790
|
throw new Error("macOS only");
|
|
@@ -185725,7 +185799,7 @@ async function runAppleScript(script4, { humanReadableOutput = true, signal } =
|
|
|
185725
185799
|
}
|
|
185726
185800
|
var execFileAsync5;
|
|
185727
185801
|
var init_run_applescript = __esm(() => {
|
|
185728
|
-
execFileAsync5 =
|
|
185802
|
+
execFileAsync5 = promisify8(execFile8);
|
|
185729
185803
|
});
|
|
185730
185804
|
|
|
185731
185805
|
// node_modules/bundle-name/index.js
|
|
@@ -185738,8 +185812,8 @@ var init_bundle_name = __esm(() => {
|
|
|
185738
185812
|
});
|
|
185739
185813
|
|
|
185740
185814
|
// node_modules/default-browser/windows.js
|
|
185741
|
-
import { promisify as
|
|
185742
|
-
import { execFile as
|
|
185815
|
+
import { promisify as promisify9 } from "node:util";
|
|
185816
|
+
import { execFile as execFile9 } from "node:child_process";
|
|
185743
185817
|
async function defaultBrowser(_execFileAsync = execFileAsync6) {
|
|
185744
185818
|
const { stdout } = await _execFileAsync("reg", [
|
|
185745
185819
|
"QUERY",
|
|
@@ -185760,7 +185834,7 @@ async function defaultBrowser(_execFileAsync = execFileAsync6) {
|
|
|
185760
185834
|
}
|
|
185761
185835
|
var execFileAsync6, windowsBrowserProgIds, UnknownBrowserError;
|
|
185762
185836
|
var init_windows = __esm(() => {
|
|
185763
|
-
execFileAsync6 =
|
|
185837
|
+
execFileAsync6 = promisify9(execFile9);
|
|
185764
185838
|
windowsBrowserProgIds = {
|
|
185765
185839
|
AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
|
|
185766
185840
|
MSEdgeDHTML: { name: "Edge", id: "com.microsoft.edge" },
|
|
@@ -185777,9 +185851,9 @@ var init_windows = __esm(() => {
|
|
|
185777
185851
|
});
|
|
185778
185852
|
|
|
185779
185853
|
// node_modules/default-browser/index.js
|
|
185780
|
-
import { promisify as
|
|
185854
|
+
import { promisify as promisify10 } from "node:util";
|
|
185781
185855
|
import process17 from "node:process";
|
|
185782
|
-
import { execFile as
|
|
185856
|
+
import { execFile as execFile10 } from "node:child_process";
|
|
185783
185857
|
async function defaultBrowser2() {
|
|
185784
185858
|
if (process17.platform === "darwin") {
|
|
185785
185859
|
const id2 = await defaultBrowserId();
|
|
@@ -185802,7 +185876,7 @@ var init_default_browser = __esm(() => {
|
|
|
185802
185876
|
init_default_browser_id();
|
|
185803
185877
|
init_bundle_name();
|
|
185804
185878
|
init_windows();
|
|
185805
|
-
execFileAsync7 =
|
|
185879
|
+
execFileAsync7 = promisify10(execFile10);
|
|
185806
185880
|
});
|
|
185807
185881
|
|
|
185808
185882
|
// node_modules/open/index.js
|
|
@@ -185816,14 +185890,14 @@ import process18 from "node:process";
|
|
|
185816
185890
|
import { Buffer as Buffer5 } from "node:buffer";
|
|
185817
185891
|
import path8 from "node:path";
|
|
185818
185892
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
185819
|
-
import { promisify as
|
|
185893
|
+
import { promisify as promisify11 } from "node:util";
|
|
185820
185894
|
import childProcess from "node:child_process";
|
|
185821
185895
|
import fs13, { constants as fsConstants2 } from "node:fs/promises";
|
|
185822
185896
|
async function getWindowsDefaultBrowserFromWsl() {
|
|
185823
185897
|
const powershellPath = await powerShellPath();
|
|
185824
185898
|
const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
|
|
185825
185899
|
const encodedCommand = Buffer5.from(rawCommand, "utf16le").toString("base64");
|
|
185826
|
-
const { stdout } = await
|
|
185900
|
+
const { stdout } = await execFile11(powershellPath, [
|
|
185827
185901
|
"-NoProfile",
|
|
185828
185902
|
"-NonInteractive",
|
|
185829
185903
|
"-ExecutionPolicy",
|
|
@@ -185859,7 +185933,7 @@ function detectPlatformBinary({ [platform4]: platformBinary }, { wsl }) {
|
|
|
185859
185933
|
}
|
|
185860
185934
|
return detectArchBinary(platformBinary);
|
|
185861
185935
|
}
|
|
185862
|
-
var
|
|
185936
|
+
var execFile11, __dirname2, localXdgOpenPath, platform4, arch2, pTryEach = async (array2, mapper) => {
|
|
185863
185937
|
let latestError;
|
|
185864
185938
|
for (const item of array2) {
|
|
185865
185939
|
try {
|
|
@@ -186038,7 +186112,7 @@ var init_open = __esm(() => {
|
|
|
186038
186112
|
init_wsl_utils();
|
|
186039
186113
|
init_default_browser();
|
|
186040
186114
|
init_is_inside_container();
|
|
186041
|
-
|
|
186115
|
+
execFile11 = promisify11(childProcess.execFile);
|
|
186042
186116
|
__dirname2 = path8.dirname(fileURLToPath3(import.meta.url));
|
|
186043
186117
|
localXdgOpenPath = path8.join(__dirname2, "xdg-open");
|
|
186044
186118
|
({ platform: platform4, arch: arch2 } = process18);
|
|
@@ -211476,7 +211550,7 @@ var init_mcp_client = __esm(() => {
|
|
|
211476
211550
|
init_streamableHttp();
|
|
211477
211551
|
DEFAULT_CLIENT_INFO = {
|
|
211478
211552
|
name: "letta-code",
|
|
211479
|
-
version: "0.34.
|
|
211553
|
+
version: "0.34.30"
|
|
211480
211554
|
};
|
|
211481
211555
|
});
|
|
211482
211556
|
|
|
@@ -214704,19 +214778,27 @@ function getProcessStart(pid, platform5 = process.platform, run = (executable, a
|
|
|
214704
214778
|
return null;
|
|
214705
214779
|
}
|
|
214706
214780
|
}
|
|
214707
|
-
function
|
|
214708
|
-
let
|
|
214709
|
-
|
|
214710
|
-
|
|
214711
|
-
if (
|
|
214712
|
-
|
|
214713
|
-
|
|
214714
|
-
|
|
214715
|
-
|
|
214716
|
-
|
|
214717
|
-
|
|
214781
|
+
function createCurrentDurableLockOwner(readStart = (timeoutMs) => getProcessStart(process.pid, process.platform, undefined, timeoutMs), now2 = () => performance.now()) {
|
|
214782
|
+
let cachedProcessStart;
|
|
214783
|
+
let retryAt = -Infinity;
|
|
214784
|
+
return (processStartTimeoutMs = PROCESS_START_PROBE_TIMEOUT_MS) => {
|
|
214785
|
+
if (cachedProcessStart === undefined && now2() >= retryAt) {
|
|
214786
|
+
const processStart = readStart(processStartTimeoutMs);
|
|
214787
|
+
if (processStart === null)
|
|
214788
|
+
retryAt = now2() + PROCESS_START_RETRY_DELAY_MS;
|
|
214789
|
+
else
|
|
214790
|
+
cachedProcessStart = processStart;
|
|
214791
|
+
}
|
|
214792
|
+
return {
|
|
214793
|
+
token: randomUUID30(),
|
|
214794
|
+
pid: process.pid,
|
|
214795
|
+
processStart: cachedProcessStart ?? null
|
|
214796
|
+
};
|
|
214718
214797
|
};
|
|
214719
214798
|
}
|
|
214799
|
+
function currentDurableLockOwner(processStartTimeoutMs = PROCESS_START_PROBE_TIMEOUT_MS) {
|
|
214800
|
+
return readCurrentDurableLockOwner(processStartTimeoutMs);
|
|
214801
|
+
}
|
|
214720
214802
|
function durableLockOwnerIsAlive(owner, readStart = getProcessStart, probe = (pid) => process.kill(pid, 0)) {
|
|
214721
214803
|
if (!Number.isSafeInteger(owner.pid) || owner.pid <= 0)
|
|
214722
214804
|
return false;
|
|
@@ -215132,8 +215214,10 @@ function acquireDurableFileLock(path12, options = {}) {
|
|
|
215132
215214
|
released = true;
|
|
215133
215215
|
};
|
|
215134
215216
|
}
|
|
215135
|
-
var MAX_OWNER_BYTES = 4096, WAIT_SLICE_MS = 5, PROCESS_START_PROBE_TIMEOUT_MS = 250, MAX_CANDIDATE_SWEEP = 128, INSTALLING_OWNER_NAME = ".installing",
|
|
215136
|
-
var init_durable_file_lock = () => {
|
|
215217
|
+
var MAX_OWNER_BYTES = 4096, WAIT_SLICE_MS = 5, PROCESS_START_PROBE_TIMEOUT_MS = 250, MAX_CANDIDATE_SWEEP = 128, INSTALLING_OWNER_NAME = ".installing", PROCESS_START_RETRY_DELAY_MS = 5000, readCurrentDurableLockOwner;
|
|
215218
|
+
var init_durable_file_lock = __esm(() => {
|
|
215219
|
+
readCurrentDurableLockOwner = createCurrentDurableLockOwner();
|
|
215220
|
+
});
|
|
215137
215221
|
|
|
215138
215222
|
// src/websocket/listener/interrupted-turn-input-ownership.ts
|
|
215139
215223
|
import { readdirSync as readdirSync10 } from "node:fs";
|
|
@@ -215530,7 +215614,7 @@ Important:
|
|
|
215530
215614
|
var init_Bash = () => {};
|
|
215531
215615
|
|
|
215532
215616
|
// src/tools/descriptions/CodeMode.md
|
|
215533
|
-
var CodeMode_default = "Run a JavaScript async function body that calls tools and returns only the results you need.\n\nCall built-in and server-side tools with `await tools.<name>(args)` and MCP tools with `await tools.mcp__server__tool(args)`; `listTools()` and `describeTool(name)` list tools and their schemas. Failed calls throw. `args` holds optional input, and `console.log()` output is captured.\n\nReturns `{ result, output }`. Like Bash, a script still running after a brief wait continues in the background and its result arrives as a task notification; `run_in_background: true` returns the task ID immediately. TaskStop aborts it.\n\nNested calls follow permission rules; calls that need approval fail, so call those tools directly. This is not a security sandbox.\n\nExample:\n\n const texts = await Promise.all(args.paths.map(file_path => tools.Read({ file_path })));\n return texts.map((text, i) => ({ path: args.paths[i], lines: text.split('\\n').length }));\n";
|
|
215617
|
+
var CodeMode_default = "Run a JavaScript async function body that calls tools and returns only the results you need.\n\nCall built-in and server-side tools with `await tools.<name>(args)` and MCP tools with `await tools.mcp__server__tool(args)`; `listTools()` and `describeTool(name)` list tools and their schemas. Failed calls throw. `args` holds optional input, `process.env` holds the variables a Bash command sees plus the agent's secrets, and `console.log()` output is captured.\n\nReturns `{ result, output }`. Like Bash, a script still running after a brief wait continues in the background and its result arrives as a task notification; `run_in_background: true` returns the task ID immediately. TaskStop aborts it.\n\nNested calls follow permission rules; calls that need approval fail, so call those tools directly. This is not a security sandbox.\n\nExample:\n\n const texts = await Promise.all(args.paths.map(file_path => tools.Read({ file_path })));\n return texts.map((text, i) => ({ path: args.paths[i], lines: text.split('\\n').length }));\n";
|
|
215534
215618
|
var init_CodeMode = () => {};
|
|
215535
215619
|
|
|
215536
215620
|
// src/tools/descriptions/Edit.md
|
|
@@ -215634,7 +215718,7 @@ Do not use this tool for root memory files (already loaded) or skills/ (use Skil
|
|
|
215634
215718
|
var init_Memory = () => {};
|
|
215635
215719
|
|
|
215636
215720
|
// src/tools/descriptions/Monitor.md
|
|
215637
|
-
var Monitor_default = 'Start a background monitor that streams events from a long-running script. Each stdout line is an event — you keep working and notifications arrive in the chat. Events arrive on their own schedule and are not replies from the user, even if one lands while you\'re waiting for the user to answer a question.\n\nPick by how many notifications you need:\n- **One** ("tell me when the server is ready / the build finishes") → use **Bash with `run_in_background`** and a command that exits when the condition is true, e.g. `until grep -q "Ready in" dev.log; do sleep 0.5; done`. You get a single completion notification when it exits.\n- **One per occurrence, indefinitely** ("tell me every time an ERROR line appears") → Monitor with an unbounded command (`tail -f`, `inotifywait -m`, `while true`).\n- **One per occurrence, until a known end** ("emit each CI step result, stop when the run completes") → Monitor with a command that emits lines and then exits.\n\nYour script\'s stdout is the event stream. Each line becomes a notification. Exit ends the watch.\n # Each matching log line is an event\n tail -f /var/log/app.log | grep --line-buffered "ERROR"\n # Each file change is an event\n inotifywait -m --format \'%e %f\' /watched/dir\n # Node script that emits events as they arrive (e.g. WebSocket listener)\n node watch-for-events.js\n\nFor open github.com pull requests, use WatchPR instead. It covers the whole PR surface and keeps watching after CI finishes. Use Monitor only when WatchPR does not apply.\n\n**Don\'t use an unbounded command for a single notification.** `tail -f`, `inotifywait -m`, and `while true` never exit on their own, so the monitor stays armed until timeout even after the event has fired. For "tell me when X is ready," use Bash `run_in_background` with an `until` loop instead (one notification, ends in seconds). Note that `tail -f log | grep -m 1 ...` does *not* fix this: if the log goes quiet after the match, `tail` never receives SIGPIPE and the pipeline hangs anyway.\n\n- Every pipe stage must flush per line or matches sit in its buffer unseen: `grep` needs `--line-buffered`, `awk` needs `fflush()`. `head` cannot flush at all — `| head -N` delivers nothing until N matches accumulate, then ends the stream.\n- In poll loops, handle transient failures (`curl ... || true`) — one failed request shouldn\'t kill the monitor.\n- Poll intervals: 30s+ for remote APIs (rate limits), 0.5–1s for local checks.\n- Write a specific `description` — it appears in every notification ("errors in deploy.log" not "watching logs").\n- Only stdout is the event stream. Stderr goes to the output file (readable via Read) but does not trigger notifications — for a command you run directly (e.g. `python train.py 2>&1 | grep --line-buffered ...`), merge stderr with `2>&1` so its failures reach your filter. (No effect on `tail -f` of an existing log — that file only contains what its writer redirected.)\n\n**Coverage — silence is not success.** When watching a job or process for an outcome, your filter must match every terminal state, not just the happy path. A monitor that greps only for the success marker stays silent through a crashloop, a hung process, or an unexpected exit — and silence looks identical to "still running." Before arming, ask: *if this process crashed right now, would my filter emit anything?* If not, widen it.\n # Wrong — silent on crash, hang, or any non-success exit\n tail -f run.log | grep --line-buffered "elapsed_steps="\n # Right — one alternation covering progress + the failure signatures you\'d act on\n tail -f run.log | grep -E --line-buffered "elapsed_steps=|Traceback|Error|FAILED|assert|Killed|OOM"\n\nFor poll loops checking job state, emit on every terminal status (`succeeded|failed|cancelled|timeout`), not just success. If you cannot confidently enumerate the failure signatures, broaden the grep alternation rather than narrow it — some extra noise is better than missing a crashloop.\n\n**Output volume**: Every stdout line is a conversation message, so the filter should be selective — but selective means "the lines you\'d act on," not "only good news." Never pipe raw logs; filter to exactly the success and failure signals you care about. Monitors that produce too many events are automatically stopped; restart with a tighter filter if this happens.\n\nStdout lines within 200ms are batched into a single notification, so multiline output from a single event groups naturally.\n\nThe script runs in the same shell environment as Bash. Exit ends the watch (exit code is reported). Timeout → killed. Set `persistent: true` for session-length watches (log tails, long-lived event streams). In managed Cloud sandboxes, every monitor stops
|
|
215721
|
+
var Monitor_default = 'Start a background monitor that streams events from a long-running script. Each stdout line is an event — you keep working and notifications arrive in the chat. Events arrive on their own schedule and are not replies from the user, even if one lands while you\'re waiting for the user to answer a question.\n\nPick by how many notifications you need:\n- **One** ("tell me when the server is ready / the build finishes") → use **Bash with `run_in_background`** and a command that exits when the condition is true, e.g. `until grep -q "Ready in" dev.log; do sleep 0.5; done`. You get a single completion notification when it exits.\n- **One per occurrence, indefinitely** ("tell me every time an ERROR line appears") → Monitor with an unbounded command (`tail -f`, `inotifywait -m`, `while true`).\n- **One per occurrence, until a known end** ("emit each CI step result, stop when the run completes") → Monitor with a command that emits lines and then exits.\n\nYour script\'s stdout is the event stream. Each line becomes a notification. Exit ends the watch.\n # Each matching log line is an event\n tail -f /var/log/app.log | grep --line-buffered "ERROR"\n # Each file change is an event\n inotifywait -m --format \'%e %f\' /watched/dir\n # Node script that emits events as they arrive (e.g. WebSocket listener)\n node watch-for-events.js\n\nFor open github.com pull requests, use WatchPR instead. It covers the whole PR surface and keeps watching after CI finishes. Use Monitor only when WatchPR does not apply.\n\n**Don\'t use an unbounded command for a single notification.** `tail -f`, `inotifywait -m`, and `while true` never exit on their own, so the monitor stays armed until timeout even after the event has fired. For "tell me when X is ready," use Bash `run_in_background` with an `until` loop instead (one notification, ends in seconds). Note that `tail -f log | grep -m 1 ...` does *not* fix this: if the log goes quiet after the match, `tail` never receives SIGPIPE and the pipeline hangs anyway.\n\n- Every pipe stage must flush per line or matches sit in its buffer unseen: `grep` needs `--line-buffered`, `awk` needs `fflush()`. `head` cannot flush at all — `| head -N` delivers nothing until N matches accumulate, then ends the stream.\n- In poll loops, handle transient failures (`curl ... || true`) — one failed request shouldn\'t kill the monitor.\n- Poll intervals: 30s+ for remote APIs (rate limits), 0.5–1s for local checks.\n- Write a specific `description` — it appears in every notification ("errors in deploy.log" not "watching logs").\n- Only stdout is the event stream. Stderr goes to the output file (readable via Read) but does not trigger notifications — for a command you run directly (e.g. `python train.py 2>&1 | grep --line-buffered ...`), merge stderr with `2>&1` so its failures reach your filter. (No effect on `tail -f` of an existing log — that file only contains what its writer redirected.)\n\n**Coverage — silence is not success.** When watching a job or process for an outcome, your filter must match every terminal state, not just the happy path. A monitor that greps only for the success marker stays silent through a crashloop, a hung process, or an unexpected exit — and silence looks identical to "still running." Before arming, ask: *if this process crashed right now, would my filter emit anything?* If not, widen it.\n # Wrong — silent on crash, hang, or any non-success exit\n tail -f run.log | grep --line-buffered "elapsed_steps="\n # Right — one alternation covering progress + the failure signatures you\'d act on\n tail -f run.log | grep -E --line-buffered "elapsed_steps=|Traceback|Error|FAILED|assert|Killed|OOM"\n\nFor poll loops checking job state, emit on every terminal status (`succeeded|failed|cancelled|timeout`), not just success. If you cannot confidently enumerate the failure signatures, broaden the grep alternation rather than narrow it — some extra noise is better than missing a crashloop.\n\n**Output volume**: Every stdout line is a conversation message, so the filter should be selective — but selective means "the lines you\'d act on," not "only good news." Never pipe raw logs; filter to exactly the success and failure signals you care about. Monitors that produce too many events are automatically stopped; restart with a tighter filter if this happens.\n\nStdout lines within 200ms are batched into a single notification, so multiline output from a single event groups naturally.\n\nThe script runs in the same shell environment as Bash. Exit ends the watch (exit code is reported). Timeout → killed. Set `persistent: true` for session-length watches (log tails, long-lived event streams). In managed Cloud sandboxes, every monitor stops at the per-sandbox cap configured by LETTA_MONITOR_MAX_TIMEOUT_MS (default 1 hour, clamped to 1 hour through 7 days), including persistent monitors; elsewhere persistent monitors run until TaskStop or session end. Call Monitor again to re-arm it if you still need to watch. For much longer Cloud waits, schedule a Wake or cron (which does not keep the sandbox running between turns) and combine it with shorter monitors. Use TaskStop to cancel early.\n\nWhen someone is waiting on the result, set `backup_after_seconds` (e.g. 900). If the monitor goes that long without an event, a durable Wake brings you back to check the real state, so a queued, hung, or dead watch can\'t leave them waiting in silence.\n\n**ws source** — open a WebSocket and stream each incoming text frame as an event. No shell, no polling: the server pushes, you get notified.\n ws: {url: \'wss://events.example.com/stream\', protocols: [\'v1\']},\n description: \'deploy events\',\n\nEach text frame becomes one notification (multiline frames stay as one event). Binary frames are reported as `[binary frame, N bytes]` rather than passed through. Socket close ends the watch with the close code surfaced; errors are surfaced before close. Same rate limiting as bash — a firehose will be suppressed and eventually stopped, so subscribe to a filtered feed where one exists.\n\nPrefer this over `command: \'websocat wss://…\'` — it avoids the extra process and line-buffering pitfalls. Use bash when you need to transform or filter frames with shell tools before they become events.\n\n**script source** — a JavaScript watch loop with the same globals as CodeMode, plus `emit(text)` (one event) and `sleep(ms)`. Returning or throwing ends the watch.\n';
|
|
215638
215722
|
var init_Monitor = () => {};
|
|
215639
215723
|
|
|
215640
215724
|
// src/tools/descriptions/Read.md
|
|
@@ -216156,7 +216240,7 @@ var init_Wake = () => {};
|
|
|
216156
216240
|
// src/tools/descriptions/WatchPR.md
|
|
216157
216241
|
var WatchPR_default = `Watch one open github.com pull request until it merges, closes, is stopped with TaskStop, or the session ends.
|
|
216158
216242
|
|
|
216159
|
-
In managed Cloud sandboxes, WatchPR also stops after
|
|
216243
|
+
In managed Cloud sandboxes, WatchPR also stops after the per-sandbox cap configured by LETTA_MONITOR_MAX_TIMEOUT_MS (default 1 hour, clamped to 1 hour through 7 days) and sends a timeout notification. Call WatchPR again to re-arm it if you still need to watch. For much longer waits, use Wake or cron (which does not keep the sandbox running between turns) and combine it with shorter watches. Local watches have no duration limit.
|
|
216160
216244
|
|
|
216161
216245
|
Use WatchPR instead of writing a Monitor or shell polling loop when you need ongoing notifications about a PR. Start at most one watch per PR. It reports:
|
|
216162
216246
|
|
|
@@ -216173,7 +216257,7 @@ Pass a URL ending at the PR number, such as \`https://github.com/owner/repo/pull
|
|
|
216173
216257
|
var init_WatchPR = () => {};
|
|
216174
216258
|
|
|
216175
216259
|
// src/tools/descriptions/Workflow.md
|
|
216176
|
-
var Workflow_default = "Execute a workflow script that orchestrates multiple subagents deterministically (loops, conditionals, fan-out) rather than model-driven.\n\nWorkflows run in the background: this tool returns immediately with a task ID, and a <task-notification> carrying the script's return value arrives when the workflow completes. Do not poll or sleep for it, and never fabricate the result before it arrives. TaskStop aborts the run. With `wait: true`, the workflow runs in the foreground instead and this tool returns the script's value directly.\n\nScripts that call `agent()` or `decide()` spend money on subagents and model calls. Run one only when the user explicitly asked for a workflow or multi-agent orchestration (\"use a workflow\", \"fan out agents\") or a skill's instructions call this tool; otherwise describe the workflow and ask first. For scripts that only call tools, use CodeMode instead.\n\nScripts can call tools directly: `await tools.<name>(args)` for this turn's built-in tools and `await tools.mcp__server__tool(args)` for the agent's MCP tools, subject to the user's permission rules. `await listTools()` returns `[{ name, description }]`; `await describeTool(name)` returns `{ name, description, inputSchema }`, or `undefined` for an unknown tool.\n\nScripts are plain JavaScript and must begin with `export const meta = {...}`, a pure literal (no variables, calls, or interpolation). Pass the work list via `args`. Prefer `pipeline()` so each item moves to its next stage as soon as it is ready. Await `agent()` calls: failures reject with the cause, `callIndex`, and `conversationId` when available. `parallel()` and `pipeline()` let siblings finish, then reject if any callback failed; a failed pipeline item skips its remaining stages. Catch errors explicitly inside callbacks for best-effort processing.\n\n export const meta = {\n name: 'review-files',\n description: 'Review each file for bugs, verify each finding',\n phases: [{ title: 'Review' }, { title: 'Verify' }],\n }\n const findings = {type: 'object', properties: {bugs: {type: 'array', items: {type: 'string'}}}, required: ['bugs']}\n const verdict = {type: 'object', properties: {real: {type: 'boolean'}}, required: ['real']}\n const results = await pipeline(\n args.files,\n f => agent(`Review ${f} for bugs.`, { phase: 'Review', schema: findings }),\n (review, f) => parallel(review.bugs.map(bug => () =>\n agent(`Is this a real bug in ${f}? ${bug}`, { phase: 'Verify', schema: verdict })\n .then(v => v.real ? { file: f, bug } : null))),\n )\n return results.flat().filter(Boolean)\n\nBefore authoring a script, load the `workflow-authoring` skill — the script API, pipeline-vs-barrier rules, quality patterns, worked examples, and how to diagnose a run.\n";
|
|
216260
|
+
var Workflow_default = "Execute a workflow script that orchestrates multiple subagents deterministically (loops, conditionals, fan-out) rather than model-driven.\n\nWorkflows run in the background: this tool returns immediately with a task ID, and a <task-notification> carrying the script's return value arrives when the workflow completes. Do not poll or sleep for it, and never fabricate the result before it arrives. TaskStop aborts the run. With `wait: true`, the workflow runs in the foreground instead and this tool returns the script's value directly.\n\nScripts that call `agent()` or `decide()` spend money on subagents and model calls. Run one only when the user explicitly asked for a workflow or multi-agent orchestration (\"use a workflow\", \"fan out agents\") or a skill's instructions call this tool; otherwise describe the workflow and ask first. For scripts that only call tools, use CodeMode instead.\n\nScripts can call tools directly: `await tools.<name>(args)` for this turn's built-in tools and `await tools.mcp__server__tool(args)` for the agent's MCP tools, subject to the user's permission rules. `await listTools()` returns `[{ name, description }]`; `await describeTool(name)` returns `{ name, description, inputSchema }`, or `undefined` for an unknown tool.\n\nScripts are plain JavaScript and must begin with `export const meta = {...}`, a pure literal (no variables, calls, or interpolation). Pass the work list via `args`. `process.env` holds the variables a Bash command sees plus the agent's secrets. Prefer `pipeline()` so each item moves to its next stage as soon as it is ready. Await `agent()` calls: failures reject with the cause, `callIndex`, and `conversationId` when available. `parallel()` and `pipeline()` let siblings finish, then reject if any callback failed; a failed pipeline item skips its remaining stages. Catch errors explicitly inside callbacks for best-effort processing.\n\n export const meta = {\n name: 'review-files',\n description: 'Review each file for bugs, verify each finding',\n phases: [{ title: 'Review' }, { title: 'Verify' }],\n }\n const findings = {type: 'object', properties: {bugs: {type: 'array', items: {type: 'string'}}}, required: ['bugs']}\n const verdict = {type: 'object', properties: {real: {type: 'boolean'}}, required: ['real']}\n const results = await pipeline(\n args.files,\n f => agent(`Review ${f} for bugs.`, { phase: 'Review', schema: findings }),\n (review, f) => parallel(review.bugs.map(bug => () =>\n agent(`Is this a real bug in ${f}? ${bug}`, { phase: 'Verify', schema: verdict })\n .then(v => v.real ? { file: f, bug } : null))),\n )\n return results.flat().filter(Boolean)\n\nBefore authoring a script, load the `workflow-authoring` skill — the script API, pipeline-vs-barrier rules, quality patterns, worked examples, and how to diagnose a run.\n";
|
|
216177
216261
|
var init_Workflow = () => {};
|
|
216178
216262
|
|
|
216179
216263
|
// src/tools/descriptions/Write.md
|
|
@@ -219263,7 +219347,7 @@ var init_github_pull_request_tracker = __esm(() => {
|
|
|
219263
219347
|
});
|
|
219264
219348
|
|
|
219265
219349
|
// src/tools/impl/shell-runner.ts
|
|
219266
|
-
import { spawn as
|
|
219350
|
+
import { spawn as spawn8 } from "node:child_process";
|
|
219267
219351
|
import { StringDecoder } from "node:string_decoder";
|
|
219268
219352
|
function buildSpawnError(err, executable, cwd2) {
|
|
219269
219353
|
let message = `Failed to execute command: ${err?.message || "unknown error"}`;
|
|
@@ -219317,7 +219401,7 @@ function killChildProcessTree(childProcess2, signal = "SIGTERM") {
|
|
|
219317
219401
|
return;
|
|
219318
219402
|
}
|
|
219319
219403
|
if (process.platform === "win32") {
|
|
219320
|
-
const taskkill =
|
|
219404
|
+
const taskkill = spawn8("taskkill.exe", ["/pid", String(childProcess2.pid), "/t", "/f"], {
|
|
219321
219405
|
stdio: "ignore",
|
|
219322
219406
|
windowsHide: true
|
|
219323
219407
|
});
|
|
@@ -219349,12 +219433,36 @@ function interruptChildProcessTree(childProcess2) {
|
|
|
219349
219433
|
}
|
|
219350
219434
|
killChildProcessTree(childProcess2, "SIGINT");
|
|
219351
219435
|
}
|
|
219436
|
+
function createPipeProcessKiller(childProcess2) {
|
|
219437
|
+
let exited = false;
|
|
219438
|
+
let forced = false;
|
|
219439
|
+
let drainTimer;
|
|
219440
|
+
childProcess2.once("close", () => clearTimeout(drainTimer));
|
|
219441
|
+
const closePipes = () => {
|
|
219442
|
+
if (!exited || !forced || drainTimer)
|
|
219443
|
+
return;
|
|
219444
|
+
drainTimer = setTimeout(() => {
|
|
219445
|
+
childProcess2.stdin?.destroy();
|
|
219446
|
+
childProcess2.stdout?.destroy();
|
|
219447
|
+
childProcess2.stderr?.destroy();
|
|
219448
|
+
}, 100);
|
|
219449
|
+
};
|
|
219450
|
+
childProcess2.once("exit", () => {
|
|
219451
|
+
exited = true;
|
|
219452
|
+
closePipes();
|
|
219453
|
+
});
|
|
219454
|
+
return (signal) => {
|
|
219455
|
+
forced ||= process.platform === "win32" || signal === "SIGKILL" || signal === 9;
|
|
219456
|
+
killChildProcessTree(childProcess2, signal);
|
|
219457
|
+
closePipes();
|
|
219458
|
+
};
|
|
219459
|
+
}
|
|
219352
219460
|
function spawnPipeProcess(launcher, options, events) {
|
|
219353
219461
|
const [executable, ...args] = launcher;
|
|
219354
219462
|
if (!executable) {
|
|
219355
219463
|
throw new ShellExecutionError("Executable is required");
|
|
219356
219464
|
}
|
|
219357
|
-
const childProcess2 =
|
|
219465
|
+
const childProcess2 = spawn8(executable, args, {
|
|
219358
219466
|
cwd: options.cwd,
|
|
219359
219467
|
env: options.env,
|
|
219360
219468
|
shell: false,
|
|
@@ -219370,9 +219478,7 @@ function spawnPipeProcess(launcher, options, events) {
|
|
|
219370
219478
|
childProcess2.on("error", events.error);
|
|
219371
219479
|
childProcess2.on("close", events.close);
|
|
219372
219480
|
return {
|
|
219373
|
-
kill(
|
|
219374
|
-
killChildProcessTree(childProcess2, signal);
|
|
219375
|
-
},
|
|
219481
|
+
kill: createPipeProcessKiller(childProcess2),
|
|
219376
219482
|
interrupt() {
|
|
219377
219483
|
interruptChildProcessTree(childProcess2);
|
|
219378
219484
|
},
|
|
@@ -219384,7 +219490,7 @@ function spawnPtyBridgeProcess(launcher, options, events) {
|
|
|
219384
219490
|
if (!executable) {
|
|
219385
219491
|
throw new ShellExecutionError("Executable is required");
|
|
219386
219492
|
}
|
|
219387
|
-
const childProcess2 =
|
|
219493
|
+
const childProcess2 = spawn8("node", [
|
|
219388
219494
|
"-e",
|
|
219389
219495
|
NODE_PTY_BRIDGE_SCRIPT,
|
|
219390
219496
|
JSON.stringify({ executable, args, cwd: options.cwd })
|
|
@@ -219404,9 +219510,7 @@ function spawnPtyBridgeProcess(launcher, options, events) {
|
|
|
219404
219510
|
childProcess2.on("error", events.error);
|
|
219405
219511
|
childProcess2.on("close", events.close);
|
|
219406
219512
|
return {
|
|
219407
|
-
kill(
|
|
219408
|
-
killChildProcessTree(childProcess2, signal);
|
|
219409
|
-
},
|
|
219513
|
+
kill: createPipeProcessKiller(childProcess2),
|
|
219410
219514
|
interrupt() {
|
|
219411
219515
|
interruptChildProcessTree(childProcess2);
|
|
219412
219516
|
},
|
|
@@ -222499,7 +222603,7 @@ var init_prompt_executor = __esm(() => {
|
|
|
222499
222603
|
});
|
|
222500
222604
|
|
|
222501
222605
|
// src/hooks/executor.ts
|
|
222502
|
-
import { spawn as
|
|
222606
|
+
import { spawn as spawn9 } from "node:child_process";
|
|
222503
222607
|
function truncateHookFeedback(text2, workingDirectory) {
|
|
222504
222608
|
return truncateByChars(scrubAmbientSecrets(text2), LIMITS.HOOK_OUTPUT_CHARS, "Hook", {
|
|
222505
222609
|
workingDirectory,
|
|
@@ -222532,7 +222636,7 @@ function trySpawnWithLauncher(launcher, workingDirectory, input) {
|
|
|
222532
222636
|
LETTA_WORKING_DIR: _lettaWorkingDir,
|
|
222533
222637
|
...parentEnv
|
|
222534
222638
|
} = process.env;
|
|
222535
|
-
return
|
|
222639
|
+
return spawn9(executable, args, {
|
|
222536
222640
|
cwd: workingDirectory,
|
|
222537
222641
|
env: {
|
|
222538
222642
|
...parentEnv,
|
|
@@ -234329,8 +234433,22 @@ async function createScriptToolScope(parentAgentId, signal) {
|
|
|
234329
234433
|
mcpSession ??= Promise.resolve().then(() => (init_mcp(), exports_mcp)).then((module3) => module3.createAgentMcpSession(parentAgentId));
|
|
234330
234434
|
return mcpSession;
|
|
234331
234435
|
};
|
|
234436
|
+
const { getShellEnv: getShellEnv2 } = await Promise.resolve().then(() => (init_shell_env(), exports_shell_env));
|
|
234437
|
+
const secrets2 = await Promise.resolve().then(() => (init_secrets_store(), exports_secrets_store));
|
|
234438
|
+
if (parentAgentId)
|
|
234439
|
+
await secrets2.ensureSecretsLoaded(parentAgentId).catch(() => {
|
|
234440
|
+
return;
|
|
234441
|
+
});
|
|
234442
|
+
const env6 = {};
|
|
234443
|
+
for (const [key2, value] of Object.entries(getShellEnv2())) {
|
|
234444
|
+
if (typeof value === "string")
|
|
234445
|
+
env6[key2] = value;
|
|
234446
|
+
}
|
|
234447
|
+
if (parentAgentId)
|
|
234448
|
+
Object.assign(env6, secrets2.loadSecrets(parentAgentId));
|
|
234332
234449
|
return {
|
|
234333
234450
|
builtinToolNames,
|
|
234451
|
+
env: env6,
|
|
234334
234452
|
listTools: async () => {
|
|
234335
234453
|
const mcpTools = parentAgentId ? await (await mcp()).listTools().catch(() => []) : [];
|
|
234336
234454
|
return [
|
|
@@ -235032,6 +235150,7 @@ async function executeScript(spawner, options, meta2, extraGlobals) {
|
|
|
235032
235150
|
...spawner ? { agent, decide, parallel, pipeline: pipeline7, phase, log: log3 } : {},
|
|
235033
235151
|
args: options.args,
|
|
235034
235152
|
console: { log: log3, warn: log3, error: log3, info: log3 },
|
|
235153
|
+
process: Object.freeze({ env: Object.freeze({ ...options.env }) }),
|
|
235035
235154
|
...extraGlobals
|
|
235036
235155
|
});
|
|
235037
235156
|
const wrapped = `(async () => { "use strict";
|
|
@@ -236105,8 +236224,8 @@ var init_constants3 = __esm(() => {
|
|
|
236105
236224
|
});
|
|
236106
236225
|
|
|
236107
236226
|
// src/cli/helpers/git-context.ts
|
|
236108
|
-
import { execFile as
|
|
236109
|
-
import { promisify as
|
|
236227
|
+
import { execFile as execFile12, execFileSync as execFileSync10 } from "node:child_process";
|
|
236228
|
+
import { promisify as promisify12 } from "node:util";
|
|
236110
236229
|
function runGit2(args, cwd2) {
|
|
236111
236230
|
try {
|
|
236112
236231
|
return execFileSync10("git", args, {
|
|
@@ -236215,7 +236334,7 @@ async function getGitContextAsync(cwd2, options = {}) {
|
|
|
236215
236334
|
}
|
|
236216
236335
|
var execFileAsync8, GIT_ASYNC_TIMEOUT_MS = 1e4;
|
|
236217
236336
|
var init_git_context = __esm(() => {
|
|
236218
|
-
execFileAsync8 =
|
|
236337
|
+
execFileAsync8 = promisify12(execFile12);
|
|
236219
236338
|
});
|
|
236220
236339
|
|
|
236221
236340
|
// src/websocket/listener/device-git-context.ts
|
|
@@ -239039,9 +239158,9 @@ var init_exit_worktree = __esm(async () => {
|
|
|
239039
239158
|
});
|
|
239040
239159
|
|
|
239041
239160
|
// src/tools/impl/glob.ts
|
|
239042
|
-
import { execFile as
|
|
239161
|
+
import { execFile as execFile13 } from "node:child_process";
|
|
239043
239162
|
import * as path25 from "node:path";
|
|
239044
|
-
import { promisify as
|
|
239163
|
+
import { promisify as promisify13 } from "node:util";
|
|
239045
239164
|
function applyFileLimit(files, workingDirectory) {
|
|
239046
239165
|
const totalFiles = files.length;
|
|
239047
239166
|
if (totalFiles <= LIMITS.GLOB_MAX_FILES) {
|
|
@@ -239108,13 +239227,13 @@ var init_glob = __esm(() => {
|
|
|
239108
239227
|
init_runtime_context();
|
|
239109
239228
|
init_ripgrep_manager();
|
|
239110
239229
|
init_truncation();
|
|
239111
|
-
execFileAsync9 =
|
|
239230
|
+
execFileAsync9 = promisify13(execFile13);
|
|
239112
239231
|
});
|
|
239113
239232
|
|
|
239114
239233
|
// src/tools/impl/grep.ts
|
|
239115
|
-
import { execFile as
|
|
239234
|
+
import { execFile as execFile14 } from "node:child_process";
|
|
239116
239235
|
import * as path26 from "node:path";
|
|
239117
|
-
import { promisify as
|
|
239236
|
+
import { promisify as promisify14 } from "node:util";
|
|
239118
239237
|
function applyOffsetAndLimit(items3, offset, limit4) {
|
|
239119
239238
|
const sliced = items3.slice(offset);
|
|
239120
239239
|
if (limit4 > 0) {
|
|
@@ -239276,7 +239395,7 @@ var init_grep = __esm(() => {
|
|
|
239276
239395
|
init_runtime_context();
|
|
239277
239396
|
init_ripgrep_manager();
|
|
239278
239397
|
init_truncation();
|
|
239279
|
-
execFileAsync10 =
|
|
239398
|
+
execFileAsync10 = promisify14(execFile14);
|
|
239280
239399
|
});
|
|
239281
239400
|
|
|
239282
239401
|
// node_modules/picomatch/lib/constants.js
|
|
@@ -241867,11 +241986,26 @@ var init_monitor_script = __esm(() => {
|
|
|
241867
241986
|
init_process_manager();
|
|
241868
241987
|
});
|
|
241869
241988
|
|
|
241989
|
+
// src/tools/impl/monitor-timeout.ts
|
|
241990
|
+
function getMonitorMaxTimeoutMs() {
|
|
241991
|
+
const value = process.env.LETTA_MONITOR_MAX_TIMEOUT_MS;
|
|
241992
|
+
if (!value || !/^\d+$/.test(value))
|
|
241993
|
+
return DEFAULT_MAX_TIMEOUT_MS;
|
|
241994
|
+
const parsed = Number(value);
|
|
241995
|
+
if (!Number.isInteger(parsed) || parsed <= 0)
|
|
241996
|
+
return DEFAULT_MAX_TIMEOUT_MS;
|
|
241997
|
+
return Math.min(SEVEN_DAYS_MS, Math.max(DEFAULT_MAX_TIMEOUT_MS, parsed));
|
|
241998
|
+
}
|
|
241999
|
+
var DEFAULT_MAX_TIMEOUT_MS = 3600000, SEVEN_DAYS_MS;
|
|
242000
|
+
var init_monitor_timeout = __esm(() => {
|
|
242001
|
+
SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1000;
|
|
242002
|
+
});
|
|
242003
|
+
|
|
241870
242004
|
// src/tools/impl/monitor.ts
|
|
241871
242005
|
import { appendFileSync as appendFileSync7, readFileSync as readFileSync37, writeFileSync as writeFileSync28 } from "node:fs";
|
|
241872
242006
|
import { WebSocket as WebSocket4 } from "ws";
|
|
241873
|
-
function getMonitorTimeoutEvent(timeoutMs) {
|
|
241874
|
-
return isManagedCloudRuntime() && timeoutMs ===
|
|
242007
|
+
function getMonitorTimeoutEvent(timeoutMs, tool = "Monitor") {
|
|
242008
|
+
return isManagedCloudRuntime() && timeoutMs === getMonitorMaxTimeoutMs() ? `${tool} stopped at the ${timeoutMs / 3600000}-hour Cloud sandbox limit. If you still need to watch, simply re-arm it by calling ${tool} again. For much longer waits, schedule a Wake or cron, which does not keep the sandbox running between turns.` : "[Monitor timed out — re-arm if needed.]";
|
|
241875
242009
|
}
|
|
241876
242010
|
function buildMonitorResult(taskId, timeoutMs, persistent, outputFile) {
|
|
241877
242011
|
const lifetime = persistent ? "persistent — runs until TaskStop or session end" : `timeout ${timeoutMs}ms`;
|
|
@@ -241982,8 +242116,8 @@ function normalizeMonitorArgs(args) {
|
|
|
241982
242116
|
if (typeof normalized.description !== "string") {
|
|
241983
242117
|
throw new Error("Monitor description is required");
|
|
241984
242118
|
}
|
|
241985
|
-
if (typeof normalized.timeout_ms !== "number" || !Number.isFinite(normalized.timeout_ms) || normalized.timeout_ms < MIN_TIMEOUT_MS || !normalized.persistent && normalized.timeout_ms >
|
|
241986
|
-
throw new Error(`Monitor timeout_ms must be between ${MIN_TIMEOUT_MS} and ${
|
|
242119
|
+
if (typeof normalized.timeout_ms !== "number" || !Number.isFinite(normalized.timeout_ms) || normalized.timeout_ms < MIN_TIMEOUT_MS || !normalized.persistent && normalized.timeout_ms > getMonitorMaxTimeoutMs()) {
|
|
242120
|
+
throw new Error(`Monitor timeout_ms must be between ${MIN_TIMEOUT_MS} and ${getMonitorMaxTimeoutMs()}`);
|
|
241987
242121
|
}
|
|
241988
242122
|
if (typeof normalized.persistent !== "boolean") {
|
|
241989
242123
|
throw new Error("Monitor persistent must be a boolean");
|
|
@@ -242025,7 +242159,7 @@ function normalizeMonitorArgs(args) {
|
|
|
242025
242159
|
}
|
|
242026
242160
|
if (isManagedCloudRuntime() && normalized.persistent) {
|
|
242027
242161
|
normalized.persistent = false;
|
|
242028
|
-
normalized.timeout_ms =
|
|
242162
|
+
normalized.timeout_ms = getMonitorMaxTimeoutMs();
|
|
242029
242163
|
}
|
|
242030
242164
|
return normalized;
|
|
242031
242165
|
}
|
|
@@ -242520,7 +242654,7 @@ function installMonitorProcessExitCleanup() {
|
|
|
242520
242654
|
monitorProcessExitCleanupInstalled = true;
|
|
242521
242655
|
process.once("exit", stopMonitorsForProcessExit);
|
|
242522
242656
|
}
|
|
242523
|
-
var MIN_TIMEOUT_MS = 1000,
|
|
242657
|
+
var MIN_TIMEOUT_MS = 1000, DEFAULT_TIMEOUT_MS3 = 300000, MONITOR_OUTPUT_FILE_BYTES, WEBSOCKET_MAX_PAYLOAD_BYTES, WEBSOCKET_PROTOCOL_PATTERN, monitorProcessExitCleanupInstalled = false;
|
|
242524
242658
|
var init_monitor = __esm(async () => {
|
|
242525
242659
|
init_strip_ansi();
|
|
242526
242660
|
init_runtime_context();
|
|
@@ -242529,6 +242663,7 @@ var init_monitor = __esm(async () => {
|
|
|
242529
242663
|
init_task_notifications();
|
|
242530
242664
|
init_monitor_event_stream();
|
|
242531
242665
|
init_monitor_script();
|
|
242666
|
+
init_monitor_timeout();
|
|
242532
242667
|
init_process_manager();
|
|
242533
242668
|
init_shell_env();
|
|
242534
242669
|
init_shell_launchers();
|
|
@@ -243024,9 +243159,9 @@ var init_typescript = __esm(() => {
|
|
|
243024
243159
|
throw new Error("LSP auto-download is disabled. Please install typescript-language-server manually: npm install -g typescript-language-server typescript");
|
|
243025
243160
|
}
|
|
243026
243161
|
console.log("[LSP] Installing typescript-language-server and typescript...");
|
|
243027
|
-
const { spawn:
|
|
243162
|
+
const { spawn: spawn10 } = await import("node:child_process");
|
|
243028
243163
|
return new Promise((resolve34, reject2) => {
|
|
243029
|
-
const proc =
|
|
243164
|
+
const proc = spawn10("npm", ["install", "-g", "typescript-language-server", "typescript"], {
|
|
243030
243165
|
stdio: "inherit"
|
|
243031
243166
|
});
|
|
243032
243167
|
proc.on("exit", (code2) => {
|
|
@@ -243099,7 +243234,7 @@ class LSPManager {
|
|
|
243099
243234
|
return existing.client;
|
|
243100
243235
|
}
|
|
243101
243236
|
try {
|
|
243102
|
-
const { spawn:
|
|
243237
|
+
const { spawn: spawn10 } = await import("node:child_process");
|
|
243103
243238
|
const rootUri = process.cwd();
|
|
243104
243239
|
if (serverDef.autoInstall) {
|
|
243105
243240
|
const isAvailable = await serverDef.autoInstall.check();
|
|
@@ -243113,7 +243248,7 @@ class LSPManager {
|
|
|
243113
243248
|
console.error(`[LSP] ${serverDef.id} has no command configured`);
|
|
243114
243249
|
return null;
|
|
243115
243250
|
}
|
|
243116
|
-
const proc =
|
|
243251
|
+
const proc = spawn10(command, serverDef.command.slice(1), {
|
|
243117
243252
|
cwd: rootUri,
|
|
243118
243253
|
env: {
|
|
243119
243254
|
...process.env,
|
|
@@ -243634,7 +243769,7 @@ async function resolveAgentMessageDestination(input, backend3, signal) {
|
|
|
243634
243769
|
var init_agent_message = () => {};
|
|
243635
243770
|
|
|
243636
243771
|
// src/agent/subagents/subagent-process.ts
|
|
243637
|
-
import { spawn as
|
|
243772
|
+
import { spawn as spawn10 } from "node:child_process";
|
|
243638
243773
|
function signalProcessGroup(childProcess2, signal) {
|
|
243639
243774
|
if (!childProcess2.pid)
|
|
243640
243775
|
return;
|
|
@@ -243667,7 +243802,7 @@ async function killWindowsProcessTree(childProcess2) {
|
|
|
243667
243802
|
if (!childProcess2.pid)
|
|
243668
243803
|
return;
|
|
243669
243804
|
await new Promise((resolve35) => {
|
|
243670
|
-
const taskkill =
|
|
243805
|
+
const taskkill = spawn10("taskkill.exe", ["/pid", String(childProcess2.pid), "/t", "/f"], { stdio: "ignore", windowsHide: true });
|
|
243671
243806
|
let settled = false;
|
|
243672
243807
|
const finish = (succeeded) => {
|
|
243673
243808
|
if (settled)
|
|
@@ -243699,7 +243834,7 @@ async function terminateSubagentProcessTree(childProcess2, forceKillGraceMs) {
|
|
|
243699
243834
|
await waitForProcessGroupExit(pid, FORCE_KILL_SETTLE_MS);
|
|
243700
243835
|
}
|
|
243701
243836
|
function spawnSubagentProcess(command, args, options) {
|
|
243702
|
-
const childProcess2 =
|
|
243837
|
+
const childProcess2 = spawn10(command, args, {
|
|
243703
243838
|
cwd: options.cwd,
|
|
243704
243839
|
env: options.env,
|
|
243705
243840
|
detached: process.platform !== "win32"
|
|
@@ -244364,7 +244499,7 @@ class CodexAppServerClient {
|
|
|
244364
244499
|
await this.request("initialize", {
|
|
244365
244500
|
clientInfo: {
|
|
244366
244501
|
name: "letta-code",
|
|
244367
|
-
version: "0.34.
|
|
244502
|
+
version: "0.34.30"
|
|
244368
244503
|
},
|
|
244369
244504
|
capabilities: null
|
|
244370
244505
|
});
|
|
@@ -249887,11 +250022,11 @@ var init_manager4 = __esm(async () => {
|
|
|
249887
250022
|
});
|
|
249888
250023
|
|
|
249889
250024
|
// src/agent/memory-conflict-repair.ts
|
|
249890
|
-
import { execFile as
|
|
250025
|
+
import { execFile as execFile15 } from "node:child_process";
|
|
249891
250026
|
import { randomUUID as randomUUID42 } from "node:crypto";
|
|
249892
250027
|
import { readFile as readFile16, rm as rm9, writeFile as writeFile13 } from "node:fs/promises";
|
|
249893
250028
|
import { join as join68 } from "node:path";
|
|
249894
|
-
import { promisify as
|
|
250029
|
+
import { promisify as promisify15 } from "node:util";
|
|
249895
250030
|
async function readOptional(path29) {
|
|
249896
250031
|
try {
|
|
249897
250032
|
return (await readFile16(path29, "utf8")).trim();
|
|
@@ -249902,7 +250037,7 @@ async function readOptional(path29) {
|
|
|
249902
250037
|
async function describeMemoryConflict(memoryDir, gitDir) {
|
|
249903
250038
|
let head4 = "";
|
|
249904
250039
|
try {
|
|
249905
|
-
const { stdout } = await
|
|
250040
|
+
const { stdout } = await promisify15(execFile15)("git", [
|
|
249906
250041
|
"-C",
|
|
249907
250042
|
memoryDir,
|
|
249908
250043
|
"rev-parse",
|
|
@@ -249917,7 +250052,7 @@ async function describeMemoryConflict(memoryDir, gitDir) {
|
|
|
249917
250052
|
}
|
|
249918
250053
|
async function describeInvalidMemoryHistory(memoryDir) {
|
|
249919
250054
|
try {
|
|
249920
|
-
const { stdout } = await
|
|
250055
|
+
const { stdout } = await promisify15(execFile15)("git", [
|
|
249921
250056
|
"-C",
|
|
249922
250057
|
memoryDir,
|
|
249923
250058
|
"rev-parse",
|
|
@@ -250261,7 +250396,7 @@ ${result3.report}
|
|
|
250261
250396
|
});
|
|
250262
250397
|
return { execution, unsubscribe };
|
|
250263
250398
|
}
|
|
250264
|
-
async function ensureMemoryRepair(params,
|
|
250399
|
+
async function ensureMemoryRepair(params, spawn11, claimRepair = claimMemoryConflictRepair) {
|
|
250265
250400
|
let claim;
|
|
250266
250401
|
try {
|
|
250267
250402
|
const kind = params.result.status === "invalid" ? "invalid" : "conflict";
|
|
@@ -250269,7 +250404,7 @@ async function ensureMemoryRepair(params, spawn10, claimRepair = claimMemoryConf
|
|
|
250269
250404
|
if (claim.status !== "claimed")
|
|
250270
250405
|
return claim.status === "in_progress";
|
|
250271
250406
|
const invalid2 = params.result.status === "invalid";
|
|
250272
|
-
|
|
250407
|
+
spawn11({
|
|
250273
250408
|
subagentType: "memory",
|
|
250274
250409
|
description: invalid2 ? "Repair invalid committed memory" : "Repair memory Git conflict",
|
|
250275
250410
|
prompt: invalid2 ? `The committed memory tree fails the repository's validation, usually because concurrent memory updates were combined. Make one new commit that brings the current memory within the limits while preserving its information: move detail out of oversized files and behind indexes instead of deleting it. Do not change or disable the limits, rewrite history, or perform unrelated edits. If the committed memory already passes validation, stop.
|
|
@@ -252955,8 +253090,8 @@ query($id: ID!, $before: String) {
|
|
|
252955
253090
|
}`;
|
|
252956
253091
|
|
|
252957
253092
|
// src/tools/impl/github-pull-request-watch.ts
|
|
252958
|
-
import { execFile as
|
|
252959
|
-
import { promisify as
|
|
253093
|
+
import { execFile as execFile16 } from "node:child_process";
|
|
253094
|
+
import { promisify as promisify16 } from "node:util";
|
|
252960
253095
|
function authorLogin(author) {
|
|
252961
253096
|
return author?.login || "unknown";
|
|
252962
253097
|
}
|
|
@@ -253485,7 +253620,7 @@ async function fetchGitHubPullRequestSnapshot(ref5, options) {
|
|
|
253485
253620
|
}
|
|
253486
253621
|
var execFileAsync11, MAX_CONSISTENCY_READ_ATTEMPTS = 3, PullRequestChangedDuringReadError;
|
|
253487
253622
|
var init_github_pull_request_watch = __esm(() => {
|
|
253488
|
-
execFileAsync11 =
|
|
253623
|
+
execFileAsync11 = promisify16(execFile16);
|
|
253489
253624
|
PullRequestChangedDuringReadError = class PullRequestChangedDuringReadError extends Error {
|
|
253490
253625
|
};
|
|
253491
253626
|
});
|
|
@@ -253539,6 +253674,7 @@ ${describeGitHubPullRequestSnapshot(initial2)}
|
|
|
253539
253674
|
const secrets2 = {};
|
|
253540
253675
|
let processState;
|
|
253541
253676
|
const persistent = !isManagedCloudRuntime();
|
|
253677
|
+
const maxTimeoutMs = getMonitorMaxTimeoutMs();
|
|
253542
253678
|
let timeout;
|
|
253543
253679
|
const events = createMonitorEventStream({
|
|
253544
253680
|
emit(event) {
|
|
@@ -253605,7 +253741,7 @@ ${describeGitHubPullRequestSnapshot(initial2)}
|
|
|
253605
253741
|
events.finish();
|
|
253606
253742
|
if (processState.status !== "running")
|
|
253607
253743
|
return;
|
|
253608
|
-
const event = getMonitorTimeoutEvent(
|
|
253744
|
+
const event = getMonitorTimeoutEvent(maxTimeoutMs, "WatchPR");
|
|
253609
253745
|
output.append(`
|
|
253610
253746
|
${event}
|
|
253611
253747
|
`);
|
|
@@ -253613,7 +253749,7 @@ ${event}
|
|
|
253613
253749
|
processState.completionNotificationSuppressed = true;
|
|
253614
253750
|
markMonitorFinished(taskId, processState, "failed", null);
|
|
253615
253751
|
processState.process.kill();
|
|
253616
|
-
},
|
|
253752
|
+
}, maxTimeoutMs);
|
|
253617
253753
|
unrefTimer(timeout);
|
|
253618
253754
|
}
|
|
253619
253755
|
const wait = deps.wait ?? defaultWait;
|
|
@@ -253684,7 +253820,7 @@ ${event}
|
|
|
253684
253820
|
content: [
|
|
253685
253821
|
{
|
|
253686
253822
|
type: "text",
|
|
253687
|
-
text: `WatchPR started (task ${taskId}). It will keep watching after CI finishes and report new failures, reviews, comments, conflicts, head changes, merge-state changes, and watcher errors. It stops when the PR merges/closes, on TaskStop, or when this session ends.${persistent ? "" :
|
|
253823
|
+
text: `WatchPR started (task ${taskId}). It will keep watching after CI finishes and report new failures, reviews, comments, conflicts, head changes, merge-state changes, and watcher errors. It stops when the PR merges/closes, on TaskStop, or when this session ends.${persistent ? "" : ` A hard ${maxTimeoutMs / 3600000}-hour limit applies in this Cloud sandbox; call WatchPR again to re-arm it, or use Wake or cron for much longer waits.`}
|
|
253688
253824
|
|
|
253689
253825
|
Current state:
|
|
253690
253826
|
${describeGitHubPullRequestSnapshot(initial2)}
|
|
@@ -253706,6 +253842,7 @@ var init_watch_pr = __esm(async () => {
|
|
|
253706
253842
|
init_github_pull_request_diff();
|
|
253707
253843
|
init_github_pull_request_watch();
|
|
253708
253844
|
init_monitor_event_stream();
|
|
253845
|
+
init_monitor_timeout();
|
|
253709
253846
|
init_process_manager();
|
|
253710
253847
|
await init_monitor();
|
|
253711
253848
|
WATCH_MAX_POLL_MS = 5 * 60000;
|
|
@@ -254371,7 +254508,8 @@ function toolOptions(handle2) {
|
|
|
254371
254508
|
return {
|
|
254372
254509
|
...handle2.callTool ? { callTool: handle2.callTool } : {},
|
|
254373
254510
|
...handle2.builtinToolNames ? { builtinToolNames: handle2.builtinToolNames } : {},
|
|
254374
|
-
...handle2.listTools ? { listTools: handle2.listTools } : {}
|
|
254511
|
+
...handle2.listTools ? { listTools: handle2.listTools } : {},
|
|
254512
|
+
...handle2.env ? { env: handle2.env } : {}
|
|
254375
254513
|
};
|
|
254376
254514
|
}
|
|
254377
254515
|
function formatWorkflowProgressLine(event) {
|
|
@@ -255175,12 +255313,12 @@ var init_Monitor2 = __esm(() => {
|
|
|
255175
255313
|
type: "number",
|
|
255176
255314
|
minimum: 1000,
|
|
255177
255315
|
default: 300000,
|
|
255178
|
-
description: "Kill the monitor after this deadline. Default 300000ms,
|
|
255316
|
+
description: "Kill the monitor after this deadline. Default 300000ms. Maximum is LETTA_MONITOR_MAX_TIMEOUT_MS (default 3600000ms, clamped to 1 hour through 7 days). Ignored when persistent is true."
|
|
255179
255317
|
},
|
|
255180
255318
|
persistent: {
|
|
255181
255319
|
type: "boolean",
|
|
255182
255320
|
default: false,
|
|
255183
|
-
description: "Run until TaskStop or session end. In managed Cloud sandboxes,
|
|
255321
|
+
description: "Run until TaskStop or session end. In managed Cloud sandboxes, the configured monitor cap still applies (default 1 hour); elsewhere there is no timeout. Call Monitor again to re-arm it. For much longer waits in Cloud, use Wake/cron."
|
|
255184
255322
|
},
|
|
255185
255323
|
backup_after_seconds: {
|
|
255186
255324
|
type: "integer",
|
|
@@ -261009,19 +261147,6 @@ function getDequeuedClientMessageIds(runtime, batch) {
|
|
|
261009
261147
|
function shouldQueueInboundMessage(parsed) {
|
|
261010
261148
|
return parsed.messages.some((payload) => ("content" in payload));
|
|
261011
261149
|
}
|
|
261012
|
-
function shouldProcessInboundMessageDirectly(runtime, parsed) {
|
|
261013
|
-
if (!shouldQueueInboundMessage(parsed)) {
|
|
261014
|
-
return false;
|
|
261015
|
-
}
|
|
261016
|
-
if (runtime.queueRuntime.length > 0 || runtime.queuePumpActive || runtime.queuePumpScheduled || runtime.pendingTurns > 0 || runtime.queuedMessagesByItemId.size > 0 || runtime.turnLifecycle.kind !== "idle" || runtime.pendingApprovalResolvers.size > 0 || runtime.pendingApprovalBatchByToolCallId.size > 0 || runtime.recoveredApprovalState !== null || runtime.pendingInterruptedResults !== null || runtime.pendingInterruptedContext !== null || (runtime.pendingInterruptedToolCallIds?.length ?? 0) > 0) {
|
|
261017
|
-
return false;
|
|
261018
|
-
}
|
|
261019
|
-
const activeScope = resolveRuntimeScope(runtime.listener, {
|
|
261020
|
-
agent_id: runtime.agentId,
|
|
261021
|
-
conversation_id: runtime.conversationId
|
|
261022
|
-
});
|
|
261023
|
-
return getListenerBlockedReason(runtime.turnLifecycle.snapshot(), activeScope ? getPendingControlRequestCount(runtime.listener, activeScope) : 0) === null;
|
|
261024
|
-
}
|
|
261025
261150
|
function consumeQueuedTurn(runtime) {
|
|
261026
261151
|
const queuedItems = runtime.queueRuntime.peekReady();
|
|
261027
261152
|
const firstQueuedItem = queuedItems[0];
|
|
@@ -261167,6 +261292,10 @@ function emitQueuePumpBoundary(operation) {
|
|
|
261167
261292
|
}
|
|
261168
261293
|
}
|
|
261169
261294
|
function resolveQueuePumpTransport(runtime, socket) {
|
|
261295
|
+
const first = runtime.queueRuntime.peekReady()[0];
|
|
261296
|
+
if (first?.kind === "message" && first.noCoalesce === true && runtime.queuedMessagesByItemId.get(first.id)?.processOwnedTurn === true) {
|
|
261297
|
+
return getOrCreateProcessTransport(runtime.listener);
|
|
261298
|
+
}
|
|
261170
261299
|
if (runtime.listener.connections.size > 0 || runtime.listener.processTransport !== null) {
|
|
261171
261300
|
const transport3 = getOrCreateProcessTransport(runtime.listener);
|
|
261172
261301
|
if (!isListenerTransportOpen(transport3))
|
|
@@ -261213,7 +261342,10 @@ async function drainQueuedMessages(runtime, socket, opts, processQueuedTurn) {
|
|
|
261213
261342
|
}
|
|
261214
261343
|
const { dequeuedBatch, queuedTurn } = consumedQueuedTurn;
|
|
261215
261344
|
emitQueuePumpBoundary(() => emitDequeuedUserMessage(turnTransport, runtime, queuedTurn, dequeuedBatch));
|
|
261216
|
-
emitQueuePumpBoundary(() =>
|
|
261345
|
+
emitQueuePumpBoundary(() => emitQueueUpdate(turnTransport, runtime, {
|
|
261346
|
+
agent_id: runtime.agentId,
|
|
261347
|
+
conversation_id: runtime.conversationId
|
|
261348
|
+
}));
|
|
261217
261349
|
const preTurnStatus = getListenerStatus(runtime.listener) === "processing" ? "processing" : "receiving";
|
|
261218
261350
|
if (opts.connectionId && runtime.listener.lastEmittedStatus !== preTurnStatus) {
|
|
261219
261351
|
runtime.listener.lastEmittedStatus = preTurnStatus;
|
|
@@ -265555,7 +265687,7 @@ var init_listen_log = __esm(() => {
|
|
|
265555
265687
|
});
|
|
265556
265688
|
|
|
265557
265689
|
// src/utils/machine-metadata.ts
|
|
265558
|
-
import { execFile as
|
|
265690
|
+
import { execFile as execFile17 } from "node:child_process";
|
|
265559
265691
|
import { readFile as readFile20 } from "node:fs/promises";
|
|
265560
265692
|
import { cpus, totalmem } from "node:os";
|
|
265561
265693
|
function getMachineMetadata() {
|
|
@@ -265573,7 +265705,7 @@ function localSources() {
|
|
|
265573
265705
|
memoryBytes: Math.min(totalmem(), limit4 || Number.POSITIVE_INFINITY),
|
|
265574
265706
|
read: (path32, signal) => readFile20(path32, { encoding: "utf8", signal }),
|
|
265575
265707
|
run: (command, args, signal) => new Promise((resolve38, reject2) => {
|
|
265576
|
-
|
|
265708
|
+
execFile17(command, args, {
|
|
265577
265709
|
encoding: "utf8",
|
|
265578
265710
|
signal,
|
|
265579
265711
|
killSignal: "SIGKILL",
|
|
@@ -268801,9 +268933,9 @@ function handleMemoryProtocolCommand(parsed, context3) {
|
|
|
268801
268933
|
if (isMemoryHistoryCommand(parsed)) {
|
|
268802
268934
|
runDetachedListenerTask("memory_history", async () => {
|
|
268803
268935
|
const { getScopedMemoryFilesystemRoot: getScopedMemoryFilesystemRoot2 } = await Promise.resolve().then(() => (init_memory_filesystem2(), exports_memory_filesystem));
|
|
268804
|
-
const { execFile:
|
|
268805
|
-
const { promisify:
|
|
268806
|
-
const execFileAsync12 =
|
|
268936
|
+
const { execFile: execFileCb3 } = await import("node:child_process");
|
|
268937
|
+
const { promisify: promisify17 } = await import("node:util");
|
|
268938
|
+
const execFileAsync12 = promisify17(execFileCb3);
|
|
268807
268939
|
const memoryRoot = getScopedMemoryFilesystemRoot2(parsed.agent_id);
|
|
268808
268940
|
const limit4 = parsed.limit ?? 50;
|
|
268809
268941
|
const gitArgs = ["log", `--max-count=${limit4}`, "--format=%H|%s|%aI|%an"];
|
|
@@ -268837,9 +268969,9 @@ function handleMemoryProtocolCommand(parsed, context3) {
|
|
|
268837
268969
|
if (isMemoryFileAtRefCommand(parsed)) {
|
|
268838
268970
|
runDetachedListenerTask("memory_file_at_ref", async () => {
|
|
268839
268971
|
const { getScopedMemoryFilesystemRoot: getScopedMemoryFilesystemRoot2 } = await Promise.resolve().then(() => (init_memory_filesystem2(), exports_memory_filesystem));
|
|
268840
|
-
const { execFile:
|
|
268841
|
-
const { promisify:
|
|
268842
|
-
const execFileAsync12 =
|
|
268972
|
+
const { execFile: execFileCb3 } = await import("node:child_process");
|
|
268973
|
+
const { promisify: promisify17 } = await import("node:util");
|
|
268974
|
+
const execFileAsync12 = promisify17(execFileCb3);
|
|
268843
268975
|
const memoryRoot = getScopedMemoryFilesystemRoot2(parsed.agent_id);
|
|
268844
268976
|
try {
|
|
268845
268977
|
const { stdout } = await execFileAsync12("git", ["show", `${parsed.ref}:${parsed.file_path}`], { cwd: memoryRoot, timeout: 1e4 });
|
|
@@ -268868,9 +269000,9 @@ function handleMemoryProtocolCommand(parsed, context3) {
|
|
|
268868
269000
|
if (isMemoryCommitDiffCommand(parsed)) {
|
|
268869
269001
|
runDetachedListenerTask("memory_commit_diff", async () => {
|
|
268870
269002
|
const { getScopedMemoryFilesystemRoot: getScopedMemoryFilesystemRoot2 } = await Promise.resolve().then(() => (init_memory_filesystem2(), exports_memory_filesystem));
|
|
268871
|
-
const { execFile:
|
|
268872
|
-
const { promisify:
|
|
268873
|
-
const execFileAsync12 =
|
|
269003
|
+
const { execFile: execFileCb3 } = await import("node:child_process");
|
|
269004
|
+
const { promisify: promisify17 } = await import("node:util");
|
|
269005
|
+
const execFileAsync12 = promisify17(execFileCb3);
|
|
268874
269006
|
const memoryRoot = getScopedMemoryFilesystemRoot2(parsed.agent_id);
|
|
268875
269007
|
try {
|
|
268876
269008
|
const { stdout } = await execFileAsync12("git", ["show", parsed.sha, "--format=", "--no-color"], { cwd: memoryRoot, timeout: 1e4 });
|
|
@@ -442154,7 +442286,7 @@ function installExternalToolBridge(runtime) {
|
|
|
442154
442286
|
const connectionId = registrationKey ? getConnectionIdsByRegistrationKey(runtime).get(registrationKey) : undefined;
|
|
442155
442287
|
const connection = connectionId ? runtime.connections.get(connectionId) : undefined;
|
|
442156
442288
|
if (!connection || !isListenerTransportOpen(connection.writer) || runtime.intentionallyClosed) {
|
|
442157
|
-
throw new Error("External tool controller is not connected");
|
|
442289
|
+
throw new Error("External tool controller is not connected; the tool call was not sent and is safe to retry.");
|
|
442158
442290
|
}
|
|
442159
442291
|
const writer = connection.writer;
|
|
442160
442292
|
const requestId = `external-tool-${crypto.randomUUID()}`;
|
|
@@ -442164,6 +442296,9 @@ function installExternalToolBridge(runtime) {
|
|
|
442164
442296
|
agent_id: toolRuntime.agentId ?? null,
|
|
442165
442297
|
conversation_id: toolRuntime.conversationId
|
|
442166
442298
|
} : undefined;
|
|
442299
|
+
const conversation = requestRuntime ? runtime.conversationRuntimes?.get(getConversationRuntimeKey(requestRuntime.agent_id, requestRuntime.conversation_id)) : null;
|
|
442300
|
+
const lease = conversation?.turnLifecycle.currentLease;
|
|
442301
|
+
const isOwningTurnCurrent = conversation && lease ? () => conversation.turnLifecycle.isCurrent(lease) && !lease.signal.aborted : undefined;
|
|
442167
442302
|
const request2 = {
|
|
442168
442303
|
type: "external_tool_call_request",
|
|
442169
442304
|
request_id: requestId,
|
|
@@ -442173,6 +442308,7 @@ function installExternalToolBridge(runtime) {
|
|
|
442173
442308
|
tool_name: toolName2,
|
|
442174
442309
|
input
|
|
442175
442310
|
};
|
|
442311
|
+
const requestFrame = JSON.stringify(request2);
|
|
442176
442312
|
const timeoutMs = context3?.tool.timeoutMs ?? EXTERNAL_TOOL_CALL_TIMEOUT_MS;
|
|
442177
442313
|
const result3 = await new Promise((resolve38, reject2) => {
|
|
442178
442314
|
const timeout = setTimeout(() => {
|
|
@@ -442181,6 +442317,9 @@ function installExternalToolBridge(runtime) {
|
|
|
442181
442317
|
}, timeoutMs);
|
|
442182
442318
|
getPendingExternalToolCalls(runtime).set(requestKey, {
|
|
442183
442319
|
connectionId: connection.id,
|
|
442320
|
+
isOwningTurnCurrent,
|
|
442321
|
+
requestFrame,
|
|
442322
|
+
sentOn: writer,
|
|
442184
442323
|
resolve: (response) => {
|
|
442185
442324
|
resolve38({
|
|
442186
442325
|
content: [...response.content],
|
|
@@ -442191,7 +442330,7 @@ function installExternalToolBridge(runtime) {
|
|
|
442191
442330
|
timeout
|
|
442192
442331
|
});
|
|
442193
442332
|
try {
|
|
442194
|
-
writer.send(
|
|
442333
|
+
writer.send(requestFrame);
|
|
442195
442334
|
} catch (error5) {
|
|
442196
442335
|
clearTimeout(timeout);
|
|
442197
442336
|
getPendingExternalToolCalls(runtime).delete(requestKey);
|
|
@@ -442252,6 +442391,25 @@ function handleExternalToolCallResponseCommand(runtime, connectionId, command) {
|
|
|
442252
442391
|
pending2.resolve(command.result);
|
|
442253
442392
|
return true;
|
|
442254
442393
|
}
|
|
442394
|
+
function resendPendingExternalToolCallsForConnection(runtime, connection) {
|
|
442395
|
+
const pendingExternalToolCalls = getPendingExternalToolCalls(runtime);
|
|
442396
|
+
for (const [requestKey, pending2] of pendingExternalToolCalls) {
|
|
442397
|
+
if (pending2.connectionId !== connection.id || pending2.sentOn === connection.writer) {
|
|
442398
|
+
continue;
|
|
442399
|
+
}
|
|
442400
|
+
try {
|
|
442401
|
+
if (pending2.isOwningTurnCurrent && !pending2.isOwningTurnCurrent()) {
|
|
442402
|
+
throw new Error("External tool call was not resent because its owning turn is no longer active.");
|
|
442403
|
+
}
|
|
442404
|
+
connection.writer.send(pending2.requestFrame);
|
|
442405
|
+
pending2.sentOn = connection.writer;
|
|
442406
|
+
} catch (error5) {
|
|
442407
|
+
clearTimeout(pending2.timeout);
|
|
442408
|
+
pendingExternalToolCalls.delete(requestKey);
|
|
442409
|
+
pending2.reject(error5 instanceof Error ? error5 : new Error(String(error5)));
|
|
442410
|
+
}
|
|
442411
|
+
}
|
|
442412
|
+
}
|
|
442255
442413
|
function rejectPendingExternalToolCallsForConnection(runtime, connectionId, reason) {
|
|
442256
442414
|
const pendingExternalToolCalls = getPendingExternalToolCalls(runtime);
|
|
442257
442415
|
for (const [requestKey, pending2] of pendingExternalToolCalls) {
|
|
@@ -454029,12 +454187,12 @@ function rowToolCalls(row, index, diagnostics2) {
|
|
|
454029
454187
|
}
|
|
454030
454188
|
return calls;
|
|
454031
454189
|
}
|
|
454032
|
-
function
|
|
454190
|
+
function contentText2(content) {
|
|
454033
454191
|
if (typeof content === "string") {
|
|
454034
454192
|
if (content.startsWith(CONTENT_JSON_PREFIX)) {
|
|
454035
454193
|
const encoded = content.slice(CONTENT_JSON_PREFIX.length);
|
|
454036
454194
|
try {
|
|
454037
|
-
return
|
|
454195
|
+
return contentText2(JSON.parse(encoded));
|
|
454038
454196
|
} catch {
|
|
454039
454197
|
return encoded;
|
|
454040
454198
|
}
|
|
@@ -454120,7 +454278,7 @@ var init_hermes = __esm(() => {
|
|
|
454120
454278
|
});
|
|
454121
454279
|
};
|
|
454122
454280
|
if (row.role === "user") {
|
|
454123
|
-
const content =
|
|
454281
|
+
const content = contentText2(row.content);
|
|
454124
454282
|
if (content) {
|
|
454125
454283
|
emit({
|
|
454126
454284
|
type: "message",
|
|
@@ -454140,7 +454298,7 @@ var init_hermes = __esm(() => {
|
|
|
454140
454298
|
...timestamp ? { timestamp } : {}
|
|
454141
454299
|
});
|
|
454142
454300
|
}
|
|
454143
|
-
const content =
|
|
454301
|
+
const content = contentText2(row.content);
|
|
454144
454302
|
if (content) {
|
|
454145
454303
|
emit({
|
|
454146
454304
|
type: "message",
|
|
@@ -454163,7 +454321,7 @@ var init_hermes = __esm(() => {
|
|
|
454163
454321
|
if (row.role === "tool") {
|
|
454164
454322
|
emit({
|
|
454165
454323
|
type: "tool_result",
|
|
454166
|
-
content:
|
|
454324
|
+
content: contentText2(row.content),
|
|
454167
454325
|
...typeof row.tool_call_id === "string" && row.tool_call_id ? { callId: row.tool_call_id } : {},
|
|
454168
454326
|
...timestamp ? { timestamp } : {}
|
|
454169
454327
|
});
|
|
@@ -455428,7 +455586,7 @@ var init_core5 = __esm(() => {
|
|
|
455428
455586
|
});
|
|
455429
455587
|
|
|
455430
455588
|
// node_modules/@letta-ai/trajectory/dist/adapters/deepagents/index.js
|
|
455431
|
-
import { spawn as
|
|
455589
|
+
import { spawn as spawn11 } from "node:child_process";
|
|
455432
455590
|
import { accessSync as accessSync2, constants as constants6 } from "node:fs";
|
|
455433
455591
|
import { homedir as homedir22 } from "node:os";
|
|
455434
455592
|
import { join as join85 } from "node:path";
|
|
@@ -455459,7 +455617,7 @@ async function loadDeepAgentsCheckpoint(checkpoint) {
|
|
|
455459
455617
|
const python = checkpoint.pythonExecutable ?? process.env.PYTHON ?? "python3";
|
|
455460
455618
|
const helper = resolveHelperPath();
|
|
455461
455619
|
return await new Promise((resolve38, reject2) => {
|
|
455462
|
-
const child =
|
|
455620
|
+
const child = spawn11(python, [helper], {
|
|
455463
455621
|
stdio: ["pipe", "pipe", "pipe"],
|
|
455464
455622
|
windowsHide: true
|
|
455465
455623
|
});
|
|
@@ -457340,16 +457498,16 @@ var init_post_turn_reflection = __esm(() => {
|
|
|
457340
457498
|
});
|
|
457341
457499
|
|
|
457342
457500
|
// src/agent/memory-worktree.ts
|
|
457343
|
-
import { execFile as
|
|
457501
|
+
import { execFile as execFileCb3 } from "node:child_process";
|
|
457344
457502
|
import { randomUUID as randomUUID52 } from "node:crypto";
|
|
457345
457503
|
import { existsSync as existsSync62 } from "node:fs";
|
|
457346
457504
|
import { mkdir as mkdir14 } from "node:fs/promises";
|
|
457347
457505
|
import { dirname as dirname36, isAbsolute as isAbsolute25, join as join95, resolve as resolve38 } from "node:path";
|
|
457348
|
-
import { promisify as
|
|
457506
|
+
import { promisify as promisify17 } from "node:util";
|
|
457349
457507
|
async function runGit4(cwd2, args) {
|
|
457350
457508
|
try {
|
|
457351
457509
|
const allArgs = [...GIT_DISABLE_COMMIT_SIGNING_ARGS, ...args];
|
|
457352
|
-
const { stdout, stderr } = await
|
|
457510
|
+
const { stdout, stderr } = await execFile18("git", allArgs, {
|
|
457353
457511
|
cwd: cwd2,
|
|
457354
457512
|
env: {
|
|
457355
457513
|
...process.env,
|
|
@@ -457718,7 +457876,7 @@ async function finalizeReflectionMemoryWorktreeUnlocked(worktree, options) {
|
|
|
457718
457876
|
async function finalizeReflectionMemoryWorktree(worktree, options) {
|
|
457719
457877
|
return withMemoryOperation(worktree.parentMemoryDir, () => finalizeReflectionMemoryWorktreeUnlocked(worktree, options));
|
|
457720
457878
|
}
|
|
457721
|
-
var
|
|
457879
|
+
var execFile18, GIT_TIMEOUT_MS = 30000, HARNESS_GIT_ENV;
|
|
457722
457880
|
var init_memory_worktree = __esm(() => {
|
|
457723
457881
|
init_memory_auth();
|
|
457724
457882
|
init_memory_git();
|
|
@@ -457726,7 +457884,7 @@ var init_memory_worktree = __esm(() => {
|
|
|
457726
457884
|
init_memory_operation();
|
|
457727
457885
|
init_memfs_git_proxy();
|
|
457728
457886
|
init_debug();
|
|
457729
|
-
|
|
457887
|
+
execFile18 = promisify17(execFileCb3);
|
|
457730
457888
|
HARNESS_GIT_ENV = {
|
|
457731
457889
|
GIT_AUTHOR_NAME: "Letta Code",
|
|
457732
457890
|
GIT_AUTHOR_EMAIL: "noreply@letta.com",
|
|
@@ -460673,7 +460831,7 @@ var init_connection_state_sync = __esm(async () => {
|
|
|
460673
460831
|
});
|
|
460674
460832
|
|
|
460675
460833
|
// src/websocket/listener/grep-in-files.ts
|
|
460676
|
-
import { execFile as
|
|
460834
|
+
import { execFile as execFile19 } from "node:child_process";
|
|
460677
460835
|
import { createRequire as createRequire8 } from "node:module";
|
|
460678
460836
|
import * as path42 from "node:path";
|
|
460679
460837
|
import { fileURLToPath as fileURLToPath10 } from "node:url";
|
|
@@ -460729,7 +460887,7 @@ async function runGrepInFiles(args) {
|
|
|
460729
460887
|
}
|
|
460730
460888
|
function runRipgrep2(rgArgs) {
|
|
460731
460889
|
return new Promise((resolve39, reject2) => {
|
|
460732
|
-
const child =
|
|
460890
|
+
const child = execFile19(rgPath, rgArgs, {
|
|
460733
460891
|
maxBuffer: 50 * 1024 * 1024
|
|
460734
460892
|
}, (error5, stdout, _stderr) => {
|
|
460735
460893
|
if (error5 && error5.code !== 1) {
|
|
@@ -462654,7 +462812,7 @@ var init_mod_commands = __esm(async () => {
|
|
|
462654
462812
|
});
|
|
462655
462813
|
|
|
462656
462814
|
// src/websocket/listener/commands.ts
|
|
462657
|
-
import { spawn as
|
|
462815
|
+
import { spawn as spawn12 } from "node:child_process";
|
|
462658
462816
|
async function handleExecuteCommand(command, socket, conversationRuntime, opts) {
|
|
462659
462817
|
const scope = {
|
|
462660
462818
|
agent_id: conversationRuntime.agentId,
|
|
@@ -462891,7 +463049,7 @@ function scheduleRemoteRestart(connectionName, log3) {
|
|
|
462891
463049
|
setTimeout(async () => {
|
|
462892
463050
|
await flushRemoteSettingsWrites();
|
|
462893
463051
|
log3(`spawning replacement listener: ${process.execPath} ${entrypoint} remote --computer-name ${connectionName}`);
|
|
462894
|
-
const child =
|
|
463052
|
+
const child = spawn12(process.execPath, [entrypoint, "remote", "--computer-name", connectionName], {
|
|
462895
463053
|
cwd: process.cwd(),
|
|
462896
463054
|
detached: true,
|
|
462897
463055
|
env: process.env,
|
|
@@ -464074,8 +464232,8 @@ var init_connect_providers = __esm(async () => {
|
|
|
464074
464232
|
});
|
|
464075
464233
|
|
|
464076
464234
|
// src/websocket/listener/commands/git-branches.ts
|
|
464077
|
-
import { execFile as
|
|
464078
|
-
import { promisify as
|
|
464235
|
+
import { execFile as execFile20 } from "node:child_process";
|
|
464236
|
+
import { promisify as promisify18 } from "node:util";
|
|
464079
464237
|
function handleGitBranchCommand(parsed, context3) {
|
|
464080
464238
|
const { socket, runtime, safeSocketSend, runDetachedListenerTask: runDetachedListenerTask2 } = context3;
|
|
464081
464239
|
if (isSearchBranchesCommand(parsed)) {
|
|
@@ -464083,7 +464241,7 @@ function handleGitBranchCommand(parsed, context3) {
|
|
|
464083
464241
|
try {
|
|
464084
464242
|
const cwd2 = parsed.cwd ?? getBootWorkingDirectory(runtime);
|
|
464085
464243
|
const maxResults = parsed.max_results ?? 20;
|
|
464086
|
-
const execFileAsync12 =
|
|
464244
|
+
const execFileAsync12 = promisify18(execFile20);
|
|
464087
464245
|
const { stdout } = await execFileAsync12("git", ["branch", "-a", "--format=%(refname:short)\t%(HEAD)"], {
|
|
464088
464246
|
cwd: cwd2,
|
|
464089
464247
|
encoding: "utf-8",
|
|
@@ -464123,7 +464281,7 @@ function handleGitBranchCommand(parsed, context3) {
|
|
|
464123
464281
|
runDetachedListenerTask2("checkout_branch", async () => {
|
|
464124
464282
|
try {
|
|
464125
464283
|
const cwd2 = parsed.cwd ?? getBootWorkingDirectory(runtime);
|
|
464126
|
-
const execFileAsync12 =
|
|
464284
|
+
const execFileAsync12 = promisify18(execFile20);
|
|
464127
464285
|
const args = parsed.create ? ["checkout", "-b", parsed.branch] : ["checkout", parsed.branch];
|
|
464128
464286
|
await execFileAsync12("git", args, {
|
|
464129
464287
|
cwd: cwd2,
|
|
@@ -464360,7 +464518,7 @@ function dispatchInboundMessageWhenReady(params) {
|
|
|
464360
464518
|
acknowledgeInput({ accepted: false });
|
|
464361
464519
|
return;
|
|
464362
464520
|
}
|
|
464363
|
-
if (shouldQueueInboundMessage(incoming)
|
|
464521
|
+
if (shouldQueueInboundMessage(incoming)) {
|
|
464364
464522
|
const committed = commitInputDisposition(runtime, reservation, "queued", { incoming: attributedIncoming, actingUserId });
|
|
464365
464523
|
let accepted = false;
|
|
464366
464524
|
try {
|
|
@@ -464403,18 +464561,8 @@ function dispatchInboundMessageWhenReady(params) {
|
|
|
464403
464561
|
acknowledgeInput({ accepted: false });
|
|
464404
464562
|
return;
|
|
464405
464563
|
}
|
|
464406
|
-
const directBatchId = `batch-direct-${crypto.randomUUID()}`;
|
|
464407
|
-
if (identity2) {
|
|
464408
|
-
runtime.dequeuedInputIdentitiesByBatchId.set(directBatchId, [
|
|
464409
|
-
identity2
|
|
464410
|
-
]);
|
|
464411
|
-
}
|
|
464412
464564
|
acknowledgeInput({ accepted: true, disposition: "started" });
|
|
464413
|
-
|
|
464414
|
-
await processIncomingMessage(attributedIncoming, getOrCreateProcessTransport(listener), runtime, options.onStatusChange, options.connectionId, directBatchId);
|
|
464415
|
-
} finally {
|
|
464416
|
-
runtime.dequeuedInputIdentitiesByBatchId.delete(directBatchId);
|
|
464417
|
-
}
|
|
464565
|
+
await processIncomingMessage(attributedIncoming, getOrCreateProcessTransport(listener), runtime, options.onStatusChange, options.connectionId);
|
|
464418
464566
|
emitListenerStatus(listener, options.onStatusChange, options.connectionId);
|
|
464419
464567
|
if (runtime.queueRuntime.length > 0 || runtime.queuePumpScheduled || runtime.queuePumpActive) {
|
|
464420
464568
|
scheduleQueuePump(runtime, socket, options, processQueuedTurn);
|
|
@@ -464904,11 +465052,11 @@ async function routeInputFrame(deps) {
|
|
|
464904
465052
|
return;
|
|
464905
465053
|
}
|
|
464906
465054
|
const scopedRuntime = getOrCreateScopedRuntime2(runtime, incoming.agentId, incoming.conversationId);
|
|
464907
|
-
const
|
|
465055
|
+
const dispatchNonContentMessage = (nonContentIncoming) => {
|
|
464908
465056
|
dispatchInboundMessageWhenReady({
|
|
464909
465057
|
listener: runtime,
|
|
464910
465058
|
runtime: scopedRuntime,
|
|
464911
|
-
incoming:
|
|
465059
|
+
incoming: nonContentIncoming,
|
|
464912
465060
|
socket,
|
|
464913
465061
|
options: opts,
|
|
464914
465062
|
processQueuedTurn,
|
|
@@ -464931,10 +465079,6 @@ async function routeInputFrame(deps) {
|
|
|
464931
465079
|
if (!gateInputOriginatorAdmission()) {
|
|
464932
465080
|
return;
|
|
464933
465081
|
}
|
|
464934
|
-
if (shouldProcessInboundMessageDirectly(scopedRuntime, stampedIncoming)) {
|
|
464935
|
-
processIncomingMessageDirectly(stampedIncoming);
|
|
464936
|
-
return;
|
|
464937
|
-
}
|
|
464938
465082
|
const admission = reserveInputDisposition(scopedRuntime, identity2);
|
|
464939
465083
|
if (admission.kind === "duplicate") {
|
|
464940
465084
|
acknowledgeAdmissionDuplicate(ackTransport, scopedRuntime, identity2, admission.disposition);
|
|
@@ -464977,7 +465121,7 @@ async function routeInputFrame(deps) {
|
|
|
464977
465121
|
if (!gateInputOriginatorAdmission()) {
|
|
464978
465122
|
return;
|
|
464979
465123
|
}
|
|
464980
|
-
|
|
465124
|
+
dispatchNonContentMessage(incoming);
|
|
464981
465125
|
return;
|
|
464982
465126
|
}
|
|
464983
465127
|
var init_input_frame_router = __esm(async () => {
|
|
@@ -467415,6 +467559,7 @@ async function startConnectedListenerRuntime(runtime, transport3, opts, processQ
|
|
|
467415
467559
|
await opts.onConnectionReady?.(startupConnection);
|
|
467416
467560
|
if (!isExactOpenConnection() || !startupConnection.ingressReady)
|
|
467417
467561
|
return;
|
|
467562
|
+
resendPendingExternalToolCallsForConnection(runtime, startupConnection);
|
|
467418
467563
|
startupComplete = true;
|
|
467419
467564
|
} finally {
|
|
467420
467565
|
clearStartupDeadline();
|
|
@@ -470548,7 +470693,7 @@ __export(exports_gateway_supervisor, {
|
|
|
470548
470693
|
startChannelGatewaySupervisor: () => startChannelGatewaySupervisor,
|
|
470549
470694
|
CHANNEL_GATEWAY_READY_SIGNAL: () => CHANNEL_GATEWAY_READY_SIGNAL
|
|
470550
470695
|
});
|
|
470551
|
-
import { spawn as
|
|
470696
|
+
import { spawn as spawn13 } from "node:child_process";
|
|
470552
470697
|
function resolveLauncher(cwd2) {
|
|
470553
470698
|
const invocation = resolveLettaInvocation(process.env, process.argv, process.execPath, cwd2);
|
|
470554
470699
|
if (invocation)
|
|
@@ -470649,7 +470794,7 @@ async function startChannelGatewaySupervisor(options) {
|
|
|
470649
470794
|
function launch() {
|
|
470650
470795
|
if (stopping)
|
|
470651
470796
|
return;
|
|
470652
|
-
child = (options.spawnProcess ??
|
|
470797
|
+
child = (options.spawnProcess ?? spawn13)(launcher.command, childArgs, {
|
|
470653
470798
|
cwd: cwd2,
|
|
470654
470799
|
env: options.env ?? process.env,
|
|
470655
470800
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -472247,11 +472392,11 @@ async function runMemorySubcommand(argv, deps = {}) {
|
|
|
472247
472392
|
console.error("Not a git repo. Enable git-backed memory first.");
|
|
472248
472393
|
return 1;
|
|
472249
472394
|
}
|
|
472250
|
-
const { execFile:
|
|
472251
|
-
const { promisify:
|
|
472252
|
-
const
|
|
472395
|
+
const { execFile: execFileCb4 } = await import("node:child_process");
|
|
472396
|
+
const { promisify: promisify19 } = await import("node:util");
|
|
472397
|
+
const execFile21 = promisify19(execFileCb4);
|
|
472253
472398
|
const dir = getScopedMemoryFilesystemRoot(agentId);
|
|
472254
|
-
const { stdout } = await
|
|
472399
|
+
const { stdout } = await execFile21("git", ["diff"], { cwd: dir });
|
|
472255
472400
|
if (stdout.trim()) {
|
|
472256
472401
|
console.log(stdout);
|
|
472257
472402
|
return 2;
|
|
@@ -473780,7 +473925,7 @@ var init_model2 = __esm(() => {
|
|
|
473780
473925
|
});
|
|
473781
473926
|
|
|
473782
473927
|
// src/mods/package-installer.ts
|
|
473783
|
-
import { spawn as
|
|
473928
|
+
import { spawn as spawn14 } from "node:child_process";
|
|
473784
473929
|
import {
|
|
473785
473930
|
copyFileSync as copyFileSync4,
|
|
473786
473931
|
existsSync as existsSync67,
|
|
@@ -474638,7 +474783,7 @@ var init_package_installer = __esm(() => {
|
|
|
474638
474783
|
init_package_registry();
|
|
474639
474784
|
init_package_manager_spawn();
|
|
474640
474785
|
SKIPPED_PACKAGE_COPY_NAMES = new Set([".git", "node_modules"]);
|
|
474641
|
-
spawnGitInstallProcess =
|
|
474786
|
+
spawnGitInstallProcess = spawn14;
|
|
474642
474787
|
});
|
|
474643
474788
|
|
|
474644
474789
|
// src/mods/package-scaffolder.ts
|
|
@@ -478402,15 +478547,15 @@ function resolveSkillSourceSpecifier(input) {
|
|
|
478402
478547
|
}
|
|
478403
478548
|
return null;
|
|
478404
478549
|
}
|
|
478405
|
-
async function
|
|
478406
|
-
const { execFile:
|
|
478407
|
-
const { promisify:
|
|
478408
|
-
return
|
|
478550
|
+
async function execFile21(command, args, options = {}) {
|
|
478551
|
+
const { execFile: execFileCb4 } = await import("node:child_process");
|
|
478552
|
+
const { promisify: promisify19 } = await import("node:util");
|
|
478553
|
+
return promisify19(execFileCb4)(command, args, options);
|
|
478409
478554
|
}
|
|
478410
478555
|
async function resolveBranchAndSubdir(location) {
|
|
478411
478556
|
if (!location.subdir)
|
|
478412
478557
|
return location;
|
|
478413
|
-
const { stdout } = await
|
|
478558
|
+
const { stdout } = await execFile21("git", ["ls-remote", "--heads", location.repoUrl], {
|
|
478414
478559
|
timeout: 60000
|
|
478415
478560
|
});
|
|
478416
478561
|
const branches = stdout.split(`
|
|
@@ -478437,7 +478582,7 @@ async function cloneSkillSource(location) {
|
|
|
478437
478582
|
args.push("--branch", resolvedLocation.branch);
|
|
478438
478583
|
}
|
|
478439
478584
|
args.push(resolvedLocation.repoUrl, tmpDir);
|
|
478440
|
-
await
|
|
478585
|
+
await execFile21("git", args, { timeout: 120000 });
|
|
478441
478586
|
const sourceDir = resolvedLocation.subdir ? join102(tmpDir, resolvedLocation.subdir) : tmpDir;
|
|
478442
478587
|
return { tmpDir, sourceDir };
|
|
478443
478588
|
}
|
|
@@ -478550,7 +478695,7 @@ async function downloadClawHubSkillSource(location) {
|
|
|
478550
478695
|
throw new Error(`ClawHub download failed for ${location.slug}@${version3}: ${response.status}`);
|
|
478551
478696
|
}
|
|
478552
478697
|
writeFileSync42(zipPath, Buffer.from(await response.arrayBuffer()));
|
|
478553
|
-
const { stdout } = await
|
|
478698
|
+
const { stdout } = await execFile21("unzip", ["-Z1", zipPath], {
|
|
478554
478699
|
timeout: 30000
|
|
478555
478700
|
});
|
|
478556
478701
|
const members = stdout.split(`
|
|
@@ -478559,7 +478704,7 @@ async function downloadClawHubSkillSource(location) {
|
|
|
478559
478704
|
throw new Error(`ClawHub download was empty for ${location.slug}@${version3}`);
|
|
478560
478705
|
}
|
|
478561
478706
|
members.forEach(assertSafeZipMember);
|
|
478562
|
-
await
|
|
478707
|
+
await execFile21("unzip", ["-q", zipPath, "-d", sourceDir], {
|
|
478563
478708
|
timeout: 30000
|
|
478564
478709
|
});
|
|
478565
478710
|
return { tmpDir, sourceDir };
|
|
@@ -490569,12 +490714,12 @@ var init_cli_mod_context = __esm(() => {
|
|
|
490569
490714
|
});
|
|
490570
490715
|
|
|
490571
490716
|
// src/cli/helpers/reflection-arena-hf-upload.ts
|
|
490572
|
-
import { execFile as
|
|
490717
|
+
import { execFile as execFileCb4 } from "node:child_process";
|
|
490573
490718
|
import { existsSync as existsSync73 } from "node:fs";
|
|
490574
490719
|
import { appendFile as appendFile3, chmod, mkdir as mkdir18, writeFile as writeFile21 } from "node:fs/promises";
|
|
490575
490720
|
import { homedir as homedir33 } from "node:os";
|
|
490576
490721
|
import { join as join108 } from "node:path";
|
|
490577
|
-
import { promisify as
|
|
490722
|
+
import { promisify as promisify19 } from "node:util";
|
|
490578
490723
|
function getReflectionArenaHfCacheRoot(env6 = process.env, fallbackHome = homedir33()) {
|
|
490579
490724
|
return join108(resolveGlobalConfigDir(env6, fallbackHome), "reflection-arena", "hf-upload");
|
|
490580
490725
|
}
|
|
@@ -490600,7 +490745,7 @@ function formatTokenStatus(token2) {
|
|
|
490600
490745
|
}
|
|
490601
490746
|
async function runGit6(cwd2, args, env6) {
|
|
490602
490747
|
try {
|
|
490603
|
-
await
|
|
490748
|
+
await execFile22("git", args, {
|
|
490604
490749
|
cwd: cwd2,
|
|
490605
490750
|
env: env6,
|
|
490606
490751
|
encoding: "utf-8",
|
|
@@ -490685,23 +490830,23 @@ async function maybeUploadReflectionArenaChoiceToHf(row) {
|
|
|
490685
490830
|
};
|
|
490686
490831
|
}
|
|
490687
490832
|
}
|
|
490688
|
-
var
|
|
490833
|
+
var execFile22, HF_REPO_ID = "letta-ai/reflection-arena", HF_REPO_URL, GIT_TIMEOUT_MS2 = 60000, HF_CACHE_ROOT, HF_REPO_DIR, HF_DATASET_PATH = "data/choices.jsonl";
|
|
490689
490834
|
var init_reflection_arena_hf_upload = __esm(() => {
|
|
490690
490835
|
init_secrets_store();
|
|
490691
490836
|
init_settings_path();
|
|
490692
490837
|
init_version();
|
|
490693
|
-
|
|
490838
|
+
execFile22 = promisify19(execFileCb4);
|
|
490694
490839
|
HF_REPO_URL = `https://huggingface.co/datasets/${HF_REPO_ID}`;
|
|
490695
490840
|
HF_CACHE_ROOT = getReflectionArenaHfCacheRoot();
|
|
490696
490841
|
HF_REPO_DIR = join108(HF_CACHE_ROOT, "repo");
|
|
490697
490842
|
});
|
|
490698
490843
|
|
|
490699
490844
|
// src/cli/helpers/reflection-arena.ts
|
|
490700
|
-
import { execFile as
|
|
490845
|
+
import { execFile as execFileCb5 } from "node:child_process";
|
|
490701
490846
|
import { randomInt as randomInt2, randomUUID as randomUUID64 } from "node:crypto";
|
|
490702
490847
|
import { appendFile as appendFile4, mkdir as mkdir19, readFile as readFile32, writeFile as writeFile22 } from "node:fs/promises";
|
|
490703
490848
|
import { join as join109 } from "node:path";
|
|
490704
|
-
import { promisify as
|
|
490849
|
+
import { promisify as promisify20 } from "node:util";
|
|
490705
490850
|
function sampleReflectionArenaComparisonModel(excludedModels = []) {
|
|
490706
490851
|
const excluded = new Set(excludedModels);
|
|
490707
490852
|
const candidates2 = REFLECTION_ARENA_COMPARISON_MODEL_POOL.filter((entry) => !excluded.has(entry.model));
|
|
@@ -490718,7 +490863,7 @@ function sampleReflectionArenaComparisonModel(excludedModels = []) {
|
|
|
490718
490863
|
}
|
|
490719
490864
|
async function getGitOutput(cwd2, args) {
|
|
490720
490865
|
try {
|
|
490721
|
-
const { stdout } = await
|
|
490866
|
+
const { stdout } = await execFile23("git", args, {
|
|
490722
490867
|
cwd: cwd2,
|
|
490723
490868
|
encoding: "utf-8",
|
|
490724
490869
|
timeout: 30000,
|
|
@@ -491274,7 +491419,7 @@ async function finalizeReflectionArenaChoice(options) {
|
|
|
491274
491419
|
run: completedRun
|
|
491275
491420
|
};
|
|
491276
491421
|
}
|
|
491277
|
-
var
|
|
491422
|
+
var execFile23, REFLECTION_ARENA_TELEMETRY_TRANSCRIPT_MAX_CHARS = 1e6, REFLECTION_ARENA_MODEL_A_DEFAULT = "letta/auto-memory", REFLECTION_ARENA_COMPARISON_MODEL_POOL, ANSI_BOLD = "\x1B[1m", ANSI_CYAN = "\x1B[36m", ANSI_MAGENTA = "\x1B[35m", ANSI_RESET_BOLD = "\x1B[22m", ANSI_RESET_FOREGROUND = "\x1B[39m", REFLECTION_ARENA_CANDIDATE_COUNT = 2, REFLECTION_ARENA_CHOICE_QUESTION = "Which reflection should be merged?", REFLECTION_ARENA_NOTES_QUESTION = "Optional feedback for this choice?", updateLocks;
|
|
491278
491423
|
var init_reflection_arena = __esm(() => {
|
|
491279
491424
|
init_memory_worktree();
|
|
491280
491425
|
init_app_urls();
|
|
@@ -491285,7 +491430,7 @@ var init_reflection_arena = __esm(() => {
|
|
|
491285
491430
|
init_telemetry();
|
|
491286
491431
|
init_debug();
|
|
491287
491432
|
init_settings_path();
|
|
491288
|
-
|
|
491433
|
+
execFile23 = promisify20(execFileCb5);
|
|
491289
491434
|
REFLECTION_ARENA_COMPARISON_MODEL_POOL = [
|
|
491290
491435
|
{ model: "lc-anthropic/claude-sonnet-5", weight: 1 },
|
|
491291
491436
|
{ model: "lc-anthropic/claude-opus-4-8", weight: 3 },
|
|
@@ -507578,10 +507723,10 @@ var exports_generate_memory_viewer = {};
|
|
|
507578
507723
|
__export(exports_generate_memory_viewer, {
|
|
507579
507724
|
generateAndOpenMemoryViewer: () => generateAndOpenMemoryViewer
|
|
507580
507725
|
});
|
|
507581
|
-
import { execFile as
|
|
507726
|
+
import { execFile as execFileCb6 } from "node:child_process";
|
|
507582
507727
|
import { chmodSync as chmodSync10, existsSync as existsSync76, mkdirSync as mkdirSync56, writeFileSync as writeFileSync47 } from "node:fs";
|
|
507583
507728
|
import { join as join113 } from "node:path";
|
|
507584
|
-
import { promisify as
|
|
507729
|
+
import { promisify as promisify21 } from "node:util";
|
|
507585
507730
|
function messagesFromOverview(overview) {
|
|
507586
507731
|
return overview.messages?.map((message2) => ({
|
|
507587
507732
|
id: message2.id,
|
|
@@ -507608,7 +507753,7 @@ function contextFromOverview(overview, model, contextWindow) {
|
|
|
507608
507753
|
}
|
|
507609
507754
|
async function runGitSafe(cwd2, args) {
|
|
507610
507755
|
try {
|
|
507611
|
-
const { stdout } = await
|
|
507756
|
+
const { stdout } = await execFile24("git", args, {
|
|
507612
507757
|
cwd: cwd2,
|
|
507613
507758
|
maxBuffer: 10 * 1024 * 1024,
|
|
507614
507759
|
timeout: 60000
|
|
@@ -507919,7 +508064,7 @@ async function generateAndOpenMemoryViewer(agentId, options) {
|
|
|
507919
508064
|
}
|
|
507920
508065
|
return { filePath, opened: !skipOpen };
|
|
507921
508066
|
}
|
|
507922
|
-
var
|
|
508067
|
+
var execFile24, VIEWERS_DIR, MAX_COMMITS = 500, RECENT_DIFF_COUNT = 50, PER_DIFF_CAP = 1e5, TOTAL_PAYLOAD_CAP = 5000000, RECORD_SEP = "\x1E", REFLECTION_PATTERN;
|
|
507923
508068
|
var init_generate_memory_viewer = __esm(() => {
|
|
507924
508069
|
init_memory_filesystem2();
|
|
507925
508070
|
init_memory_scanner();
|
|
@@ -507931,7 +508076,7 @@ var init_generate_memory_viewer = __esm(() => {
|
|
|
507931
508076
|
init_context_usage();
|
|
507932
508077
|
init_local_memory_context();
|
|
507933
508078
|
init_memory_viewer_template();
|
|
507934
|
-
|
|
508079
|
+
execFile24 = promisify21(execFileCb6);
|
|
507935
508080
|
VIEWERS_DIR = join113(resolveGlobalConfigDir(), "viewers");
|
|
507936
508081
|
REFLECTION_PATTERN = /\(reflection\)|🔮|reflection:/i;
|
|
507937
508082
|
});
|
|
@@ -518600,13 +518745,13 @@ var exports_generate_diff_viewer = {};
|
|
|
518600
518745
|
__export(exports_generate_diff_viewer, {
|
|
518601
518746
|
generateAndOpenDiffViewer: () => generateAndOpenDiffViewer
|
|
518602
518747
|
});
|
|
518603
|
-
import { execFile as
|
|
518748
|
+
import { execFile as execFileCb7 } from "node:child_process";
|
|
518604
518749
|
import { chmodSync as chmodSync11, existsSync as existsSync78, mkdirSync as mkdirSync57, writeFileSync as writeFileSync48 } from "node:fs";
|
|
518605
518750
|
import { isAbsolute as isAbsolute28, join as join117, resolve as resolve43 } from "node:path";
|
|
518606
|
-
import { promisify as
|
|
518751
|
+
import { promisify as promisify22 } from "node:util";
|
|
518607
518752
|
async function runGit8(cwd2, args) {
|
|
518608
518753
|
try {
|
|
518609
|
-
const { stdout } = await
|
|
518754
|
+
const { stdout } = await execFile25("git", args, {
|
|
518610
518755
|
cwd: cwd2,
|
|
518611
518756
|
maxBuffer: GIT_MAX_BUFFER,
|
|
518612
518757
|
timeout: GIT_TIMEOUT_MS3
|
|
@@ -518845,7 +518990,7 @@ async function generateAndOpenDiffViewer(targetPath) {
|
|
|
518845
518990
|
}
|
|
518846
518991
|
return { filePath, opened: !skipOpen, fileCount: rendered.files.length };
|
|
518847
518992
|
}
|
|
518848
|
-
var
|
|
518993
|
+
var execFile25, VIEWERS_DIR2, GIT_TIMEOUT_MS3 = 60000, GIT_MAX_BUFFER, MAX_RENDERED_FILES = 100, DIFF_UNSAFE_CSS = `
|
|
518849
518994
|
:host {
|
|
518850
518995
|
--diffs-addition-color-override: #15803d;
|
|
518851
518996
|
--diffs-deletion-color-override: #b91c1c;
|
|
@@ -518900,7 +519045,7 @@ var execFile26, VIEWERS_DIR2, GIT_TIMEOUT_MS3 = 60000, GIT_MAX_BUFFER, MAX_RENDE
|
|
|
518900
519045
|
var init_generate_diff_viewer = __esm(() => {
|
|
518901
519046
|
init_settings_path();
|
|
518902
519047
|
init_diff_viewer_template();
|
|
518903
|
-
|
|
519048
|
+
execFile25 = promisify22(execFileCb7);
|
|
518904
519049
|
VIEWERS_DIR2 = join117(resolveGlobalConfigDir(), "viewers");
|
|
518905
519050
|
GIT_MAX_BUFFER = 50 * 1024 * 1024;
|
|
518906
519051
|
});
|
|
@@ -525215,7 +525360,7 @@ The deployment target for this project is CITATION-DOGFOOD-OK.
|
|
|
525215
525360
|
});
|
|
525216
525361
|
|
|
525217
525362
|
// src/mods/learning-harness.ts
|
|
525218
|
-
import { spawn as
|
|
525363
|
+
import { spawn as spawn15 } from "node:child_process";
|
|
525219
525364
|
import { access as access2, copyFile as copyFile2, mkdir as mkdir20, readFile as readFile34, writeFile as writeFile23 } from "node:fs/promises";
|
|
525220
525365
|
import path49 from "node:path";
|
|
525221
525366
|
function slugify2(value) {
|
|
@@ -526155,7 +526300,7 @@ async function writeHistoryArtifacts(params) {
|
|
|
526155
526300
|
async function defaultCommandRunner(command, args, options) {
|
|
526156
526301
|
const startedAt = Date.now();
|
|
526157
526302
|
return new Promise((resolve44) => {
|
|
526158
|
-
const child =
|
|
526303
|
+
const child = spawn15(command, args, {
|
|
526159
526304
|
cwd: options.cwd,
|
|
526160
526305
|
env: options.env,
|
|
526161
526306
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -528967,12 +529112,12 @@ var exports_worktree_diff_list = {};
|
|
|
528967
529112
|
__export(exports_worktree_diff_list, {
|
|
528968
529113
|
listWorktreeDiffOptions: () => listWorktreeDiffOptions
|
|
528969
529114
|
});
|
|
528970
|
-
import { execFile as
|
|
529115
|
+
import { execFile as execFileCb8 } from "node:child_process";
|
|
528971
529116
|
import { basename as basename33 } from "node:path";
|
|
528972
|
-
import { promisify as
|
|
529117
|
+
import { promisify as promisify23 } from "node:util";
|
|
528973
529118
|
async function runGit9(cwd2, args) {
|
|
528974
529119
|
try {
|
|
528975
|
-
const { stdout } = await
|
|
529120
|
+
const { stdout } = await execFile26("git", args, {
|
|
528976
529121
|
cwd: cwd2,
|
|
528977
529122
|
maxBuffer: GIT_MAX_BUFFER2,
|
|
528978
529123
|
timeout: GIT_TIMEOUT_MS4
|
|
@@ -529101,9 +529246,9 @@ async function listWorktreeDiffOptions(cwd2 = process.cwd()) {
|
|
|
529101
529246
|
const worktrees = parseWorktreeList(output, currentPath);
|
|
529102
529247
|
return Promise.all(worktrees.map((worktree) => summarizeWorktree(worktree)));
|
|
529103
529248
|
}
|
|
529104
|
-
var
|
|
529249
|
+
var execFile26, GIT_TIMEOUT_MS4 = 60000, GIT_MAX_BUFFER2;
|
|
529105
529250
|
var init_worktree_diff_list = __esm(() => {
|
|
529106
|
-
|
|
529251
|
+
execFile26 = promisify23(execFileCb8);
|
|
529107
529252
|
GIT_MAX_BUFFER2 = 10 * 1024 * 1024;
|
|
529108
529253
|
});
|
|
529109
529254
|
|
|
@@ -539037,4 +539182,4 @@ function registerBunOAuthFlows() {
|
|
|
539037
539182
|
registerBunOAuthFlows();
|
|
539038
539183
|
await init_src5().then(() => exports_src2);
|
|
539039
539184
|
|
|
539040
|
-
//# debugId=
|
|
539185
|
+
//# debugId=9F448AA0C77E79A664756E2164756E21
|