feat: add P2 features — retry policy, prompt templating, usage tracking, tech debt cleanup
- Extract shared splitMessage() into channels/utils.ts (dedup 4 adapters) - Add Slack user name resolution with caching (users.info API) - Add withRetry() with exponential backoff + jitter, isRetryable() filter - Wire retry config into ModelRouter.chat() (non-streaming only) - Add assembleSystemPrompt() multi-file template system (SOUL/AGENTS/IDENTITY/USER/TOOLS.md) - Add usage tracking accumulators in NativeAgent + AgentOrchestrator - Add estimateCost() with per-model pricing table - Add /usage TUI command with full usage report formatting - Add retrySchema and promptSchema to config schema Tests: 569 passing, typecheck clean
This commit is contained in:
@@ -30,6 +30,10 @@ describe('parseCommand', () => {
|
||||
expect(parseCommand('/compact')).toEqual({ type: 'compact' });
|
||||
});
|
||||
|
||||
it('parses /usage command', () => {
|
||||
expect(parseCommand('/usage')).toEqual({ type: 'usage' });
|
||||
});
|
||||
|
||||
it('parses /model command without argument', () => {
|
||||
expect(parseCommand('/model')).toEqual({ type: 'model' });
|
||||
});
|
||||
@@ -69,6 +73,7 @@ describe('getHelpText', () => {
|
||||
expect(help).toContain('/model');
|
||||
expect(help).toContain('/reset');
|
||||
expect(help).toContain('/compact');
|
||||
expect(help).toContain('/usage');
|
||||
expect(help).toContain('/quit');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,6 +5,7 @@ export type Command =
|
||||
| { type: 'status' }
|
||||
| { type: 'fullscreen' }
|
||||
| { type: 'compact' }
|
||||
| { type: 'usage' }
|
||||
| { type: 'model'; name?: string }
|
||||
| { type: 'backend'; provider?: string }
|
||||
| { type: 'transfer'; target: string }
|
||||
@@ -44,6 +45,11 @@ export function parseCommand(input: string): Command | null {
|
||||
return { type: 'compact' };
|
||||
}
|
||||
|
||||
// Usage
|
||||
if (trimmed === '/usage') {
|
||||
return { type: 'usage' };
|
||||
}
|
||||
|
||||
// Model (with optional argument)
|
||||
if (trimmed === '/model') {
|
||||
return { type: 'model' };
|
||||
@@ -80,6 +86,7 @@ Commands:
|
||||
/backend [provider] Show or switch local backend (ollama, llamacpp)
|
||||
/reset, /clear, /new Clear conversation history
|
||||
/compact Compact conversation history
|
||||
/usage Show token usage and estimated cost
|
||||
/status Show session info and token usage
|
||||
/fullscreen, /fs Switch to fullscreen mode
|
||||
/transfer <dest> Transfer session to another frontend
|
||||
@@ -98,6 +105,7 @@ export const SLASH_COMMANDS = [
|
||||
'/clear',
|
||||
'/new',
|
||||
'/compact',
|
||||
'/usage',
|
||||
'/status',
|
||||
'/fullscreen',
|
||||
'/fs',
|
||||
@@ -115,6 +123,7 @@ export const COMMAND_TOOLTIPS: Record<string, string> = {
|
||||
'/clear': 'Clear conversation history',
|
||||
'/new': 'Start a new conversation',
|
||||
'/compact': 'Compact conversation history to save context space',
|
||||
'/usage': 'Show token usage and estimated cost',
|
||||
'/status': 'Show session info and token usage',
|
||||
'/fullscreen': 'Switch to fullscreen mode',
|
||||
'/fs': 'Switch to fullscreen mode',
|
||||
|
||||
Reference in New Issue
Block a user