@blockrun/franklin 3.8.41 → 3.8.42
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 +14 -3
- package/dist/commands/config.d.ts +6 -4
- package/package.json +1 -1
package/dist/agent/loop.js
CHANGED
|
@@ -497,13 +497,23 @@ export async function interactiveSession(config, getUserInput, onEvent, onAbortR
|
|
|
497
497
|
// negative number disables the cap; a non-numeric / unparseable value
|
|
498
498
|
// is treated as a typo and falls back to the safe default rather than
|
|
499
499
|
// silently removing the wallet guard.
|
|
500
|
+
//
|
|
501
|
+
// Default raised from $0.25 → $1.00 in v3.8.42 — the original ceiling
|
|
502
|
+
// dated from when Franklin was mostly chat. Real workloads (multi-stage
|
|
503
|
+
// dashboard scaffolds on sonnet, image-to-image edits, research-heavy
|
|
504
|
+
// turns) routinely land in the $0.20–$0.80 range on a single legit
|
|
505
|
+
// prompt. $1.00 is still meaningful as a runaway-protection guardrail
|
|
506
|
+
// (catches the kind of failure v3.8.41's retry-policy was built for)
|
|
507
|
+
// but doesn't impose a friction tax on every multi-stage task. Users
|
|
508
|
+
// who liked the old ceiling can opt back in via the config.
|
|
509
|
+
const TURN_SPEND_DEFAULT_USD = 1.0;
|
|
500
510
|
const turnSpendCap = (() => {
|
|
501
511
|
const raw = loadConfig()['max-turn-spend-usd'];
|
|
502
512
|
if (raw == null)
|
|
503
|
-
return
|
|
513
|
+
return TURN_SPEND_DEFAULT_USD;
|
|
504
514
|
const parsed = Number(raw);
|
|
505
515
|
if (!Number.isFinite(parsed))
|
|
506
|
-
return
|
|
516
|
+
return TURN_SPEND_DEFAULT_USD; // typo → keep default
|
|
507
517
|
if (parsed <= 0)
|
|
508
518
|
return Infinity; // explicit opt-out
|
|
509
519
|
return parsed;
|
|
@@ -1022,7 +1032,8 @@ export async function interactiveSession(config, getUserInput, onEvent, onAbortR
|
|
|
1022
1032
|
if (turnSpend > MAX_TURN_SPEND_USD) {
|
|
1023
1033
|
onEvent({
|
|
1024
1034
|
kind: 'text_delta',
|
|
1025
|
-
text: `\n\n⚠️ Turn spend limit reached ($${turnSpend.toFixed(3)} > $${MAX_TURN_SPEND_USD}). Stopping to protect your wallet
|
|
1035
|
+
text: `\n\n⚠️ Turn spend limit reached ($${turnSpend.toFixed(3)} > $${MAX_TURN_SPEND_USD}). Stopping to protect your wallet.\n` +
|
|
1036
|
+
`Raise the cap with \`franklin config set max-turn-spend-usd 2.0\` (or \`0\` to disable), then \`/retry\`.\n`,
|
|
1026
1037
|
});
|
|
1027
1038
|
onEvent({ kind: 'turn_done', reason: 'budget' });
|
|
1028
1039
|
break;
|
|
@@ -7,10 +7,12 @@ export interface AppConfig {
|
|
|
7
7
|
'permission-mode'?: string;
|
|
8
8
|
'max-turns'?: string;
|
|
9
9
|
/**
|
|
10
|
-
* Hard per-turn spend ceiling in USD (default $
|
|
11
|
-
* e.g. "0.5" or "2". Set to "0" to disable the cap.
|
|
12
|
-
* stops a turn the moment cumulative cost crosses this
|
|
13
|
-
* preventing a runaway model + tool combo from draining the
|
|
10
|
+
* Hard per-turn spend ceiling in USD (default $1.00 as of v3.8.42).
|
|
11
|
+
* Numeric string, e.g. "0.5" or "2". Set to "0" to disable the cap.
|
|
12
|
+
* The agent loop stops a turn the moment cumulative cost crosses this
|
|
13
|
+
* threshold, preventing a runaway model + tool combo from draining the
|
|
14
|
+
* wallet. Earlier versions used $0.25, which routinely fired on legit
|
|
15
|
+
* multi-stage tasks (dashboard scaffolds, image-to-image edits).
|
|
14
16
|
*/
|
|
15
17
|
'max-turn-spend-usd'?: string;
|
|
16
18
|
'auto-compact'?: string;
|
package/package.json
CHANGED