@letta-ai/letta-code 0.34.10 → 0.34.11
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/skills.d.ts.map +1 -1
- package/dist/types/browser-device-mcp-oauth.d.ts +7 -0
- package/dist/types/browser-device-mcp-oauth.d.ts.map +1 -1
- package/dist/types/cli/subcommands/mcp-connect.d.ts +20 -0
- package/dist/types/cli/subcommands/mcp-connect.d.ts.map +1 -0
- package/dist/types/cli/subcommands/mcp-io.d.ts.map +1 -1
- package/dist/types/cli/subcommands/mcp.d.ts +2 -1
- package/dist/types/cli/subcommands/mcp.d.ts.map +1 -1
- package/dist/types/headless-listener-launch.d.ts.map +1 -1
- package/letta.js +311 -164
- package/npm-shrinkwrap.json +8 -8
- package/package.json +2 -2
- package/skills/speech-generation/LICENSE +21 -0
- package/skills/speech-generation/SKILL.md +216 -0
- package/skills/speech-generation/references/voice-settings.md +68 -0
- package/skills/submitting-feedback/SKILL.md +4 -2
package/letta.js
CHANGED
|
@@ -5913,7 +5913,7 @@ var package_default;
|
|
|
5913
5913
|
var init_package = __esm(() => {
|
|
5914
5914
|
package_default = {
|
|
5915
5915
|
name: "@letta-ai/letta-code",
|
|
5916
|
-
version: "0.34.
|
|
5916
|
+
version: "0.34.11",
|
|
5917
5917
|
lettaStartupLogProtocol: 1,
|
|
5918
5918
|
description: "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
|
|
5919
5919
|
type: "module",
|
|
@@ -6188,7 +6188,7 @@ var init_package = __esm(() => {
|
|
|
6188
6188
|
},
|
|
6189
6189
|
lettaLifecycleProtocol: 1,
|
|
6190
6190
|
lettaRuntimeGraphProtocol: 1,
|
|
6191
|
-
lettaRuntimeGraphSha512: "sha512-
|
|
6191
|
+
lettaRuntimeGraphSha512: "sha512-R2czT+w/9GF9edoE5k4YkzYyy9hALZjCA1uusJFAsnBKCQHlzE+5Kv4ZIVrBOA1oHPHcr8c08zc00L4q8oYLjA=="
|
|
6192
6192
|
};
|
|
6193
6193
|
});
|
|
6194
6194
|
|
|
@@ -210760,7 +210760,7 @@ var init_mcp_client = __esm(() => {
|
|
|
210760
210760
|
init_streamableHttp();
|
|
210761
210761
|
DEFAULT_CLIENT_INFO = {
|
|
210762
210762
|
name: "letta-code",
|
|
210763
|
-
version: "0.34.
|
|
210763
|
+
version: "0.34.11"
|
|
210764
210764
|
};
|
|
210765
210765
|
});
|
|
210766
210766
|
|
|
@@ -211833,17 +211833,36 @@ function resolveDefinition(request) {
|
|
|
211833
211833
|
if (!HANDOFF_KEY_PATTERN.test(request.handoffKey)) {
|
|
211834
211834
|
throw new BrowserDeviceMcpOAuthRequestError("Invalid OAuth handoff key");
|
|
211835
211835
|
}
|
|
211836
|
-
|
|
211837
|
-
if (!definitions) {
|
|
211836
|
+
if (!Object.hasOwn(BROWSER_DEVICE_MCP_OAUTH_SERVICES, request.service)) {
|
|
211838
211837
|
throw new BrowserDeviceMcpOAuthRequestError("Unsupported localhost OAuth service");
|
|
211839
211838
|
}
|
|
211840
|
-
const
|
|
211841
|
-
const definition = definitions.find((candidate) => normalizeServerUrl(candidate.serverUrl) === requestedUrl);
|
|
211839
|
+
const definition = findDefinition(request.service, normalizeServerUrl(request.serverUrl));
|
|
211842
211840
|
if (!definition) {
|
|
211843
211841
|
throw new BrowserDeviceMcpOAuthRequestError("Unsupported localhost OAuth server URL");
|
|
211844
211842
|
}
|
|
211845
211843
|
return definition;
|
|
211846
211844
|
}
|
|
211845
|
+
function findDefinition(service, normalizedServerUrl) {
|
|
211846
|
+
if (!Object.hasOwn(BROWSER_DEVICE_MCP_OAUTH_SERVICES, service)) {
|
|
211847
|
+
return;
|
|
211848
|
+
}
|
|
211849
|
+
return BROWSER_DEVICE_MCP_OAUTH_SERVICES[service]?.find((candidate) => normalizeServerUrl(candidate.serverUrl) === normalizedServerUrl);
|
|
211850
|
+
}
|
|
211851
|
+
function browserDeviceMcpOAuthServerUrls() {
|
|
211852
|
+
return Object.fromEntries(Object.entries(BROWSER_DEVICE_MCP_OAUTH_SERVICES).map(([service, definitions]) => [
|
|
211853
|
+
service,
|
|
211854
|
+
definitions.map((definition) => definition.serverUrl)
|
|
211855
|
+
]));
|
|
211856
|
+
}
|
|
211857
|
+
function matchBrowserDeviceMcpOAuthServerUrl(service, serverUrl) {
|
|
211858
|
+
let normalized;
|
|
211859
|
+
try {
|
|
211860
|
+
normalized = normalizeServerUrl(serverUrl);
|
|
211861
|
+
} catch {
|
|
211862
|
+
return;
|
|
211863
|
+
}
|
|
211864
|
+
return findDefinition(service, normalized)?.serverUrl;
|
|
211865
|
+
}
|
|
211847
211866
|
function canonicalizeBrowserDeviceMcpOAuthRequest(request) {
|
|
211848
211867
|
const definition = resolveDefinition(request);
|
|
211849
211868
|
return { ...request, serverUrl: definition.serverUrl };
|
|
@@ -230888,6 +230907,7 @@ var init_skills5 = __esm(() => {
|
|
|
230888
230907
|
"curating-memory-palace",
|
|
230889
230908
|
"image-generation",
|
|
230890
230909
|
"managing-shared-memory",
|
|
230910
|
+
"speech-generation",
|
|
230891
230911
|
"working-across-computers"
|
|
230892
230912
|
]);
|
|
230893
230913
|
PROJECT_SKILLS_DIR = join54(".agents", "skills");
|
|
@@ -239106,7 +239126,7 @@ class CodexAppServerClient {
|
|
|
239106
239126
|
await this.request("initialize", {
|
|
239107
239127
|
clientInfo: {
|
|
239108
239128
|
name: "letta-code",
|
|
239109
|
-
version: "0.34.
|
|
239129
|
+
version: "0.34.11"
|
|
239110
239130
|
},
|
|
239111
239131
|
capabilities: null
|
|
239112
239132
|
});
|
|
@@ -249283,6 +249303,7 @@ Usage:
|
|
|
249283
249303
|
letta mcp schema <tool-name> [--agent <id>]
|
|
249284
249304
|
letta mcp search <query> [--mode <hybrid|vector|fts>] [--limit <n>] [--agent <id>]
|
|
249285
249305
|
letta mcp call <tool-name> [--args '<json>' | --args-file <path|->] [--agent <id>]
|
|
249306
|
+
letta mcp connect <service> [--server-url <url>] [--agent <id>]
|
|
249286
249307
|
|
|
249287
249308
|
Commands:
|
|
249288
249309
|
list List MCP servers available to the agent
|
|
@@ -249291,6 +249312,8 @@ Commands:
|
|
|
249291
249312
|
schema Print one tool's complete schema
|
|
249292
249313
|
search Search tools available to the agent
|
|
249293
249314
|
call Call one exact tool name and print an MCP CallToolResult
|
|
249315
|
+
connect Authorize comfy or datadog in this computer's browser and save
|
|
249316
|
+
the connection to the Cloud agent
|
|
249294
249317
|
|
|
249295
249318
|
Options:
|
|
249296
249319
|
--agent <id> Agent ID. Defaults to LETTA_AGENT_ID or AGENT_ID
|
|
@@ -249300,6 +249323,8 @@ Options:
|
|
|
249300
249323
|
--limit <n> Search result limit from 1 to 100 (default: 5)
|
|
249301
249324
|
--args <json> JSON object passed to a tool
|
|
249302
249325
|
--args-file <path> Read tool arguments from a file; use - for stdin
|
|
249326
|
+
--server-url <url> MCP server for connect, e.g. a Datadog site's URL
|
|
249327
|
+
(default: the service's first supported URL)
|
|
249303
249328
|
-h, --help Show this help
|
|
249304
249329
|
|
|
249305
249330
|
Output is JSON. Server placement and agent/server/tool IDs are internal.
|
|
@@ -249355,6 +249380,79 @@ var init_mcp_io = __esm(() => {
|
|
|
249355
249380
|
};
|
|
249356
249381
|
});
|
|
249357
249382
|
|
|
249383
|
+
// src/cli/subcommands/mcp-connect.ts
|
|
249384
|
+
async function defaultMintMcpOAuthHandoff(agentId, service, serverUrl) {
|
|
249385
|
+
return apiRequest("POST", `/v1/agents/${encodeURIComponent(agentId)}/mcp-connections/${encodeURIComponent(service)}/browser-device-oauth-handoffs`, { server_url: serverUrl });
|
|
249386
|
+
}
|
|
249387
|
+
function defaultConnectMcpOAuth(request, onSubmissionStarted) {
|
|
249388
|
+
return connectBrowserDeviceMcpOAuth(request, undefined, undefined, undefined, onSubmissionStarted);
|
|
249389
|
+
}
|
|
249390
|
+
function resolveConnectServer(service, serverUrl) {
|
|
249391
|
+
const services = browserDeviceMcpOAuthServerUrls();
|
|
249392
|
+
const names2 = Object.keys(services).join(", ");
|
|
249393
|
+
if (!service) {
|
|
249394
|
+
throw new McpCliError("invalid_arguments", CONNECT_USAGE, `Valid services: ${names2}.`);
|
|
249395
|
+
}
|
|
249396
|
+
const urls = Object.hasOwn(services, service) ? services[service] : undefined;
|
|
249397
|
+
if (!urls?.[0]) {
|
|
249398
|
+
throw new McpCliError("unsupported_service", `Unsupported MCP OAuth service '${service}'`, `Valid services: ${names2}.`);
|
|
249399
|
+
}
|
|
249400
|
+
if (serverUrl === undefined)
|
|
249401
|
+
return { service, serverUrl: urls[0] };
|
|
249402
|
+
const matched = matchBrowserDeviceMcpOAuthServerUrl(service, serverUrl);
|
|
249403
|
+
if (!matched) {
|
|
249404
|
+
throw new McpCliError("unsupported_server_url", `Server URL '${serverUrl}' is not allowed for '${service}'`, `Valid --server-url values for ${service}: ${urls.join(", ")}.`);
|
|
249405
|
+
}
|
|
249406
|
+
return { service, serverUrl: matched };
|
|
249407
|
+
}
|
|
249408
|
+
function isTimeout(error5) {
|
|
249409
|
+
return error5 instanceof Error && (error5.name === "TimeoutError" || error5.name === "AbortError");
|
|
249410
|
+
}
|
|
249411
|
+
async function runMcpConnect(deps, agentId, serviceArg, serverUrlArg, stdout) {
|
|
249412
|
+
const { service, serverUrl } = resolveConnectServer(serviceArg, serverUrlArg);
|
|
249413
|
+
let handoff;
|
|
249414
|
+
try {
|
|
249415
|
+
handoff = await (deps.mintMcpOAuthHandoff ?? defaultMintMcpOAuthHandoff)(agentId, service, serverUrl);
|
|
249416
|
+
} catch (error5) {
|
|
249417
|
+
if (error5 instanceof ApiRequestError && [401, 403, 404].includes(error5.status)) {
|
|
249418
|
+
throw new McpCliError("agent_not_accessible", `Agent '${agentId}' is not accessible to this login (HTTP ${error5.status})`, "This computer may be signed into a different organization. Re-run `letta server --org <org>` with the agent's organization, then retry.");
|
|
249419
|
+
}
|
|
249420
|
+
throw error5;
|
|
249421
|
+
}
|
|
249422
|
+
if (typeof handoff?.handoff_key !== "string") {
|
|
249423
|
+
throw new Error("Letta API did not return an MCP OAuth handoff key");
|
|
249424
|
+
}
|
|
249425
|
+
await deps.stderr(`Opening your browser to authorize ${service}. Complete the sign-in there; waiting for the localhost callback...`);
|
|
249426
|
+
let submitting = false;
|
|
249427
|
+
const keepAlive = setInterval(() => {
|
|
249428
|
+
return;
|
|
249429
|
+
}, 60000);
|
|
249430
|
+
try {
|
|
249431
|
+
await (deps.connectMcpOAuth ?? defaultConnectMcpOAuth)({ handoffKey: handoff.handoff_key, service, serverUrl }, () => {
|
|
249432
|
+
submitting = true;
|
|
249433
|
+
});
|
|
249434
|
+
} catch (error5) {
|
|
249435
|
+
const message = error5 instanceof Error ? error5.message : String(error5);
|
|
249436
|
+
if (submitting) {
|
|
249437
|
+
throw new McpCliError("handoff_submit_failed", `Authorization succeeded but saving the connection to the agent failed: ${message}`, `Re-run \`letta mcp connect ${service}\` to try again.`);
|
|
249438
|
+
}
|
|
249439
|
+
if (isTimeout(error5)) {
|
|
249440
|
+
throw new McpCliError("authorization_timeout", `Authorization for ${service} was not completed in time`, `Re-run \`letta mcp connect ${service}\` and finish signing in within the browser window.`);
|
|
249441
|
+
}
|
|
249442
|
+
throw new McpCliError("authorization_failed", message);
|
|
249443
|
+
} finally {
|
|
249444
|
+
clearInterval(keepAlive);
|
|
249445
|
+
}
|
|
249446
|
+
await stdout(JSON.stringify({ connected: true, service, server_url: serverUrl }, null, 2));
|
|
249447
|
+
return 0;
|
|
249448
|
+
}
|
|
249449
|
+
var CONNECT_USAGE = "Usage: letta mcp connect <service> [--server-url <url>] [--agent <id>]";
|
|
249450
|
+
var init_mcp_connect = __esm(() => {
|
|
249451
|
+
init_request();
|
|
249452
|
+
init_browser_device_mcp_oauth();
|
|
249453
|
+
init_mcp_io();
|
|
249454
|
+
});
|
|
249455
|
+
|
|
249358
249456
|
// src/cli/subcommands/mcp-search.ts
|
|
249359
249457
|
function mergeMcpSearchResults(serverResults, localResults, limit4) {
|
|
249360
249458
|
return [
|
|
@@ -249529,7 +249627,8 @@ function parseMcpArgs(argv) {
|
|
|
249529
249627
|
limit: { type: "string" },
|
|
249530
249628
|
full: { type: "boolean" },
|
|
249531
249629
|
args: { type: "string" },
|
|
249532
|
-
"args-file": { type: "string" }
|
|
249630
|
+
"args-file": { type: "string" },
|
|
249631
|
+
"server-url": { type: "string" }
|
|
249533
249632
|
},
|
|
249534
249633
|
strict: true,
|
|
249535
249634
|
allowPositionals: true
|
|
@@ -250057,6 +250156,8 @@ async function runMcpSubcommand(argv, deps = {}) {
|
|
|
250057
250156
|
case "run-tool":
|
|
250058
250157
|
case "run_tool":
|
|
250059
250158
|
return await runCall(parsed, deps, agentId, stdout);
|
|
250159
|
+
case "connect":
|
|
250160
|
+
return await runMcpConnect({ ...deps, stderr }, agentId, parsed.target, stringValue3(parsed.values["server-url"]), stdout);
|
|
250060
250161
|
default:
|
|
250061
250162
|
throw new McpCliError("unknown_command", `Unknown mcp command '${parsed.action}'`);
|
|
250062
250163
|
}
|
|
@@ -250077,6 +250178,7 @@ var init_mcp = __esm(() => {
|
|
|
250077
250178
|
init_mcp_runtime();
|
|
250078
250179
|
init_mcp_scope();
|
|
250079
250180
|
init_settings_manager();
|
|
250181
|
+
init_mcp_connect();
|
|
250080
250182
|
init_mcp_io();
|
|
250081
250183
|
init_mcp_search();
|
|
250082
250184
|
init_mcp_tool_names();
|
|
@@ -258949,15 +259051,18 @@ var init_environments4 = __esm(() => {
|
|
|
258949
259051
|
});
|
|
258950
259052
|
|
|
258951
259053
|
// src/cli/subcommands/feedback.ts
|
|
259054
|
+
import { readFile as readFile18 } from "node:fs/promises";
|
|
258952
259055
|
import { parseArgs as parseArgs8 } from "node:util";
|
|
258953
259056
|
function printUsage6(stdout = console.log) {
|
|
258954
259057
|
stdout(`
|
|
258955
259058
|
Usage:
|
|
258956
259059
|
letta feedback --message <text>
|
|
259060
|
+
letta feedback --message-file <path>
|
|
258957
259061
|
|
|
258958
259062
|
Options:
|
|
258959
|
-
--message <text>
|
|
258960
|
-
-
|
|
259063
|
+
--message <text> Feedback to send to the Letta team
|
|
259064
|
+
--message-file <path> Read the feedback from a UTF-8 text file
|
|
259065
|
+
-h, --help Show this help
|
|
258961
259066
|
|
|
258962
259067
|
Notes:
|
|
258963
259068
|
- Ask the user for permission before submitting feedback on their behalf.
|
|
@@ -258972,7 +259077,8 @@ async function runFeedbackSubcommand(argv, deps = {}) {
|
|
|
258972
259077
|
args: argv,
|
|
258973
259078
|
options: {
|
|
258974
259079
|
help: { type: "boolean", short: "h" },
|
|
258975
|
-
message: { type: "string" }
|
|
259080
|
+
message: { type: "string" },
|
|
259081
|
+
"message-file": { type: "string" }
|
|
258976
259082
|
},
|
|
258977
259083
|
strict: true,
|
|
258978
259084
|
allowPositionals: false
|
|
@@ -258986,9 +259092,24 @@ async function runFeedbackSubcommand(argv, deps = {}) {
|
|
|
258986
259092
|
printUsage6(stdout);
|
|
258987
259093
|
return 0;
|
|
258988
259094
|
}
|
|
258989
|
-
const
|
|
259095
|
+
const inlineMessage = parsed.values.message;
|
|
259096
|
+
const messageFile = parsed.values["message-file"];
|
|
259097
|
+
if (typeof inlineMessage === "string" && typeof messageFile === "string") {
|
|
259098
|
+
stderr("Pass either --message or --message-file, not both.");
|
|
259099
|
+
return 1;
|
|
259100
|
+
}
|
|
259101
|
+
let rawMessage = typeof inlineMessage === "string" ? inlineMessage : "";
|
|
259102
|
+
if (typeof messageFile === "string") {
|
|
259103
|
+
try {
|
|
259104
|
+
rawMessage = await (deps.readMessageFile ?? ((path32) => readFile18(path32, "utf8")))(messageFile);
|
|
259105
|
+
} catch {
|
|
259106
|
+
stderr(`Could not read feedback file: ${messageFile}`);
|
|
259107
|
+
return 1;
|
|
259108
|
+
}
|
|
259109
|
+
}
|
|
259110
|
+
const message = rawMessage.trim();
|
|
258990
259111
|
if (!message) {
|
|
258991
|
-
stderr("Feedback message required: pass --message <text>.");
|
|
259112
|
+
stderr("Feedback message required: pass --message <text> or --message-file <path>.");
|
|
258992
259113
|
return 1;
|
|
258993
259114
|
}
|
|
258994
259115
|
if (message.length > FEEDBACK_MESSAGE_MAX) {
|
|
@@ -260984,6 +261105,38 @@ function createListenerReadinessController(requiresGateway, emitState, emitStatu
|
|
|
260984
261105
|
getState: () => ({ cloudReady, gatewayReady, ready })
|
|
260985
261106
|
};
|
|
260986
261107
|
}
|
|
261108
|
+
function createRuntimeBoundGatewayStarter(options) {
|
|
261109
|
+
let current = null;
|
|
261110
|
+
return () => {
|
|
261111
|
+
const runtime = options.getRuntime();
|
|
261112
|
+
if (!runtime) {
|
|
261113
|
+
return Promise.reject(new Error("Listener runtime is not active for ChannelGateway"));
|
|
261114
|
+
}
|
|
261115
|
+
if (current?.runtime === runtime)
|
|
261116
|
+
return current.promise;
|
|
261117
|
+
const previous = current;
|
|
261118
|
+
const promise2 = (async () => {
|
|
261119
|
+
if (previous) {
|
|
261120
|
+
await previous.promise.catch(() => {});
|
|
261121
|
+
await options.close();
|
|
261122
|
+
}
|
|
261123
|
+
await options.start(runtime);
|
|
261124
|
+
})();
|
|
261125
|
+
const entry = { runtime, promise: promise2 };
|
|
261126
|
+
current = entry;
|
|
261127
|
+
promise2.catch(async () => {
|
|
261128
|
+
if (current !== entry)
|
|
261129
|
+
return;
|
|
261130
|
+
try {
|
|
261131
|
+
await options.close();
|
|
261132
|
+
} catch {} finally {
|
|
261133
|
+
if (current === entry)
|
|
261134
|
+
current = null;
|
|
261135
|
+
}
|
|
261136
|
+
});
|
|
261137
|
+
return promise2;
|
|
261138
|
+
};
|
|
261139
|
+
}
|
|
260987
261140
|
|
|
260988
261141
|
// src/permissions/startup.ts
|
|
260989
261142
|
function formatInvalidPermissionModeMessage(value) {
|
|
@@ -261165,7 +261318,7 @@ var init_listen_log = __esm(() => {
|
|
|
261165
261318
|
|
|
261166
261319
|
// src/utils/machine-metadata.ts
|
|
261167
261320
|
import { execFile as execFile19 } from "node:child_process";
|
|
261168
|
-
import { readFile as
|
|
261321
|
+
import { readFile as readFile19 } from "node:fs/promises";
|
|
261169
261322
|
import { cpus, totalmem } from "node:os";
|
|
261170
261323
|
function getMachineMetadata() {
|
|
261171
261324
|
machineMetadata ??= collectMachineMetadata().catch(() => ({
|
|
@@ -261180,7 +261333,7 @@ function localSources() {
|
|
|
261180
261333
|
architecture: process.arch,
|
|
261181
261334
|
cpu: cpus()[0]?.model,
|
|
261182
261335
|
memoryBytes: Math.min(totalmem(), limit4 || Number.POSITIVE_INFINITY),
|
|
261183
|
-
read: (path32, signal) =>
|
|
261336
|
+
read: (path32, signal) => readFile19(path32, { encoding: "utf8", signal }),
|
|
261184
261337
|
run: (command, args, signal) => new Promise((resolve39, reject2) => {
|
|
261185
261338
|
execFile19(command, args, {
|
|
261186
261339
|
encoding: "utf8",
|
|
@@ -261723,7 +261876,7 @@ var init_auth3 = __esm(() => {
|
|
|
261723
261876
|
|
|
261724
261877
|
// src/websocket/listener/manual-instance-lock.ts
|
|
261725
261878
|
import { createHash as createHash14, randomUUID as randomUUID45 } from "node:crypto";
|
|
261726
|
-
import { link as link4, mkdir as mkdir13, readFile as
|
|
261879
|
+
import { link as link4, mkdir as mkdir13, readFile as readFile20, rm as rm11, unlink as unlink3, writeFile as writeFile15 } from "node:fs/promises";
|
|
261727
261880
|
import { homedir as homedir38 } from "node:os";
|
|
261728
261881
|
import path32 from "node:path";
|
|
261729
261882
|
function hasErrorCode3(error5, code2) {
|
|
@@ -261810,7 +261963,7 @@ async function recoverDeadOwner(lockPath, staleContents, recoveryOwnerContents,
|
|
|
261810
261963
|
}
|
|
261811
261964
|
let claimContents;
|
|
261812
261965
|
try {
|
|
261813
|
-
claimContents = await
|
|
261966
|
+
claimContents = await readFile20(claimPath, "utf-8");
|
|
261814
261967
|
} catch (error5) {
|
|
261815
261968
|
if (hasErrorCode3(error5, "ENOENT")) {
|
|
261816
261969
|
continue;
|
|
@@ -261830,7 +261983,7 @@ async function recoverDeadOwner(lockPath, staleContents, recoveryOwnerContents,
|
|
|
261830
261983
|
}
|
|
261831
261984
|
let currentContents;
|
|
261832
261985
|
try {
|
|
261833
|
-
currentContents = await
|
|
261986
|
+
currentContents = await readFile20(lockPath, "utf-8");
|
|
261834
261987
|
} catch (error5) {
|
|
261835
261988
|
return hasErrorCode3(error5, "ENOENT");
|
|
261836
261989
|
}
|
|
@@ -261880,7 +262033,7 @@ async function acquireManualListenerLock(scope, overrides = {}) {
|
|
|
261880
262033
|
return;
|
|
261881
262034
|
let currentContents;
|
|
261882
262035
|
try {
|
|
261883
|
-
currentContents = await
|
|
262036
|
+
currentContents = await readFile20(lockPath, "utf-8");
|
|
261884
262037
|
} catch (error5) {
|
|
261885
262038
|
if (hasErrorCode3(error5, "ENOENT")) {
|
|
261886
262039
|
released = true;
|
|
@@ -261900,7 +262053,7 @@ async function acquireManualListenerLock(scope, overrides = {}) {
|
|
|
261900
262053
|
}
|
|
261901
262054
|
let incumbentContents;
|
|
261902
262055
|
try {
|
|
261903
|
-
incumbentContents = await
|
|
262056
|
+
incumbentContents = await readFile20(lockPath, "utf-8");
|
|
261904
262057
|
} catch (error5) {
|
|
261905
262058
|
if (hasErrorCode3(error5, "ENOENT")) {
|
|
261906
262059
|
continue;
|
|
@@ -264434,7 +264587,7 @@ function handleMemoryProtocolCommand(parsed, context3) {
|
|
|
264434
264587
|
ensureLocalMemfsCheckout: ensureLocalMemfsCheckout2,
|
|
264435
264588
|
isMemfsEnabledOnServer: isMemfsEnabledOnServer2
|
|
264436
264589
|
} = await Promise.resolve().then(() => (init_memory_filesystem2(), exports_memory_filesystem));
|
|
264437
|
-
const { readFile:
|
|
264590
|
+
const { readFile: readFile21 } = await import("node:fs/promises");
|
|
264438
264591
|
const { existsSync: existsSync52 } = await import("node:fs");
|
|
264439
264592
|
const { isAbsolute: isAbsolute25, join: join76, normalize: normalize4, relative: relative8, sep: sep8 } = await import("node:path");
|
|
264440
264593
|
if (isAbsolute25(parsed.path) || parsed.path.length === 0) {
|
|
@@ -264460,7 +264613,7 @@ function handleMemoryProtocolCommand(parsed, context3) {
|
|
|
264460
264613
|
return;
|
|
264461
264614
|
}
|
|
264462
264615
|
}
|
|
264463
|
-
const buffer = await
|
|
264616
|
+
const buffer = await readFile21(absolutePath);
|
|
264464
264617
|
const content = encoding === "base64" ? buffer.toString("base64") : buffer.toString("utf-8");
|
|
264465
264618
|
const pathspec = rel.split(sep8).join("/");
|
|
264466
264619
|
safeSocketSend(socket, {
|
|
@@ -273719,7 +273872,7 @@ ${lanes.join(`
|
|
|
273719
273872
|
writeOutputIsTTY() {
|
|
273720
273873
|
return process.stdout.isTTY;
|
|
273721
273874
|
},
|
|
273722
|
-
readFile:
|
|
273875
|
+
readFile: readFile21,
|
|
273723
273876
|
writeFile: writeFile22,
|
|
273724
273877
|
watchFile: watchFile2,
|
|
273725
273878
|
watchDirectory,
|
|
@@ -273912,7 +274065,7 @@ ${lanes.join(`
|
|
|
273912
274065
|
function fsWatchWorker(fileOrDirectory, recursive, callback) {
|
|
273913
274066
|
return _fs.watch(fileOrDirectory, fsSupportsRecursiveFsWatch ? { persistent: true, recursive: !!recursive } : { persistent: true }, callback);
|
|
273914
274067
|
}
|
|
273915
|
-
function
|
|
274068
|
+
function readFile21(fileName, _encoding) {
|
|
273916
274069
|
let buffer;
|
|
273917
274070
|
try {
|
|
273918
274071
|
buffer = _fs.readFileSync(fileName);
|
|
@@ -304859,7 +305012,7 @@ ${lanes.join(`
|
|
|
304859
305012
|
const possibleOption = getSpellingSuggestion(unknownOption, diagnostics2.optionDeclarations, getOptionName);
|
|
304860
305013
|
return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics2.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics2.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
|
|
304861
305014
|
}
|
|
304862
|
-
function parseCommandLineWorker(diagnostics2, commandLine,
|
|
305015
|
+
function parseCommandLineWorker(diagnostics2, commandLine, readFile21) {
|
|
304863
305016
|
const options = {};
|
|
304864
305017
|
let watchOptions;
|
|
304865
305018
|
const fileNames = [];
|
|
@@ -304897,7 +305050,7 @@ ${lanes.join(`
|
|
|
304897
305050
|
}
|
|
304898
305051
|
}
|
|
304899
305052
|
function parseResponseFile(fileName) {
|
|
304900
|
-
const text3 = tryReadFile(fileName,
|
|
305053
|
+
const text3 = tryReadFile(fileName, readFile21 || ((fileName2) => sys.readFile(fileName2)));
|
|
304901
305054
|
if (!isString7(text3)) {
|
|
304902
305055
|
errors6.push(text3);
|
|
304903
305056
|
return;
|
|
@@ -305000,8 +305153,8 @@ ${lanes.join(`
|
|
|
305000
305153
|
unknownDidYouMeanDiagnostic: Diagnostics.Unknown_compiler_option_0_Did_you_mean_1,
|
|
305001
305154
|
optionTypeMismatchDiagnostic: Diagnostics.Compiler_option_0_expects_an_argument
|
|
305002
305155
|
};
|
|
305003
|
-
function parseCommandLine2(commandLine,
|
|
305004
|
-
return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine,
|
|
305156
|
+
function parseCommandLine2(commandLine, readFile21) {
|
|
305157
|
+
return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine, readFile21);
|
|
305005
305158
|
}
|
|
305006
305159
|
function getOptionFromName(optionName, allowShort) {
|
|
305007
305160
|
return getOptionDeclarationFromName(getOptionsNameMap, optionName, allowShort);
|
|
@@ -305069,8 +305222,8 @@ ${lanes.join(`
|
|
|
305069
305222
|
result3.originalFileName = result3.fileName;
|
|
305070
305223
|
return parseJsonSourceFileConfigFileContent(result3, host, getNormalizedAbsolutePath(getDirectoryPath(configFileName), cwd2), optionsToExtend, getNormalizedAbsolutePath(configFileName, cwd2), undefined, extraFileExtensions, extendedConfigCache, watchOptionsToExtend);
|
|
305071
305224
|
}
|
|
305072
|
-
function readConfigFile(fileName,
|
|
305073
|
-
const textOrDiagnostic = tryReadFile(fileName,
|
|
305225
|
+
function readConfigFile(fileName, readFile21) {
|
|
305226
|
+
const textOrDiagnostic = tryReadFile(fileName, readFile21);
|
|
305074
305227
|
return isString7(textOrDiagnostic) ? parseConfigFileTextToJson(fileName, textOrDiagnostic) : { config: {}, error: textOrDiagnostic };
|
|
305075
305228
|
}
|
|
305076
305229
|
function parseConfigFileTextToJson(fileName, jsonText) {
|
|
@@ -305080,14 +305233,14 @@ ${lanes.join(`
|
|
|
305080
305233
|
error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : undefined
|
|
305081
305234
|
};
|
|
305082
305235
|
}
|
|
305083
|
-
function readJsonConfigFile(fileName,
|
|
305084
|
-
const textOrDiagnostic = tryReadFile(fileName,
|
|
305236
|
+
function readJsonConfigFile(fileName, readFile21) {
|
|
305237
|
+
const textOrDiagnostic = tryReadFile(fileName, readFile21);
|
|
305085
305238
|
return isString7(textOrDiagnostic) ? parseJsonText(fileName, textOrDiagnostic) : { fileName, parseDiagnostics: [textOrDiagnostic] };
|
|
305086
305239
|
}
|
|
305087
|
-
function tryReadFile(fileName,
|
|
305240
|
+
function tryReadFile(fileName, readFile21) {
|
|
305088
305241
|
let text3;
|
|
305089
305242
|
try {
|
|
305090
|
-
text3 =
|
|
305243
|
+
text3 = readFile21(fileName);
|
|
305091
305244
|
} catch (e2) {
|
|
305092
305245
|
return createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e2.message);
|
|
305093
305246
|
}
|
|
@@ -372517,12 +372670,12 @@ ${lanes.join(`
|
|
|
372517
372670
|
function createCompilerHost(options, setParentNodes) {
|
|
372518
372671
|
return createCompilerHostWorker(options, setParentNodes);
|
|
372519
372672
|
}
|
|
372520
|
-
function createGetSourceFile(
|
|
372673
|
+
function createGetSourceFile(readFile21, setParentNodes) {
|
|
372521
372674
|
return (fileName, languageVersionOrOptions, onError) => {
|
|
372522
372675
|
let text3;
|
|
372523
372676
|
try {
|
|
372524
372677
|
mark2("beforeIORead");
|
|
372525
|
-
text3 =
|
|
372678
|
+
text3 = readFile21(fileName);
|
|
372526
372679
|
mark2("afterIORead");
|
|
372527
372680
|
measure("I/O Read", "beforeIORead", "afterIORead");
|
|
372528
372681
|
} catch (e2) {
|
|
@@ -373313,7 +373466,7 @@ ${lanes.join(`
|
|
|
373313
373466
|
getRedirectFromOutput,
|
|
373314
373467
|
forEachResolvedProjectReference: forEachResolvedProjectReference2
|
|
373315
373468
|
});
|
|
373316
|
-
const
|
|
373469
|
+
const readFile21 = host.readFile.bind(host);
|
|
373317
373470
|
(_e = tracing) == null || _e.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
|
373318
373471
|
const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
|
373319
373472
|
(_f = tracing) == null || _f.pop();
|
|
@@ -373489,7 +373642,7 @@ ${lanes.join(`
|
|
|
373489
373642
|
shouldTransformImportCall,
|
|
373490
373643
|
emitBuildInfo,
|
|
373491
373644
|
fileExists,
|
|
373492
|
-
readFile:
|
|
373645
|
+
readFile: readFile21,
|
|
373493
373646
|
directoryExists: directoryExists2,
|
|
373494
373647
|
getSymlinkCache,
|
|
373495
373648
|
realpath: (_o = host.realpath) == null ? undefined : _o.bind(host),
|
|
@@ -449379,12 +449532,12 @@ function rowToolCalls(row, index, diagnostics2) {
|
|
|
449379
449532
|
}
|
|
449380
449533
|
return calls;
|
|
449381
449534
|
}
|
|
449382
|
-
function
|
|
449535
|
+
function contentText3(content) {
|
|
449383
449536
|
if (typeof content === "string") {
|
|
449384
449537
|
if (content.startsWith(CONTENT_JSON_PREFIX)) {
|
|
449385
449538
|
const encoded = content.slice(CONTENT_JSON_PREFIX.length);
|
|
449386
449539
|
try {
|
|
449387
|
-
return
|
|
449540
|
+
return contentText3(JSON.parse(encoded));
|
|
449388
449541
|
} catch {
|
|
449389
449542
|
return encoded;
|
|
449390
449543
|
}
|
|
@@ -449470,7 +449623,7 @@ var init_hermes = __esm(() => {
|
|
|
449470
449623
|
});
|
|
449471
449624
|
};
|
|
449472
449625
|
if (row.role === "user") {
|
|
449473
|
-
const content =
|
|
449626
|
+
const content = contentText3(row.content);
|
|
449474
449627
|
if (content) {
|
|
449475
449628
|
emit({
|
|
449476
449629
|
type: "message",
|
|
@@ -449490,7 +449643,7 @@ var init_hermes = __esm(() => {
|
|
|
449490
449643
|
...timestamp ? { timestamp } : {}
|
|
449491
449644
|
});
|
|
449492
449645
|
}
|
|
449493
|
-
const content =
|
|
449646
|
+
const content = contentText3(row.content);
|
|
449494
449647
|
if (content) {
|
|
449495
449648
|
emit({
|
|
449496
449649
|
type: "message",
|
|
@@ -449513,7 +449666,7 @@ var init_hermes = __esm(() => {
|
|
|
449513
449666
|
if (row.role === "tool") {
|
|
449514
449667
|
emit({
|
|
449515
449668
|
type: "tool_result",
|
|
449516
|
-
content:
|
|
449669
|
+
content: contentText3(row.content),
|
|
449517
449670
|
...typeof row.tool_call_id === "string" && row.tool_call_id ? { callId: row.tool_call_id } : {},
|
|
449518
449671
|
...timestamp ? { timestamp } : {}
|
|
449519
449672
|
});
|
|
@@ -451505,7 +451658,7 @@ var exports_reflection_memory_v2 = {};
|
|
|
451505
451658
|
__export(exports_reflection_memory_v2, {
|
|
451506
451659
|
buildMemfsV2ParentMemorySnapshot: () => buildMemfsV2ParentMemorySnapshot
|
|
451507
451660
|
});
|
|
451508
|
-
import { readFile as
|
|
451661
|
+
import { readFile as readFile21 } from "node:fs/promises";
|
|
451509
451662
|
function renderProjectedTree(files) {
|
|
451510
451663
|
const root2 = { directories: new Map, files: [] };
|
|
451511
451664
|
for (const file of files) {
|
|
@@ -451558,7 +451711,7 @@ async function buildMemfsV2ParentMemorySnapshot(memoryDir, requestedMaxChars) {
|
|
|
451558
451711
|
`).length - prefix.length - suffix.length - 20;
|
|
451559
451712
|
if (remaining <= 0)
|
|
451560
451713
|
break;
|
|
451561
|
-
const content = (await
|
|
451714
|
+
const content = (await readFile21(file.fullPath, "utf-8")).slice(0, remaining);
|
|
451562
451715
|
lines.push(`${prefix}${content}${suffix}`);
|
|
451563
451716
|
}
|
|
451564
451717
|
lines.push("</parent_memory>");
|
|
@@ -451576,7 +451729,7 @@ import {
|
|
|
451576
451729
|
appendFile,
|
|
451577
451730
|
mkdir as mkdir14,
|
|
451578
451731
|
readdir as readdir9,
|
|
451579
|
-
readFile as
|
|
451732
|
+
readFile as readFile22,
|
|
451580
451733
|
stat as stat13,
|
|
451581
451734
|
writeFile as writeFile16
|
|
451582
451735
|
} from "node:fs/promises";
|
|
@@ -451624,7 +451777,7 @@ async function collectParentMemoryFiles(memoryDir) {
|
|
|
451624
451777
|
continue;
|
|
451625
451778
|
}
|
|
451626
451779
|
try {
|
|
451627
|
-
const content = await
|
|
451780
|
+
const content = await readFile22(entryPath, "utf-8");
|
|
451628
451781
|
const { frontmatter } = parseFrontmatter(content);
|
|
451629
451782
|
const description = typeof frontmatter.description === "string" ? frontmatter.description : undefined;
|
|
451630
451783
|
files.push({
|
|
@@ -451927,7 +452080,7 @@ async function ensurePaths(paths) {
|
|
|
451927
452080
|
}
|
|
451928
452081
|
async function readTranscriptLines(paths) {
|
|
451929
452082
|
try {
|
|
451930
|
-
const raw2 = await
|
|
452083
|
+
const raw2 = await readFile22(paths.transcriptPath, "utf-8");
|
|
451931
452084
|
return raw2.split(`
|
|
451932
452085
|
`).map((line) => line.trim()).filter((line) => line.length > 0);
|
|
451933
452086
|
} catch {
|
|
@@ -452000,7 +452153,7 @@ function buildUnreflectedStateFromTranscript(lines) {
|
|
|
452000
452153
|
async function readState(paths) {
|
|
452001
452154
|
let raw2 = null;
|
|
452002
452155
|
try {
|
|
452003
|
-
raw2 = await
|
|
452156
|
+
raw2 = await readFile22(paths.statePath, "utf-8");
|
|
452004
452157
|
} catch {
|
|
452005
452158
|
raw2 = null;
|
|
452006
452159
|
}
|
|
@@ -452332,7 +452485,7 @@ function isReflectionAutoPriority(value) {
|
|
|
452332
452485
|
return value === "high" || value === "medium" || value === "low";
|
|
452333
452486
|
}
|
|
452334
452487
|
async function readReflectionAutoSelection(options) {
|
|
452335
|
-
const raw2 = options.selectionReport ?? (options.selectionOutputPath ? await
|
|
452488
|
+
const raw2 = options.selectionReport ?? (options.selectionOutputPath ? await readFile22(options.selectionOutputPath, "utf-8") : "");
|
|
452336
452489
|
const parsed = parseReflectionAutoSelectionJson(raw2);
|
|
452337
452490
|
if (!parsed || typeof parsed !== "object") {
|
|
452338
452491
|
throw new Error("Reflection selector did not return valid JSON.");
|
|
@@ -454042,7 +454195,7 @@ var init_turn_send = __esm(async () => {
|
|
|
454042
454195
|
});
|
|
454043
454196
|
|
|
454044
454197
|
// src/agent/preloaded-skills.ts
|
|
454045
|
-
import { readFile as
|
|
454198
|
+
import { readFile as readFile23 } from "node:fs/promises";
|
|
454046
454199
|
async function loadPreloadedSkills(ids, options) {
|
|
454047
454200
|
if (ids.length === 0)
|
|
454048
454201
|
return "";
|
|
@@ -454054,7 +454207,7 @@ async function loadPreloadedSkills(ids, options) {
|
|
|
454054
454207
|
continue;
|
|
454055
454208
|
try {
|
|
454056
454209
|
contents.push(`<${id2}>
|
|
454057
|
-
${await
|
|
454210
|
+
${await readFile23(path42, "utf-8")}
|
|
454058
454211
|
</${id2}>`);
|
|
454059
454212
|
} catch {}
|
|
454060
454213
|
}
|
|
@@ -455758,7 +455911,7 @@ var init_grep_in_files = __esm(() => {
|
|
|
455758
455911
|
});
|
|
455759
455912
|
|
|
455760
455913
|
// src/websocket/listener/file-commands.ts
|
|
455761
|
-
import { readdir as readdir10, readFile as
|
|
455914
|
+
import { readdir as readdir10, readFile as readFile24 } from "node:fs/promises";
|
|
455762
455915
|
import { homedir as homedir51 } from "node:os";
|
|
455763
455916
|
import path43 from "node:path";
|
|
455764
455917
|
function trackListenerError3(errorType, error5, context3) {
|
|
@@ -455813,7 +455966,7 @@ async function getIgnoreConfig(root2) {
|
|
|
455813
455966
|
return cached3;
|
|
455814
455967
|
let patterns2 = [];
|
|
455815
455968
|
try {
|
|
455816
|
-
const content = await
|
|
455969
|
+
const content = await readFile24(path43.join(absRoot, ".letta", ".lettaignore"), "utf-8");
|
|
455817
455970
|
patterns2 = parseLettaIgnore(content);
|
|
455818
455971
|
} catch {
|
|
455819
455972
|
patterns2 = [];
|
|
@@ -456178,7 +456331,7 @@ function createFileCommandSession(params) {
|
|
|
456178
456331
|
if (stats.size > MAX_BASE64_READ_BYTES) {
|
|
456179
456332
|
throw new Error(`File too large for base64 read (max ${Math.floor(MAX_BASE64_READ_BYTES / 1048576)}MB)`);
|
|
456180
456333
|
}
|
|
456181
|
-
const bytes = await
|
|
456334
|
+
const bytes = await readFile24(parsed.path);
|
|
456182
456335
|
content = bytes.toString("base64");
|
|
456183
456336
|
} else {
|
|
456184
456337
|
content = await readUtf8TextStrict(parsed.path);
|
|
@@ -456932,7 +457085,7 @@ __export(exports_custom, {
|
|
|
456932
457085
|
COMMANDS_DIR: () => COMMANDS_DIR
|
|
456933
457086
|
});
|
|
456934
457087
|
import { existsSync as existsSync62 } from "node:fs";
|
|
456935
|
-
import { readdir as readdir11, readFile as
|
|
457088
|
+
import { readdir as readdir11, readFile as readFile25 } from "node:fs/promises";
|
|
456936
457089
|
import { basename as basename27, dirname as dirname34, join as join91 } from "node:path";
|
|
456937
457090
|
async function getCustomCommands() {
|
|
456938
457091
|
if (cachedCommands !== null) {
|
|
@@ -456991,7 +457144,7 @@ async function findCommandFiles(currentPath, rootPath, commands, source) {
|
|
|
456991
457144
|
} catch (_error) {}
|
|
456992
457145
|
}
|
|
456993
457146
|
async function parseCommandFile(filePath, rootPath, source) {
|
|
456994
|
-
const content = await
|
|
457147
|
+
const content = await readFile25(filePath, "utf-8");
|
|
456995
457148
|
const { frontmatter, body: body3 } = parseFrontmatter(content);
|
|
456996
457149
|
const id2 = basename27(filePath, ".md");
|
|
456997
457150
|
const relativePath = dirname34(filePath).slice(rootPath.length);
|
|
@@ -462450,7 +462603,7 @@ var init_listen_client = __esm(async () => {
|
|
|
462450
462603
|
|
|
462451
462604
|
// src/websocket/app-server-auth.ts
|
|
462452
462605
|
import { createHash as createHash18, createHmac, timingSafeEqual } from "node:crypto";
|
|
462453
|
-
import { readFile as
|
|
462606
|
+
import { readFile as readFile26 } from "node:fs/promises";
|
|
462454
462607
|
import { isIP as isIP2 } from "node:net";
|
|
462455
462608
|
import { isAbsolute as isAbsolute25 } from "node:path";
|
|
462456
462609
|
function parseAppServerWebsocketAuthSettings(args) {
|
|
@@ -462691,7 +462844,7 @@ function bearerTokenFromHeaders(headers) {
|
|
|
462691
462844
|
async function readTrimmedSecret(path45) {
|
|
462692
462845
|
let raw2;
|
|
462693
462846
|
try {
|
|
462694
|
-
raw2 = await
|
|
462847
|
+
raw2 = await readFile26(path45, "utf8");
|
|
462695
462848
|
} catch (error5) {
|
|
462696
462849
|
const message = error5 instanceof Error ? error5.message : String(error5);
|
|
462697
462850
|
throw new Error(`failed to read websocket auth secret ${path45}: ${message}`);
|
|
@@ -465170,92 +465323,86 @@ async function runListenSubcommand(argv) {
|
|
|
465170
465323
|
}
|
|
465171
465324
|
}
|
|
465172
465325
|
const readiness = createListenerReadinessController(channelNames.length > 0 || restoreEnabledChannels, (ready) => lifecycleOutput?.emit(ready ? "connected" : "reconnecting"), (status) => lifecycleOutput?.emitListenerStatus(status));
|
|
465173
|
-
let
|
|
465174
|
-
const startChannelGateway = () => {
|
|
465175
|
-
if (
|
|
465176
|
-
return
|
|
465177
|
-
|
|
465178
|
-
if (channelNames.length === 0 && !restoreEnabledChannels)
|
|
465179
|
-
return;
|
|
465326
|
+
let startRuntimeChannelGateway = null;
|
|
465327
|
+
const startChannelGateway = async () => {
|
|
465328
|
+
if (channelNames.length === 0 && !restoreEnabledChannels)
|
|
465329
|
+
return;
|
|
465330
|
+
if (!startRuntimeChannelGateway) {
|
|
465180
465331
|
const { getActiveRuntime: getActiveRuntime2 } = await init_runtime6().then(() => exports_runtime);
|
|
465181
|
-
|
|
465182
|
-
|
|
465183
|
-
|
|
465184
|
-
|
|
465185
|
-
const { startAppServer: startAppServer2 } = await init_app_server().then(() => exports_app_server);
|
|
465186
|
-
channelAppServer = await startAppServer2({
|
|
465187
|
-
runtime,
|
|
465188
|
-
connectionName,
|
|
465189
|
-
startProcessServices: false,
|
|
465190
|
-
onLog: (message) => sessionLog.log(`[ChannelGateway] ${message}`)
|
|
465191
|
-
});
|
|
465192
|
-
const { startChannelGatewaySupervisor: startChannelGatewaySupervisor2 } = await Promise.resolve().then(() => (init_gateway_supervisor(), exports_gateway_supervisor));
|
|
465193
|
-
const { broadcastServiceProtocolMessage: broadcastServiceProtocolMessage2 } = await init_protocol_outbound().then(() => exports_protocol_outbound);
|
|
465194
|
-
channelGatewaySupervisor = await startChannelGatewaySupervisor2({
|
|
465195
|
-
appServerUrl: channelAppServer.controlUrl,
|
|
465196
|
-
channelNames,
|
|
465197
|
-
restoreEnabledChannels,
|
|
465198
|
-
restoreAgentScope,
|
|
465199
|
-
failOnStartupError: Boolean(values4.channels),
|
|
465200
|
-
installChannelRuntimes: Boolean(values4.channels && values4["install-channel-runtimes"]),
|
|
465201
|
-
onLog: (message) => {
|
|
465202
|
-
sessionLog.log(message);
|
|
465203
|
-
if (debugMode)
|
|
465204
|
-
console.log(`[${formatTimestamp3()}] ${message}`);
|
|
465205
|
-
},
|
|
465206
|
-
onLifecycleEvent: (event) => {
|
|
465207
|
-
applyGatewayLifecycleReadiness(readiness, event);
|
|
465208
|
-
telemetry.trackChannelGatewayLifecycle({
|
|
465209
|
-
lifecycle_event: event.kind,
|
|
465210
|
-
restart_attempt: event.restartAttempt,
|
|
465211
|
-
max_restart_attempts: event.maxRestartAttempts,
|
|
465212
|
-
restore_mode: restoreEnabledChannels ? "enabled_accounts" : "explicit_channels",
|
|
465213
|
-
channel_types: readChannelGatewayTelemetryTypes(),
|
|
465214
|
-
duration_ms: event.durationMs,
|
|
465215
|
-
delay_ms: event.delayMs,
|
|
465216
|
-
exit_code: event.exitCode,
|
|
465217
|
-
signal: event.signal,
|
|
465218
|
-
reached_ready: event.reachedReady
|
|
465219
|
-
});
|
|
465220
|
-
},
|
|
465221
|
-
onUnexpectedExit: (error5) => {
|
|
465222
|
-
sessionLog.log(`[ChannelGateway] recoverable exit: ${error5.message}`);
|
|
465223
|
-
},
|
|
465224
|
-
onRestartExhausted: (error5) => {
|
|
465225
|
-
reportError(`[${formatTimestamp3()}] ${error5.message}`);
|
|
465226
|
-
if (values4.channels) {
|
|
465227
|
-
exitWithTelemetry(1, "listener_channel_gateway_restart_exhausted");
|
|
465228
|
-
}
|
|
465229
|
-
},
|
|
465230
|
-
onServiceEvent: (event) => {
|
|
465231
|
-
if (event.kind === "protocol") {
|
|
465232
|
-
broadcastServiceProtocolMessage2(runtime, event.message);
|
|
465233
|
-
}
|
|
465234
|
-
}
|
|
465332
|
+
startRuntimeChannelGateway ??= createRuntimeBoundGatewayStarter({
|
|
465333
|
+
getRuntime: getActiveRuntime2,
|
|
465334
|
+
close: closeChannelGateway,
|
|
465335
|
+
start: startChannelGatewayForRuntime
|
|
465235
465336
|
});
|
|
465236
|
-
|
|
465237
|
-
|
|
465238
|
-
|
|
465239
|
-
|
|
465240
|
-
|
|
465337
|
+
}
|
|
465338
|
+
return startRuntimeChannelGateway();
|
|
465339
|
+
};
|
|
465340
|
+
const startChannelGatewayForRuntime = (runtime) => (async () => {
|
|
465341
|
+
const { startAppServer: startAppServer2 } = await init_app_server().then(() => exports_app_server);
|
|
465342
|
+
channelAppServer = await startAppServer2({
|
|
465343
|
+
runtime,
|
|
465344
|
+
connectionName,
|
|
465345
|
+
startProcessServices: false,
|
|
465346
|
+
onLog: (message) => sessionLog.log(`[ChannelGateway] ${message}`)
|
|
465347
|
+
});
|
|
465348
|
+
const { startChannelGatewaySupervisor: startChannelGatewaySupervisor2 } = await Promise.resolve().then(() => (init_gateway_supervisor(), exports_gateway_supervisor));
|
|
465349
|
+
const { broadcastServiceProtocolMessage: broadcastServiceProtocolMessage2 } = await init_protocol_outbound().then(() => exports_protocol_outbound);
|
|
465350
|
+
channelGatewaySupervisor = await startChannelGatewaySupervisor2({
|
|
465351
|
+
appServerUrl: channelAppServer.controlUrl,
|
|
465352
|
+
channelNames,
|
|
465353
|
+
restoreEnabledChannels,
|
|
465354
|
+
restoreAgentScope,
|
|
465355
|
+
failOnStartupError: Boolean(values4.channels),
|
|
465356
|
+
installChannelRuntimes: Boolean(values4.channels && values4["install-channel-runtimes"]),
|
|
465357
|
+
onLog: (message) => {
|
|
465358
|
+
sessionLog.log(message);
|
|
465359
|
+
if (debugMode)
|
|
465360
|
+
console.log(`[${formatTimestamp3()}] ${message}`);
|
|
465361
|
+
},
|
|
465362
|
+
onLifecycleEvent: (event) => {
|
|
465363
|
+
applyGatewayLifecycleReadiness(readiness, event);
|
|
465364
|
+
telemetry.trackChannelGatewayLifecycle({
|
|
465365
|
+
lifecycle_event: event.kind,
|
|
465366
|
+
restart_attempt: event.restartAttempt,
|
|
465367
|
+
max_restart_attempts: event.maxRestartAttempts,
|
|
465368
|
+
restore_mode: restoreEnabledChannels ? "enabled_accounts" : "explicit_channels",
|
|
465369
|
+
channel_types: readChannelGatewayTelemetryTypes(),
|
|
465370
|
+
duration_ms: event.durationMs,
|
|
465371
|
+
delay_ms: event.delayMs,
|
|
465372
|
+
exit_code: event.exitCode,
|
|
465373
|
+
signal: event.signal,
|
|
465374
|
+
reached_ready: event.reachedReady
|
|
465375
|
+
});
|
|
465376
|
+
},
|
|
465377
|
+
onUnexpectedExit: (error5) => {
|
|
465378
|
+
sessionLog.log(`[ChannelGateway] recoverable exit: ${error5.message}`);
|
|
465379
|
+
},
|
|
465380
|
+
onRestartExhausted: (error5) => {
|
|
465381
|
+
reportError(`[${formatTimestamp3()}] ${error5.message}`);
|
|
465382
|
+
if (values4.channels) {
|
|
465383
|
+
exitWithTelemetry(1, "listener_channel_gateway_restart_exhausted");
|
|
465384
|
+
}
|
|
465385
|
+
},
|
|
465386
|
+
onServiceEvent: (event) => {
|
|
465387
|
+
if (event.kind === "protocol") {
|
|
465388
|
+
broadcastServiceProtocolMessage2(runtime, event.message);
|
|
465241
465389
|
}
|
|
465242
|
-
return supervisor.request(request);
|
|
465243
|
-
};
|
|
465244
|
-
runtime.serviceCommandTypes = new Set(CHANNEL_SERVICE_COMMAND_TYPES);
|
|
465245
|
-
clearChannelServiceHandler = () => {
|
|
465246
|
-
runtime.serviceCommandHandler = null;
|
|
465247
|
-
runtime.serviceCommandTypes.clear();
|
|
465248
|
-
};
|
|
465249
|
-
})();
|
|
465250
|
-
channelGatewayStart.catch(async () => {
|
|
465251
|
-
try {
|
|
465252
|
-
await closeChannelGateway();
|
|
465253
|
-
} catch {} finally {
|
|
465254
|
-
channelGatewayStart = null;
|
|
465255
465390
|
}
|
|
465256
465391
|
});
|
|
465257
|
-
|
|
465258
|
-
|
|
465392
|
+
readiness.setGatewayReady(true);
|
|
465393
|
+
runtime.serviceCommandHandler = (request) => {
|
|
465394
|
+
const supervisor = channelGatewaySupervisor;
|
|
465395
|
+
if (!supervisor) {
|
|
465396
|
+
throw new Error("ChannelGateway supervisor is not available");
|
|
465397
|
+
}
|
|
465398
|
+
return supervisor.request(request);
|
|
465399
|
+
};
|
|
465400
|
+
runtime.serviceCommandTypes = new Set(CHANNEL_SERVICE_COMMAND_TYPES);
|
|
465401
|
+
clearChannelServiceHandler = () => {
|
|
465402
|
+
runtime.serviceCommandHandler = null;
|
|
465403
|
+
runtime.serviceCommandTypes.clear();
|
|
465404
|
+
};
|
|
465405
|
+
})();
|
|
465259
465406
|
sessionLog.log(`Session started (debug=${debugMode})`);
|
|
465260
465407
|
sessionLog.log(`deviceId: ${deviceId}`);
|
|
465261
465408
|
sessionLog.log(`connectionName: ${connectionName}`);
|
|
@@ -469102,7 +469249,7 @@ var init_sandbox_files = __esm(() => {
|
|
|
469102
469249
|
});
|
|
469103
469250
|
|
|
469104
469251
|
// src/cli/subcommands/sandbox.ts
|
|
469105
|
-
import { readFile as
|
|
469252
|
+
import { readFile as readFile27, stat as stat15, writeFile as writeFile18 } from "node:fs/promises";
|
|
469106
469253
|
import { basename as basename28, resolve as resolve40 } from "node:path";
|
|
469107
469254
|
import { parseArgs as parseArgs16 } from "node:util";
|
|
469108
469255
|
function printUsage13() {
|
|
@@ -469252,7 +469399,7 @@ async function runSandboxSubcommand(argv, deps = {}) {
|
|
|
469252
469399
|
const fileStat = await (deps.statLocalPath ?? stat15)(localPath2);
|
|
469253
469400
|
if (!fileStat.isFile())
|
|
469254
469401
|
throw new Error(`${localPath2} is not a file`);
|
|
469255
|
-
const data2 = await (deps.readLocalFile ??
|
|
469402
|
+
const data2 = await (deps.readLocalFile ?? readFile27)(localPath2);
|
|
469256
469403
|
const sandbox2 = await ensureSandbox();
|
|
469257
469404
|
const result3 = await (deps.uploadFile ?? uploadFileToSandbox)(sandbox2.sandboxId, { blob: new Blob([data2]), name: basename28(localPath2) });
|
|
469258
469405
|
console.log(JSON.stringify({ ...result3, ...targetOutput }, null, 2));
|
|
@@ -472993,7 +473140,7 @@ var init_teleport2 = __esm(() => {
|
|
|
472993
473140
|
});
|
|
472994
473141
|
|
|
472995
473142
|
// src/cli/subcommands/trajectories/readers.ts
|
|
472996
|
-
import { readdir as readdir14, readFile as
|
|
473143
|
+
import { readdir as readdir14, readFile as readFile28, stat as stat16 } from "node:fs/promises";
|
|
472997
473144
|
import { join as join98 } from "node:path";
|
|
472998
473145
|
async function loadSessionTranscript(item) {
|
|
472999
473146
|
const stats = await stat16(item.path);
|
|
@@ -473003,7 +473150,7 @@ async function loadSessionTranscript(item) {
|
|
|
473003
473150
|
if (item.path.endsWith(".db")) {
|
|
473004
473151
|
return exportHermesSession(item.path, item.id);
|
|
473005
473152
|
}
|
|
473006
|
-
return
|
|
473153
|
+
return readFile28(item.path, "utf-8");
|
|
473007
473154
|
}
|
|
473008
473155
|
async function assembleEventDirectory(sessionDir) {
|
|
473009
473156
|
const eventsSubdir = join98(sessionDir, "events");
|
|
@@ -473012,7 +473159,7 @@ async function assembleEventDirectory(sessionDir) {
|
|
|
473012
473159
|
if (names2.length === 0) {
|
|
473013
473160
|
throw new Error(`No event files found in ${eventsDir}`);
|
|
473014
473161
|
}
|
|
473015
|
-
const events = await Promise.all(names2.map(async (name) => JSON.parse(await
|
|
473162
|
+
const events = await Promise.all(names2.map(async (name) => JSON.parse(await readFile28(join98(eventsDir, name), "utf-8"))));
|
|
473016
473163
|
return JSON.stringify(events);
|
|
473017
473164
|
}
|
|
473018
473165
|
async function openReadOnlyDatabase(path47) {
|
|
@@ -473085,7 +473232,7 @@ import { createHash as createHash19 } from "node:crypto";
|
|
|
473085
473232
|
import {
|
|
473086
473233
|
mkdir as mkdir16,
|
|
473087
473234
|
readdir as readdir15,
|
|
473088
|
-
readFile as
|
|
473235
|
+
readFile as readFile29,
|
|
473089
473236
|
rm as rm12,
|
|
473090
473237
|
stat as stat17,
|
|
473091
473238
|
writeFile as writeFile19
|
|
@@ -473258,7 +473405,7 @@ async function runTrajectoryExport(options) {
|
|
|
473258
473405
|
if (!supported.includes(explicit.source)) {
|
|
473259
473406
|
throw new Error(`Unknown source "${explicit.source}" in --transcript. The installed trajectory package supports: ${supported.join(", ")}.`);
|
|
473260
473407
|
}
|
|
473261
|
-
await exportTranscript(explicit.source, basename30(explicit.path).replace(/\.[^.]+$/, ""), explicit.path, () =>
|
|
473408
|
+
await exportTranscript(explicit.source, basename30(explicit.path).replace(/\.[^.]+$/, ""), explicit.path, () => readFile29(explicit.path, "utf-8"));
|
|
473262
473409
|
}
|
|
473263
473410
|
for (const checkpoint of options.deepagents ?? []) {
|
|
473264
473411
|
await exportCheckpoint(checkpoint, `${basename30(checkpoint.path)}-${checkpoint.threadId}`);
|
|
@@ -473275,12 +473422,12 @@ var init_export = __esm(() => {
|
|
|
473275
473422
|
});
|
|
473276
473423
|
|
|
473277
473424
|
// src/cli/subcommands/trajectories/review.ts
|
|
473278
|
-
import { readFile as
|
|
473425
|
+
import { readFile as readFile30 } from "node:fs/promises";
|
|
473279
473426
|
import { isAbsolute as isAbsolute26, join as join100 } from "node:path";
|
|
473280
473427
|
async function readManifest(dir) {
|
|
473281
473428
|
let raw2;
|
|
473282
473429
|
try {
|
|
473283
|
-
raw2 = await
|
|
473430
|
+
raw2 = await readFile30(join100(dir, "manifest.json"), "utf-8");
|
|
473284
473431
|
} catch {
|
|
473285
473432
|
throw new Error(`No manifest at ${join100(dir, "manifest.json")}. Run: letta trajectories export --out ${dir}`);
|
|
473286
473433
|
}
|
|
@@ -473293,7 +473440,7 @@ async function resolveSessionFile(dir, target2) {
|
|
|
473293
473440
|
if (target2.endsWith(".json")) {
|
|
473294
473441
|
const direct = isAbsolute26(target2) ? target2 : join100(dir, target2);
|
|
473295
473442
|
try {
|
|
473296
|
-
await
|
|
473443
|
+
await readFile30(direct, "utf-8");
|
|
473297
473444
|
return direct;
|
|
473298
473445
|
} catch {}
|
|
473299
473446
|
}
|
|
@@ -473345,7 +473492,7 @@ async function searchSessions(dir, keyword, options = {}) {
|
|
|
473345
473492
|
for (const session3 of filterSessions(manifest2.sessions, options)) {
|
|
473346
473493
|
let records2;
|
|
473347
473494
|
try {
|
|
473348
|
-
records2 = JSON.parse(await
|
|
473495
|
+
records2 = JSON.parse(await readFile30(join100(dir, session3.file), "utf-8"));
|
|
473349
473496
|
} catch {
|
|
473350
473497
|
continue;
|
|
473351
473498
|
}
|
|
@@ -473376,7 +473523,7 @@ var TOOL_RESULT_MAX_CHARS = 500, REASONING_MAX_CHARS = 300, TOOL_ARGS_MAX_CHARS
|
|
|
473376
473523
|
var init_review = () => {};
|
|
473377
473524
|
|
|
473378
473525
|
// src/cli/subcommands/trajectories.ts
|
|
473379
|
-
import { readFile as
|
|
473526
|
+
import { readFile as readFile31 } from "node:fs/promises";
|
|
473380
473527
|
import { parseArgs as parseArgs23 } from "node:util";
|
|
473381
473528
|
function printUsage19() {
|
|
473382
473529
|
console.log(`
|
|
@@ -473483,7 +473630,7 @@ async function runView(flags, target2, options) {
|
|
|
473483
473630
|
return 1;
|
|
473484
473631
|
}
|
|
473485
473632
|
const path47 = await resolveSessionFile(flags.dir, target2);
|
|
473486
|
-
const records2 = JSON.parse(await
|
|
473633
|
+
const records2 = JSON.parse(await readFile31(path47, "utf-8"));
|
|
473487
473634
|
console.log(renderSession(records2, options));
|
|
473488
473635
|
return 0;
|
|
473489
473636
|
}
|
|
@@ -481104,7 +481251,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
481104
481251
|
environment: environmentRouting.environment
|
|
481105
481252
|
}) : { source: "same-environment" };
|
|
481106
481253
|
const launchParams = {
|
|
481107
|
-
noWait: Boolean(values4["no-wait"]),
|
|
481254
|
+
noWait: isAgentLaunch || Boolean(values4["no-wait"]),
|
|
481108
481255
|
clientMessageId: values4["client-message-id"],
|
|
481109
481256
|
connectionId,
|
|
481110
481257
|
scope: {
|
|
@@ -484464,7 +484611,7 @@ var init_reflection_arena_hf_upload = __esm(() => {
|
|
|
484464
484611
|
// src/cli/helpers/reflection-arena.ts
|
|
484465
484612
|
import { execFile as execFileCb6 } from "node:child_process";
|
|
484466
484613
|
import { randomInt as randomInt2, randomUUID as randomUUID58 } from "node:crypto";
|
|
484467
|
-
import { appendFile as appendFile3, mkdir as mkdir18, readFile as
|
|
484614
|
+
import { appendFile as appendFile3, mkdir as mkdir18, readFile as readFile32, writeFile as writeFile21 } from "node:fs/promises";
|
|
484468
484615
|
import { homedir as homedir55 } from "node:os";
|
|
484469
484616
|
import { join as join104 } from "node:path";
|
|
484470
484617
|
import { promisify as promisify21 } from "node:util";
|
|
@@ -484532,7 +484679,7 @@ async function saveReflectionArenaRun(run) {
|
|
|
484532
484679
|
`, "utf-8");
|
|
484533
484680
|
}
|
|
484534
484681
|
async function loadReflectionArenaRun(runId) {
|
|
484535
|
-
const raw2 = await
|
|
484682
|
+
const raw2 = await readFile32(getReflectionArenaRunPath(runId), "utf-8");
|
|
484536
484683
|
return JSON.parse(raw2);
|
|
484537
484684
|
}
|
|
484538
484685
|
async function updateReflectionArenaRun(runId, update3) {
|
|
@@ -484724,7 +484871,7 @@ async function appendChoiceRecord(run) {
|
|
|
484724
484871
|
}
|
|
484725
484872
|
async function readTranscriptPayloadForTelemetry(payloadPath) {
|
|
484726
484873
|
try {
|
|
484727
|
-
const transcript2 = await
|
|
484874
|
+
const transcript2 = await readFile32(payloadPath, "utf-8");
|
|
484728
484875
|
return {
|
|
484729
484876
|
transcriptPayload: transcript2.slice(0, REFLECTION_ARENA_TELEMETRY_TRANSCRIPT_MAX_CHARS),
|
|
484730
484877
|
transcriptPayloadChars: transcript2.length,
|
|
@@ -504103,7 +504250,7 @@ var init_PersonalitySelector = __esm(async () => {
|
|
|
504103
504250
|
});
|
|
504104
504251
|
|
|
504105
504252
|
// src/utils/aws-credentials.ts
|
|
504106
|
-
import { readFile as
|
|
504253
|
+
import { readFile as readFile33 } from "node:fs/promises";
|
|
504107
504254
|
import { homedir as homedir60 } from "node:os";
|
|
504108
504255
|
import { join as join110 } from "node:path";
|
|
504109
504256
|
async function parseAwsCredentials() {
|
|
@@ -504111,11 +504258,11 @@ async function parseAwsCredentials() {
|
|
|
504111
504258
|
const configPath = join110(homedir60(), ".aws", "config");
|
|
504112
504259
|
const profiles = new Map;
|
|
504113
504260
|
try {
|
|
504114
|
-
const content = await
|
|
504261
|
+
const content = await readFile33(credentialsPath, "utf-8");
|
|
504115
504262
|
parseIniFile(content, profiles, false);
|
|
504116
504263
|
} catch {}
|
|
504117
504264
|
try {
|
|
504118
|
-
const content = await
|
|
504265
|
+
const content = await readFile33(configPath, "utf-8");
|
|
504119
504266
|
parseIniFile(content, profiles, true);
|
|
504120
504267
|
} catch {}
|
|
504121
504268
|
return Array.from(profiles.values());
|
|
@@ -518414,7 +518561,7 @@ The deployment target for this project is CITATION-DOGFOOD-OK.
|
|
|
518414
518561
|
|
|
518415
518562
|
// src/mods/learning-harness.ts
|
|
518416
518563
|
import { spawn as spawn14 } from "node:child_process";
|
|
518417
|
-
import { access as access2, copyFile as copyFile2, mkdir as mkdir19, readFile as
|
|
518564
|
+
import { access as access2, copyFile as copyFile2, mkdir as mkdir19, readFile as readFile34, writeFile as writeFile22 } from "node:fs/promises";
|
|
518418
518565
|
import path48 from "node:path";
|
|
518419
518566
|
function slugify2(value) {
|
|
518420
518567
|
const slug = value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
@@ -519906,7 +520053,7 @@ async function runModLearning(options) {
|
|
|
519906
520053
|
return report;
|
|
519907
520054
|
}
|
|
519908
520055
|
async function readModLearningEnv(envPath) {
|
|
519909
|
-
return JSON.parse(await
|
|
520056
|
+
return JSON.parse(await readFile34(envPath, "utf8"));
|
|
519910
520057
|
}
|
|
519911
520058
|
var init_learning_harness = __esm(async () => {
|
|
519912
520059
|
await init_mod_engine();
|
|
@@ -532210,4 +532357,4 @@ function registerBunOAuthFlows() {
|
|
|
532210
532357
|
registerBunOAuthFlows();
|
|
532211
532358
|
await init_src5().then(() => exports_src2);
|
|
532212
532359
|
|
|
532213
|
-
//# debugId=
|
|
532360
|
+
//# debugId=1C721B327AF1462E64756E2164756E21
|