Files
oh-my-pi/packages/coding-agent/src/modes/components/thinking-selector.ts
T
can1357 8e3e0ebf9e feat: introduced Effort enum and ThinkingConfig for model-aware reasoning
- Introduced Effort enum and ThinkingConfig metadata for per-model reasoning capabilities with min/max effort levels.
- Migrated thinking level API from string-based ThinkingLevel to structured Effort enum across agent and AI packages.
- Added model-thinking module with effort mapping, policy application, and semantic versioning utilities for provider-specific thinking modes.
- Removed supportsXhigh() function and replaced effort clamping with model-aware validation using ThinkingConfig metadata.
- Expanded models.json with thinking configuration objects for 50+ models including Claude, Gemini, and OpenAI variants.
- Added Python analysis scripts for edit tool usage patterns and tool invocation stream processing.
2026-03-06 12:35:01 +01:00

53 lines
1.3 KiB
TypeScript

import type { Effort } from "@oh-my-pi/pi-ai";
import { Container, type SelectItem, SelectList } from "@oh-my-pi/pi-tui";
import { getSelectListTheme } from "../../modes/theme/theme";
import { getThinkingLevelMetadata } from "../../thinking";
import { DynamicBorder } from "./dynamic-border";
/**
* Component that renders a thinking level selector with borders
*/
export class ThinkingSelectorComponent extends Container {
#selectList: SelectList;
constructor(
currentLevel: Effort,
availableLevels: Effort[],
onSelect: (level: Effort) => void,
onCancel: () => void,
) {
super();
const thinkingLevels: SelectItem[] = availableLevels.map(getThinkingLevelMetadata);
// Add top border
this.addChild(new DynamicBorder());
// Create selector
this.#selectList = new SelectList(thinkingLevels, thinkingLevels.length, getSelectListTheme());
// Preselect current level
const currentIndex = thinkingLevels.findIndex(item => item.value === currentLevel);
if (currentIndex !== -1) {
this.#selectList.setSelectedIndex(currentIndex);
}
this.#selectList.onSelect = item => {
onSelect(item.value as Effort);
};
this.#selectList.onCancel = () => {
onCancel();
};
this.addChild(this.#selectList);
// Add bottom border
this.addChild(new DynamicBorder());
}
getSelectList(): SelectList {
return this.#selectList;
}
}