@blockrun/franklin 3.15.60 → 3.15.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/loop.js +11 -1
- package/package.json +1 -1
package/dist/agent/loop.js
CHANGED
|
@@ -1054,6 +1054,15 @@ export async function interactiveSession(config, getUserInput, onEvent, onAbortR
|
|
|
1054
1054
|
// llm.ts if `tools` ended up empty, so it's safe to attach here.
|
|
1055
1055
|
const callToolChoice = forceToolChoiceNextRound;
|
|
1056
1056
|
forceToolChoiceNextRound = null;
|
|
1057
|
+
// Wall-clock start of the model call. Used by the recordUsage call
|
|
1058
|
+
// a few hundred lines below so franklin-stats.json captures real
|
|
1059
|
+
// latency. Verified 2026-05-05: `franklin stats` reported
|
|
1060
|
+
// `avgLat=0.0s` for every model across 5300+ requests because the
|
|
1061
|
+
// agent-loop callsite always passed 0 for latencyMs (proxy path
|
|
1062
|
+
// already measured correctly). `franklin insights` couldn't surface
|
|
1063
|
+
// "this model is consistently slow" or "fallback was faster" until
|
|
1064
|
+
// this was fixed.
|
|
1065
|
+
const llmCallStartedAt = Date.now();
|
|
1057
1066
|
try {
|
|
1058
1067
|
const result = await client.complete({
|
|
1059
1068
|
model: resolvedModel,
|
|
@@ -1354,7 +1363,8 @@ export async function interactiveSession(config, getUserInput, onEvent, onAbortR
|
|
|
1354
1363
|
// franklin-debug.log; `franklin insights` was therefore useless
|
|
1355
1364
|
// for spotting a hot routing chain.
|
|
1356
1365
|
const costEstimate = estimateCost(resolvedModel, inputTokens, usage.outputTokens, 1);
|
|
1357
|
-
|
|
1366
|
+
const llmLatencyMs = Date.now() - llmCallStartedAt;
|
|
1367
|
+
recordUsage(resolvedModel, inputTokens, usage.outputTokens, costEstimate, llmLatencyMs, turnFailedModels.size > 0);
|
|
1358
1368
|
// ── Circuit breakers: prevent infinite-loop wallet drain ──
|
|
1359
1369
|
// Per-turn $-cap was removed in v3.11.0 — runaway loops are caught by
|
|
1360
1370
|
// MAX_TOOL_CALLS_PER_TURN (25) and MAX_TINY_RESPONSES (2) above; the
|
package/package.json
CHANGED