Multi-agent audit + aggressive cleanup across server/web/coder/booterm, delivered behind a DEFER discipline so none of the in-flight files were touched. Removes dead code/deps/columns, dedups server + coder helpers, and splits the oversized modules (tools.ts, opencode-server.ts, sentinel-summaries, turn.ts, TerminalPane.tsx) behind stable contracts. Adds 78 parity/unit tests (server 587, coder 323); fixes two latent bugs (ChatPane queue keys, FileViewerOverlay blank-line parity). Intended tag: v2.7.12-audit-cleanup. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { resolveToolBudget } from '../inference/budget.js';
|
|
import type { Agent } from '../../types/api.js';
|
|
|
|
const BASE_AGENT: Agent = {
|
|
id: 'test-agent',
|
|
name: 'Test',
|
|
description: 'test',
|
|
system_prompt: '',
|
|
temperature: 0.7,
|
|
top_p: null,
|
|
top_k: null,
|
|
min_p: null,
|
|
presence_penalty: null,
|
|
top_n_sigma: null,
|
|
dry_multiplier: null,
|
|
dry_base: null,
|
|
dry_allowed_length: null,
|
|
dry_penalty_last_n: null,
|
|
tools: ['view_file'],
|
|
model: null,
|
|
source: 'global',
|
|
max_tool_calls: null,
|
|
steps: null,
|
|
llama_extra_args: null,
|
|
};
|
|
|
|
describe('resolveToolBudget', () => {
|
|
it('returns 100 when agent is null (no-agent raw chat)', () => {
|
|
expect(resolveToolBudget(null)).toBe(100);
|
|
});
|
|
|
|
it('returns 100 when agent has no max_tool_calls override', () => {
|
|
expect(resolveToolBudget(BASE_AGENT)).toBe(100);
|
|
});
|
|
|
|
it('returns max_tool_calls when agent overrides the default', () => {
|
|
const agent: Agent = { ...BASE_AGENT, max_tool_calls: 25 };
|
|
expect(resolveToolBudget(agent)).toBe(25);
|
|
});
|
|
|
|
it('returns 0 when max_tool_calls is explicitly 0 (text-only mode)', () => {
|
|
const agent: Agent = { ...BASE_AGENT, max_tool_calls: 0 };
|
|
expect(resolveToolBudget(agent)).toBe(0);
|
|
});
|
|
});
|