@letta-ai/letta-code 0.19.8 → 0.19.9
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/letta.js +1526 -800
- package/package.json +1 -1
- package/scripts/latency-benchmark.ts +18 -9
package/package.json
CHANGED
|
@@ -128,7 +128,9 @@ function parseTimingLogs(stderr: string): {
|
|
|
128
128
|
/**
|
|
129
129
|
* Run a single benchmark scenario
|
|
130
130
|
*/
|
|
131
|
-
async function runBenchmark(
|
|
131
|
+
async function runBenchmark(
|
|
132
|
+
scenario: ScenarioConfig,
|
|
133
|
+
): Promise<BenchmarkResult> {
|
|
132
134
|
const start = performance.now();
|
|
133
135
|
|
|
134
136
|
return new Promise((resolve) => {
|
|
@@ -210,16 +212,16 @@ function printResults(results: BenchmarkResult[]): void {
|
|
|
210
212
|
// Print API calls summary
|
|
211
213
|
if (result.apiCalls.length > 0) {
|
|
212
214
|
console.log(" API Calls:");
|
|
213
|
-
const totalApiMs = result.apiCalls.reduce(
|
|
215
|
+
const totalApiMs = result.apiCalls.reduce(
|
|
216
|
+
(sum, c) => sum + c.durationMs,
|
|
217
|
+
0,
|
|
218
|
+
);
|
|
214
219
|
|
|
215
220
|
// Group by path pattern
|
|
216
221
|
const grouped: Record<string, { count: number; totalMs: number }> = {};
|
|
217
222
|
for (const call of result.apiCalls) {
|
|
218
223
|
// Normalize paths (remove UUIDs)
|
|
219
|
-
const normalizedPath = call.path.replace(
|
|
220
|
-
/[a-f0-9-]{36}/g,
|
|
221
|
-
"{id}",
|
|
222
|
-
);
|
|
224
|
+
const normalizedPath = call.path.replace(/[a-f0-9-]{36}/g, "{id}");
|
|
223
225
|
const key = `${call.method} ${normalizedPath}`;
|
|
224
226
|
if (!grouped[key]) {
|
|
225
227
|
grouped[key] = { count: 0, totalMs: 0 };
|
|
@@ -262,7 +264,10 @@ function printResults(results: BenchmarkResult[]): void {
|
|
|
262
264
|
console.log("-".repeat(70));
|
|
263
265
|
|
|
264
266
|
for (const result of results) {
|
|
265
|
-
const totalApiMs = result.apiCalls.reduce(
|
|
267
|
+
const totalApiMs = result.apiCalls.reduce(
|
|
268
|
+
(sum, c) => sum + c.durationMs,
|
|
269
|
+
0,
|
|
270
|
+
);
|
|
266
271
|
const cliOverhead = result.totalMs - totalApiMs;
|
|
267
272
|
console.log(
|
|
268
273
|
result.scenario.padEnd(20) +
|
|
@@ -301,7 +306,9 @@ async function main(): Promise<void> {
|
|
|
301
306
|
|
|
302
307
|
if (scenariosToRun.length === 0) {
|
|
303
308
|
console.error(`Error: Unknown scenario "${scenarioFilter}"`);
|
|
304
|
-
console.error(
|
|
309
|
+
console.error(
|
|
310
|
+
`Available scenarios: ${SCENARIOS.map((s) => s.name).join(", ")}`,
|
|
311
|
+
);
|
|
305
312
|
process.exit(1);
|
|
306
313
|
}
|
|
307
314
|
|
|
@@ -323,7 +330,9 @@ async function main(): Promise<void> {
|
|
|
323
330
|
allResults.push(result);
|
|
324
331
|
|
|
325
332
|
if (result.exitCode !== 0) {
|
|
326
|
-
console.warn(
|
|
333
|
+
console.warn(
|
|
334
|
+
` Warning: ${scenario.name} exited with code ${result.exitCode}`,
|
|
335
|
+
);
|
|
327
336
|
} else {
|
|
328
337
|
console.log(` Completed in ${formatMs(result.totalMs)}`);
|
|
329
338
|
}
|