@hexdecimal16/nexo 0.3.2 → 0.3.3
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.
|
@@ -66,6 +66,8 @@ export const ConfigSchema = Type.Object({
|
|
|
66
66
|
budgets: Type.Object({
|
|
67
67
|
perRunUsd: Usd,
|
|
68
68
|
perSessionUsd: Usd,
|
|
69
|
+
/** Share of the session cap one chat turn may spend (0 to 1); CLI runs, scoring and optimization use perRunUsd. */
|
|
70
|
+
perTurnShare: Type.Number({ exclusiveMinimum: 0, maximum: 1 }),
|
|
69
71
|
dailyUsd: Usd,
|
|
70
72
|
monthlyUsd: Usd,
|
|
71
73
|
optimDefaultUsd: Usd,
|
|
@@ -163,6 +165,7 @@ export const DEFAULT_CONFIG = {
|
|
|
163
165
|
budgets: {
|
|
164
166
|
perRunUsd: 0.5,
|
|
165
167
|
perSessionUsd: 5,
|
|
168
|
+
perTurnShare: 0.2,
|
|
166
169
|
dailyUsd: 10,
|
|
167
170
|
monthlyUsd: 150,
|
|
168
171
|
optimDefaultUsd: 5,
|
|
@@ -60,8 +60,9 @@ export function runBudgetLimit(db, budgets, now, limits) {
|
|
|
60
60
|
{ usd: budgets.monthlyUsd - getSpent(db, monthScope(now)), by: "monthly" },
|
|
61
61
|
];
|
|
62
62
|
let best = candidates[0];
|
|
63
|
+
// Ties go to the later (outer) limit: it is the one the user has to raise.
|
|
63
64
|
for (const c of candidates)
|
|
64
|
-
if (c.usd
|
|
65
|
+
if (c.usd <= best.usd)
|
|
65
66
|
best = c;
|
|
66
67
|
return { usd: Math.max(0, best.usd), by: best.by };
|
|
67
68
|
}
|
|
@@ -75,7 +76,7 @@ export function budgetExhaustedError(budget, by, chat) {
|
|
|
75
76
|
const capped = by === "run" ? "" : `; ${CAPPED_BY[by]}`;
|
|
76
77
|
const hint = {
|
|
77
78
|
run: chat
|
|
78
|
-
? "Each chat turn is capped
|
|
79
|
+
? "Each chat turn is capped at budgets.perTurnShare of the session budget; raise the share in /settings or the session cap with /budget"
|
|
79
80
|
: "Pass --budget or raise budgets.perRunUsd",
|
|
80
81
|
session: "Raise the session's budget with /budget <usd>, then continue",
|
|
81
82
|
daily: "Raise budgets.dailyUsd or wait until tomorrow (UTC)",
|
|
@@ -6,7 +6,7 @@ Working rules:
|
|
|
6
6
|
- Before following a skill, call load_skill with its name and follow its instructions.
|
|
7
7
|
- Make independent tool calls in the same turn, and combine related shell steps into one command. To read several files, pass paths to one read call.
|
|
8
8
|
- Scope searches to a directory, never find /. Start a command that may outlive the bash timeout in the background (nohup ... > job.log 2>&1 &) and poll the log.
|
|
9
|
-
- A budget line is appended to your latest input each turn.
|
|
9
|
+
- A budget line is appended to your latest input each turn. Prefer fewer, larger steps when it is low. Never say you hit or ran out of budget unless the budget line shows $0.0000 remaining or a tool result says BUDGET_EXCEEDED; otherwise finish the task.
|
|
10
10
|
- End with a concise final answer that states what you did and where any output files are.`;
|
|
11
11
|
export const DEFAULT_PLANNER_PROMPT = `Parallel work:
|
|
12
12
|
- When the instruction has independent parts, call spawn once with all independent tasks so they run in parallel.
|
|
@@ -283,7 +283,7 @@ export class Session {
|
|
|
283
283
|
catch (error) {
|
|
284
284
|
return refusedResult(this.env.deps.redact(toErrorPayload(error)));
|
|
285
285
|
}
|
|
286
|
-
const limit = runBudgetLimit(this.deps.db, config.budgets, this.env.now(), { run: config.budgets.
|
|
286
|
+
const limit = runBudgetLimit(this.deps.db, config.budgets, this.env.now(), { run: config.budgets.perTurnShare * this.budgetUsd, session: remaining });
|
|
287
287
|
const turnIndex = this.state.turns + 1;
|
|
288
288
|
this.onEvent = options.onEvent;
|
|
289
289
|
const sent = withShellNotes(this.state.pendingShell ?? [], instruction);
|
|
@@ -26,6 +26,12 @@ export const EDITABLE_SETTINGS = [
|
|
|
26
26
|
{ key: "models.s2.effort", label: "Effort s2", description: "Default reasoning effort for s2", type: { kind: "enum", values: EFFORTS } },
|
|
27
27
|
{ key: "budgets.perRunUsd", label: "Budget per run", description: "Spending cap for one run or turn, in USD", type: USD },
|
|
28
28
|
{ key: "budgets.perSessionUsd", label: "Budget per session", description: "Spending cap for one interactive session, in USD", type: USD },
|
|
29
|
+
{
|
|
30
|
+
key: "budgets.perTurnShare",
|
|
31
|
+
label: "Turn share of session",
|
|
32
|
+
description: "Share of the session budget one chat turn may spend (0 to 1); budgets.perRunUsd still caps CLI runs",
|
|
33
|
+
type: { kind: "number", integer: false, exclusiveMin: 0, max: 1 },
|
|
34
|
+
},
|
|
29
35
|
{ key: "budgets.dailyUsd", label: "Daily budget", description: "Spending cap per UTC day, in USD", type: USD },
|
|
30
36
|
{ key: "budgets.monthlyUsd", label: "Monthly budget", description: "Spending cap per UTC month, in USD", type: USD },
|
|
31
37
|
{
|