mirror of
https://github.com/davidkaya/aryx.git
synced 2026-07-24 13:38:43 +02:00
- parse prompt model and argument-hint metadata and persist model on prompt invocations - expand markdown-linked file context in scanned prompt and instruction bodies - discover .claude/rules instructions and support Claude-style paths metadata - discover customization roots up to the nearest parent repository and watch them for changes - apply per-turn prompt model overrides before sidecar execution Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
82 lines
2.4 KiB
TypeScript
82 lines
2.4 KiB
TypeScript
import { describe, expect, test } from 'bun:test';
|
|
|
|
import type { SidecarModelCapability } from '@shared/contracts/sidecar';
|
|
import {
|
|
buildAvailableModelCatalog,
|
|
findModel,
|
|
findModelByReference,
|
|
normalizePatternModels,
|
|
resolveReasoningEffort,
|
|
} from '@shared/domain/models';
|
|
import type { PatternDefinition } from '@shared/domain/pattern';
|
|
|
|
const availableModels: SidecarModelCapability[] = [
|
|
{
|
|
id: 'claude-sonnet-4.5',
|
|
name: 'Claude Sonnet 4.5',
|
|
supportedReasoningEfforts: [],
|
|
},
|
|
{
|
|
id: 'gpt-5.4',
|
|
name: 'GPT-5.4',
|
|
supportedReasoningEfforts: ['low', 'medium', 'high', 'xhigh'],
|
|
defaultReasoningEffort: 'medium',
|
|
},
|
|
];
|
|
|
|
function createPattern(): PatternDefinition {
|
|
return {
|
|
id: 'pattern-1',
|
|
name: 'Pattern',
|
|
description: '',
|
|
mode: 'single',
|
|
availability: 'available',
|
|
maxIterations: 1,
|
|
agents: [
|
|
{
|
|
id: 'agent-1',
|
|
name: 'Primary Agent',
|
|
description: 'Helpful assistant',
|
|
instructions: 'Help the user.',
|
|
model: 'claude-sonnet-4.5',
|
|
reasoningEffort: 'high',
|
|
},
|
|
],
|
|
createdAt: '2026-03-23T00:00:00.000Z',
|
|
updatedAt: '2026-03-23T00:00:00.000Z',
|
|
};
|
|
}
|
|
|
|
describe('dynamic model catalog', () => {
|
|
test('builds the available model list from sidecar capabilities', () => {
|
|
const catalog = buildAvailableModelCatalog(availableModels);
|
|
|
|
expect(catalog.map((model) => model.id)).toEqual(['gpt-5.4', 'claude-sonnet-4.5']);
|
|
expect(findModel('claude-sonnet-4.5', catalog)?.supportedReasoningEfforts).toEqual([]);
|
|
expect(findModel('gpt-5.4', catalog)?.defaultReasoningEffort).toBe('medium');
|
|
});
|
|
|
|
test('drops unsupported reasoning effort selections for a model', () => {
|
|
const catalog = buildAvailableModelCatalog(availableModels);
|
|
const model = findModel('claude-sonnet-4.5', catalog);
|
|
|
|
expect(resolveReasoningEffort(model, 'high')).toBeUndefined();
|
|
});
|
|
|
|
test('resolves model references by id or display name', () => {
|
|
const catalog = buildAvailableModelCatalog(availableModels);
|
|
|
|
expect(findModelByReference('gpt-5.4', catalog)?.id).toBe('gpt-5.4');
|
|
expect(findModelByReference('Claude Sonnet 4.5', catalog)?.id).toBe('claude-sonnet-4.5');
|
|
});
|
|
|
|
test('normalizes pattern agents before runtime execution', () => {
|
|
const normalized = normalizePatternModels(
|
|
createPattern(),
|
|
buildAvailableModelCatalog(availableModels),
|
|
);
|
|
|
|
expect(normalized.agents[0].reasoningEffort).toBeUndefined();
|
|
});
|
|
});
|