@thegitai/cli 1.0.0-preview.52 → 1.0.0-preview.54
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.
- package/README.md +17 -0
- package/dist/src/api/chat.js +2 -0
- package/dist/src/background-jobs.js +4 -0
- package/dist/src/help-text.js +1 -1
- package/dist/src/job-follow-up.js +35 -6
- package/dist/src/project-key.js +11 -0
- package/dist/src/project-model-preferences.js +74 -0
- package/dist/src/reasoning-effort.js +27 -0
- package/dist/src/session-store.js +2 -10
- package/dist/src/ui/repl.js +20 -23
- package/dist/src/ui/slash-commands.js +1 -1
- package/dist/src/ui/tui/build-frame.js +85 -34
- package/dist/src/ui/tui/model-label.js +13 -0
- package/dist/src/ui/tui/shell-input.js +19 -0
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -55,6 +55,23 @@ CLI login tokens use a rolling 48-hour inactivity timeout. If one expires during
|
|
|
55
55
|
any server request, the CLI removes the expired credential and signs you in
|
|
56
56
|
again on the next run.
|
|
57
57
|
|
|
58
|
+
## Models and reasoning effort
|
|
59
|
+
|
|
60
|
+
Type `/model` to choose a model with **↑ / ↓** and adjust its reasoning effort
|
|
61
|
+
with **← / →** in the same panel: **Default / Low / Balanced / Deep**.
|
|
62
|
+
**Enter** saves the selected model's choice for this project; **Esc** cancels.
|
|
63
|
+
Each model remembers its own choice across new and resumed sessions.
|
|
64
|
+
The picker and footer show the effort beside the model name. The footer labels
|
|
65
|
+
agent mode separately as `Mode: ...`; narrow terminals place it on the next
|
|
66
|
+
line, keeping both settings visible while idle and working.
|
|
67
|
+
|
|
68
|
+
Default uses TheGitAI's current recommended setting for the model. Low favors
|
|
69
|
+
quicker responses, Balanced balances depth and speed, and Deep favors thorough
|
|
70
|
+
reasoning and may take longer and cost more. Choosing Default again clears your
|
|
71
|
+
override. Switching models preserves your conversation.
|
|
72
|
+
An invalid project preference file loads Default effort; saving refuses to
|
|
73
|
+
overwrite it until the file is repaired or removed.
|
|
74
|
+
|
|
58
75
|
## When the connection drops
|
|
59
76
|
|
|
60
77
|
A dropped connection does not end your turn. The CLI shows
|
package/dist/src/api/chat.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { readProjectModelEfforts, projectModelEffort } from '../project-model-preferences.js';
|
|
1
2
|
import { randomUUID } from 'node:crypto';
|
|
2
3
|
import { drainBackgroundJobNotifications } from '../background-jobs.js';
|
|
3
4
|
import { cancelActiveCommand } from '../executor.js';
|
|
@@ -746,6 +747,7 @@ export async function sendServerUserMessage({ config, session, input, jobFollowU
|
|
|
746
747
|
const request = {
|
|
747
748
|
clientTurnId: randomUUID(),
|
|
748
749
|
modelId: session.modelId,
|
|
750
|
+
reasoningEffort: projectModelEffort(readProjectModelEfforts(session.rootDir, config.serverUrl, session.env), session.modelId),
|
|
749
751
|
session: snapshotForServer(session),
|
|
750
752
|
input: requestInputBase,
|
|
751
753
|
backgroundJobUpdate: backgroundJobUpdate || undefined,
|
|
@@ -403,6 +403,10 @@ export function drainBackgroundJobNotifications({ sessionId } = {}) {
|
|
|
403
403
|
const hasReadableFinalOutput = pending.some((snapshot) => snapshot.status !== 'killed');
|
|
404
404
|
return `${lines.join(' ')}${hasReadableFinalOutput ? ' Use shell_job_output to read any final output.' : ''}`;
|
|
405
405
|
}
|
|
406
|
+
export function hasUnreportedBackgroundJobUpdate(id, { sessionId } = {}) {
|
|
407
|
+
const filter = sessionFilter(sessionId);
|
|
408
|
+
return pendingModelNotifications.some((snapshot) => snapshot.id === id && (!filter || snapshot.sessionId === filter));
|
|
409
|
+
}
|
|
406
410
|
function unknownJobError(id) {
|
|
407
411
|
const known = listBackgroundJobs().map((job) => job.id);
|
|
408
412
|
const hint = known.length
|
package/dist/src/help-text.js
CHANGED
|
@@ -129,7 +129,7 @@ const HELP_MARKDOWN = [
|
|
|
129
129
|
'- `/report` — file a bug privately through the TheGitAI website in your',
|
|
130
130
|
' browser (sign in with your existing account)',
|
|
131
131
|
'- `/usage` — show account usage percentage and reset times',
|
|
132
|
-
'- `/model` —
|
|
132
|
+
'- `/model` — ↑/↓ picks a model, ←/→ adjusts effort; Enter saves for this project, Esc cancels',
|
|
133
133
|
'- `/model <id>` — switch the active model without clearing history',
|
|
134
134
|
'- `/resume` — resume a saved session for this repo',
|
|
135
135
|
'- `/jobs` — manage long-running commands like dev servers and watchers:',
|
|
@@ -1,11 +1,40 @@
|
|
|
1
|
-
import { getBackgroundJob } from './background-jobs.js';
|
|
1
|
+
import { getBackgroundJob, hasUnreportedBackgroundJobUpdate } from './background-jobs.js';
|
|
2
2
|
export const MAX_CHAINED_JOB_FOLLOW_UPS = 3;
|
|
3
|
+
function exitedOnItsOwn(id, sessionId) {
|
|
4
|
+
const job = getBackgroundJob(id, { sessionId });
|
|
5
|
+
return job !== null && job.status !== 'running' && job.status !== 'killed';
|
|
6
|
+
}
|
|
3
7
|
export function decideJobFollowUp(jobIds, chainedFollowUps, sessionId) {
|
|
4
|
-
|
|
5
|
-
const job = getBackgroundJob(id, { sessionId });
|
|
6
|
-
return job !== null && job.status !== 'running' && job.status !== 'killed';
|
|
7
|
-
});
|
|
8
|
-
if (!finished)
|
|
8
|
+
if (!jobIds.some((id) => exitedOnItsOwn(id, sessionId)))
|
|
9
9
|
return 'wait';
|
|
10
10
|
return chainedFollowUps >= MAX_CHAINED_JOB_FOLLOW_UPS ? 'stop' : 'start';
|
|
11
11
|
}
|
|
12
|
+
export function remainingJobWait(jobIds, sessionId) {
|
|
13
|
+
return jobIds.filter((id) => {
|
|
14
|
+
const job = getBackgroundJob(id, { sessionId });
|
|
15
|
+
if (job?.status === 'running')
|
|
16
|
+
return true;
|
|
17
|
+
return exitedOnItsOwn(id, sessionId) && hasUnreportedBackgroundJobUpdate(id, { sessionId });
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export function createJobWaitTracker(sessionId) {
|
|
21
|
+
let waiting = [];
|
|
22
|
+
let chained = 0;
|
|
23
|
+
return {
|
|
24
|
+
get waiting() {
|
|
25
|
+
return waiting;
|
|
26
|
+
},
|
|
27
|
+
turnStarted(jobFollowUp) {
|
|
28
|
+
chained = jobFollowUp ? chained + 1 : 0;
|
|
29
|
+
},
|
|
30
|
+
turnEnded(waitingForJobs) {
|
|
31
|
+
waiting = waitingForJobs ? [...waitingForJobs] : remainingJobWait(waiting, sessionId());
|
|
32
|
+
},
|
|
33
|
+
takeDecision() {
|
|
34
|
+
const decision = decideJobFollowUp(waiting, chained, sessionId());
|
|
35
|
+
if (decision !== 'wait')
|
|
36
|
+
waiting = [];
|
|
37
|
+
return decision;
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
export function getSessionProjectKey(rootDir) {
|
|
4
|
+
const resolvedRoot = path.resolve(rootDir);
|
|
5
|
+
const projectName = path.basename(resolvedRoot).replace(/[^a-zA-Z0-9._-]/g, '_') || 'project';
|
|
6
|
+
const hash = createHash('sha256')
|
|
7
|
+
.update(resolvedRoot)
|
|
8
|
+
.digest('hex')
|
|
9
|
+
.slice(0, 16);
|
|
10
|
+
return `${projectName}-${hash}`;
|
|
11
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { getClientStateDir } from './client-state.js';
|
|
5
|
+
import { getSessionProjectKey } from './project-key.js';
|
|
6
|
+
import { isReasoningEffort } from './reasoning-effort.js';
|
|
7
|
+
function preferencesPath(rootDir, env) {
|
|
8
|
+
return path.join(getClientStateDir(env), 'projects', getSessionProjectKey(rootDir), 'model-efforts.json');
|
|
9
|
+
}
|
|
10
|
+
function parseScopes(contents) {
|
|
11
|
+
const parsed = JSON.parse(contents);
|
|
12
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
13
|
+
throw new Error('Project model preferences must be an object.');
|
|
14
|
+
}
|
|
15
|
+
return Object.fromEntries(Object.entries(parsed).map(([scope, models]) => {
|
|
16
|
+
if (!models || typeof models !== 'object' || Array.isArray(models)) {
|
|
17
|
+
throw new Error('Project model preferences contain an invalid model selection.');
|
|
18
|
+
}
|
|
19
|
+
const entries = Object.entries(models).map(([id, effort]) => {
|
|
20
|
+
if (!/^[1-9]\d*$/.test(id) || !isReasoningEffort(effort)) {
|
|
21
|
+
throw new Error('Project model preferences contain an invalid effort selection.');
|
|
22
|
+
}
|
|
23
|
+
return [id, effort];
|
|
24
|
+
});
|
|
25
|
+
return [scope, Object.fromEntries(entries)];
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
function readScopes(rootDir, env, onInvalid) {
|
|
29
|
+
const file = preferencesPath(rootDir, env);
|
|
30
|
+
if (!existsSync(file))
|
|
31
|
+
return {};
|
|
32
|
+
const contents = readFileSync(file, 'utf8');
|
|
33
|
+
try {
|
|
34
|
+
return parseScopes(contents);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
if (onInvalid === 'throw')
|
|
38
|
+
throw error;
|
|
39
|
+
return {};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function scopeKey(scope) {
|
|
43
|
+
return scope.trim().replace(/\/+$/, '') || 'local';
|
|
44
|
+
}
|
|
45
|
+
export function readProjectModelEfforts(rootDir, scope = '', env = process.env) {
|
|
46
|
+
return readScopes(rootDir, env, 'default')[scopeKey(scope)] ?? {};
|
|
47
|
+
}
|
|
48
|
+
export function projectModelEffort(efforts, modelId) {
|
|
49
|
+
return efforts[String(modelId)] ?? 'default';
|
|
50
|
+
}
|
|
51
|
+
export function saveProjectModelEffort(rootDir, modelId, effort, scope = '', env = process.env) {
|
|
52
|
+
if (!Number.isInteger(modelId) || modelId <= 0 || !isReasoningEffort(effort)) {
|
|
53
|
+
throw new Error('Invalid project model preference.');
|
|
54
|
+
}
|
|
55
|
+
const scopes = readScopes(rootDir, env, 'throw');
|
|
56
|
+
const key = scopeKey(scope);
|
|
57
|
+
const models = { ...scopes[key] };
|
|
58
|
+
if (effort === 'default')
|
|
59
|
+
delete models[String(modelId)];
|
|
60
|
+
else
|
|
61
|
+
models[String(modelId)] = effort;
|
|
62
|
+
const file = preferencesPath(rootDir, env);
|
|
63
|
+
mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 });
|
|
64
|
+
const temp = `${file}.${randomUUID()}.tmp`;
|
|
65
|
+
try {
|
|
66
|
+
writeFileSync(temp, `${JSON.stringify({ ...scopes, [key]: models }, null, 2)}\n`, { mode: 0o600 });
|
|
67
|
+
renameSync(temp, file);
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
rmSync(temp, { force: true });
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
return models;
|
|
74
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const REASONING_EFFORTS = ['default', 'low', 'balanced', 'deep'];
|
|
2
|
+
export const REASONING_EFFORT_LABELS = {
|
|
3
|
+
default: 'Default',
|
|
4
|
+
low: 'Low',
|
|
5
|
+
balanced: 'Balanced',
|
|
6
|
+
deep: 'Deep',
|
|
7
|
+
};
|
|
8
|
+
export const REASONING_EFFORT_DESCRIPTIONS = {
|
|
9
|
+
default: 'Uses our recommended setting for this model.',
|
|
10
|
+
low: 'Favors quicker responses and lower reasoning cost.',
|
|
11
|
+
balanced: 'Balances reasoning depth, speed, and cost.',
|
|
12
|
+
deep: 'Favors thorough reasoning; may take longer and cost more.',
|
|
13
|
+
};
|
|
14
|
+
export function isReasoningEffort(value) {
|
|
15
|
+
return REASONING_EFFORTS.some((effort) => effort === value);
|
|
16
|
+
}
|
|
17
|
+
export function normalizeReasoningEffort(value) {
|
|
18
|
+
if (value === undefined)
|
|
19
|
+
return 'default';
|
|
20
|
+
if (isReasoningEffort(value))
|
|
21
|
+
return value;
|
|
22
|
+
throw new Error('Invalid reasoning effort. Choose Default, Low, Balanced, or Deep.');
|
|
23
|
+
}
|
|
24
|
+
export function cycleReasoningEffort(effort, direction) {
|
|
25
|
+
const index = REASONING_EFFORTS.indexOf(effort);
|
|
26
|
+
return REASONING_EFFORTS[(index + direction + REASONING_EFFORTS.length) % REASONING_EFFORTS.length];
|
|
27
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { spawnSync } from 'node:child_process';
|
|
2
|
-
import { createHash } from 'node:crypto';
|
|
3
2
|
import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync, } from 'node:fs';
|
|
4
3
|
import path from 'node:path';
|
|
5
4
|
import { getClientStateDir } from './client-state.js';
|
|
5
|
+
import { getSessionProjectKey } from './project-key.js';
|
|
6
6
|
import { findStoredImageByContent, pruneSessionImages, readSessionImage, sweepOrphanSessionImages, } from './core/session-image-store.js';
|
|
7
7
|
import { sweepGeneratedImages } from './tools/save-generated-image.js';
|
|
8
8
|
import { normalizeAssistantEditJournal } from './edit-journal.js';
|
|
@@ -11,6 +11,7 @@ import { cloneSessionSafetyState, createSessionSafetyState, mergeLocalSessionSaf
|
|
|
11
11
|
import { singleLinePreview } from './utils.js';
|
|
12
12
|
const SESSION_STORE_VERSION = 1;
|
|
13
13
|
export const MAX_RECENT_SESSIONS = 10;
|
|
14
|
+
export { getSessionProjectKey };
|
|
14
15
|
function cloneJson(value) {
|
|
15
16
|
return JSON.parse(JSON.stringify(value ?? null));
|
|
16
17
|
}
|
|
@@ -58,15 +59,6 @@ function safeSessionFileName(id) {
|
|
|
58
59
|
function getSessionBaseDir(env = process.env) {
|
|
59
60
|
return getClientStateDir(env);
|
|
60
61
|
}
|
|
61
|
-
export function getSessionProjectKey(rootDir) {
|
|
62
|
-
const resolvedRoot = path.resolve(rootDir);
|
|
63
|
-
const projectName = path.basename(resolvedRoot).replace(/[^a-zA-Z0-9._-]/g, '_') || 'project';
|
|
64
|
-
const hash = createHash('sha256')
|
|
65
|
-
.update(resolvedRoot)
|
|
66
|
-
.digest('hex')
|
|
67
|
-
.slice(0, 16);
|
|
68
|
-
return `${projectName}-${hash}`;
|
|
69
|
-
}
|
|
70
62
|
function getSessionProjectDir(rootDir, env = process.env) {
|
|
71
63
|
return path.join(getSessionBaseDir(env), 'sessions', 'projects', getSessionProjectKey(rootDir));
|
|
72
64
|
}
|
package/dist/src/ui/repl.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { projectModelEffort, readProjectModelEfforts, saveProjectModelEffort } from '../project-model-preferences.js';
|
|
2
|
+
import { REASONING_EFFORT_LABELS } from '../reasoning-effort.js';
|
|
1
3
|
import { basename } from 'node:path';
|
|
2
4
|
import { createRatatuiBridge } from './tui/bridge.js';
|
|
3
5
|
import { bucketActionLabel, } from '../permissions.js';
|
|
@@ -14,7 +16,7 @@ import { agentModeLabel, nextAgentMode, } from '../agent-mode.js';
|
|
|
14
16
|
import { chat, models } from '../api/index.js';
|
|
15
17
|
import { isTurnCancelledError, isTurnOutcomeKnown } from '../api/chat.js';
|
|
16
18
|
import { formatTurnRecoveryStatus } from '../api/turn-recovery.js';
|
|
17
|
-
import {
|
|
19
|
+
import { createJobWaitTracker } from '../job-follow-up.js';
|
|
18
20
|
import { getJobBufferedOutput, getJobOutputPreview, hasRunningBackgroundJobs, killAllBackgroundJobs, killBackgroundJob, listBackgroundJobs, setBackgroundJobSession, setBackgroundJobUpdateHook, } from '../background-jobs.js';
|
|
19
21
|
import { clearTodos, listTodos, setTodoSession } from '../todo-list.js';
|
|
20
22
|
import { setScratchSession } from '../scratch-dir.js';
|
|
@@ -1039,7 +1041,7 @@ function shallowArrayEqual(a, b) {
|
|
|
1039
1041
|
}
|
|
1040
1042
|
return true;
|
|
1041
1043
|
}
|
|
1042
|
-
function createInitialShellState(session, serverModels, debugUi) {
|
|
1044
|
+
function createInitialShellState(session, serverModels, debugUi, serverUrl) {
|
|
1043
1045
|
return {
|
|
1044
1046
|
activeTurnInput: '',
|
|
1045
1047
|
activeTurnInputPreformatted: false,
|
|
@@ -1059,6 +1061,7 @@ function createInitialShellState(session, serverModels, debugUi) {
|
|
|
1059
1061
|
commandLog: [],
|
|
1060
1062
|
contextStatus: 'Idle',
|
|
1061
1063
|
currentModelId: session.modelId,
|
|
1064
|
+
reasoningEffort: projectModelEffort(readProjectModelEfforts(session.rootDir, serverUrl, session.env), session.modelId),
|
|
1062
1065
|
cursor: 0,
|
|
1063
1066
|
exiting: false,
|
|
1064
1067
|
input: '',
|
|
@@ -1407,7 +1410,7 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
|
|
|
1407
1410
|
setScratchSession(session.sessionId);
|
|
1408
1411
|
setImageStoreSession(session.sessionId);
|
|
1409
1412
|
setTodoSession(session.sessionId);
|
|
1410
|
-
const store = createShellStore(createInitialShellState(session, serverModels, debugUi));
|
|
1413
|
+
const store = createShellStore(createInitialShellState(session, serverModels, debugUi, authConfig.serverUrl));
|
|
1411
1414
|
store.replaceTranscript(createSessionTranscript(session));
|
|
1412
1415
|
let currentServerModels = serverModels;
|
|
1413
1416
|
let sessionAutoYes = session.autoYes;
|
|
@@ -1772,6 +1775,7 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
|
|
|
1772
1775
|
autoYes: sessionAutoYes,
|
|
1773
1776
|
commandCursor: 0,
|
|
1774
1777
|
currentModelId: session.modelId,
|
|
1778
|
+
reasoningEffort: projectModelEffort(readProjectModelEfforts(session.rootDir, authConfig.serverUrl, session.env), session.modelId),
|
|
1775
1779
|
sessionId: session.sessionId,
|
|
1776
1780
|
modelPickerIndex: current.modelPickerOpen
|
|
1777
1781
|
? getDefaultModelPickerIndex(session.modelId, current.serverModels)
|
|
@@ -2073,15 +2077,19 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
|
|
|
2073
2077
|
input: '',
|
|
2074
2078
|
modelPickerIndex: getDefaultModelPickerIndex(current.currentModelId, fresh.models),
|
|
2075
2079
|
modelPickerOpen: true,
|
|
2080
|
+
modelPickerEfforts: readProjectModelEfforts(session.rootDir, authConfig.serverUrl, session.env),
|
|
2076
2081
|
status: 'Select a model',
|
|
2077
2082
|
}));
|
|
2078
2083
|
};
|
|
2079
|
-
const switchToModel = async (modelId) => {
|
|
2084
|
+
const switchToModel = async (modelId, effort) => {
|
|
2080
2085
|
const requested = Number(modelId);
|
|
2081
2086
|
const fresh = currentServerModels.models.some((model) => model.id === requested)
|
|
2082
2087
|
? currentServerModels
|
|
2083
2088
|
: await refreshServerModels();
|
|
2084
2089
|
const selected = models.validateServerModel(modelId, fresh);
|
|
2090
|
+
if (effort !== undefined) {
|
|
2091
|
+
saveProjectModelEffort(session.rootDir, selected, effort, authConfig.serverUrl, session.env);
|
|
2092
|
+
}
|
|
2085
2093
|
session.modelId = selected;
|
|
2086
2094
|
models.updateSelectedModelCache({
|
|
2087
2095
|
config: authConfig,
|
|
@@ -2092,7 +2100,7 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
|
|
|
2092
2100
|
return;
|
|
2093
2101
|
syncShellStateFromSession();
|
|
2094
2102
|
appendStaticEntry({
|
|
2095
|
-
body:
|
|
2103
|
+
body: `${formatModelLabel(selected, fresh.models)} · ${REASONING_EFFORT_LABELS[store.getState().reasoningEffort]} effort${effort === undefined ? '' : '\nSaved for this model in this project.'}`,
|
|
2096
2104
|
kind: 'system',
|
|
2097
2105
|
title: 'Model',
|
|
2098
2106
|
});
|
|
@@ -2226,16 +2234,8 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
|
|
|
2226
2234
|
});
|
|
2227
2235
|
return;
|
|
2228
2236
|
}
|
|
2229
|
-
if (selected.id === current.currentModelId) {
|
|
2230
|
-
appendStaticEntry({
|
|
2231
|
-
body: `Already using ${formatModelLabel(selected.id, current.serverModels)}.`,
|
|
2232
|
-
kind: 'system',
|
|
2233
|
-
title: 'Model',
|
|
2234
|
-
});
|
|
2235
|
-
return;
|
|
2236
|
-
}
|
|
2237
2237
|
try {
|
|
2238
|
-
await switchToModel(selected.id);
|
|
2238
|
+
await switchToModel(selected.id, projectModelEffort(current.modelPickerEfforts ?? {}, selected.id));
|
|
2239
2239
|
}
|
|
2240
2240
|
catch (error) {
|
|
2241
2241
|
if (exitForAuthenticationError(error))
|
|
@@ -2492,8 +2492,7 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
|
|
|
2492
2492
|
rollback('turn ended — sending as the next prompt');
|
|
2493
2493
|
}
|
|
2494
2494
|
};
|
|
2495
|
-
|
|
2496
|
-
let chainedJobFollowUps = 0;
|
|
2495
|
+
const jobWait = createJobWaitTracker(() => session.sessionId);
|
|
2497
2496
|
const handleSubmit = async (rawInput, { jobFollowUp = false } = {}) => {
|
|
2498
2497
|
const chunks = jobFollowUp ? [] : store.getState().pastedChunks;
|
|
2499
2498
|
const expanded = chunks.length
|
|
@@ -2795,8 +2794,7 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
|
|
|
2795
2794
|
await flushQueuedMessage();
|
|
2796
2795
|
return;
|
|
2797
2796
|
}
|
|
2798
|
-
|
|
2799
|
-
chainedJobFollowUps = jobFollowUp ? chainedJobFollowUps + 1 : 0;
|
|
2797
|
+
jobWait.turnStarted(jobFollowUp);
|
|
2800
2798
|
latestUsageSummary = null;
|
|
2801
2799
|
disarmExitConfirm();
|
|
2802
2800
|
unacknowledged = new Map();
|
|
@@ -2917,7 +2915,7 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
|
|
|
2917
2915
|
status: result.waitingForApproval ? 'Awaiting approval' : 'Ready',
|
|
2918
2916
|
tokenUsage: formatClientTokenUsage(Date.now() - turnStartedAt, latestUsageSummary),
|
|
2919
2917
|
}));
|
|
2920
|
-
|
|
2918
|
+
jobWait.turnEnded(result.waitingForJobs);
|
|
2921
2919
|
recoverUnacknowledgedMessages();
|
|
2922
2920
|
await flushQueuedMessage();
|
|
2923
2921
|
}
|
|
@@ -3110,16 +3108,15 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
|
|
|
3110
3108
|
}));
|
|
3111
3109
|
};
|
|
3112
3110
|
const scheduleJobFollowUp = () => {
|
|
3113
|
-
if (
|
|
3111
|
+
if (jobWait.waiting.length === 0)
|
|
3114
3112
|
return;
|
|
3115
3113
|
setTimeout(async () => {
|
|
3116
3114
|
const state = store.getState();
|
|
3117
3115
|
if (exiting || state.busy || state.modelPickerOpen || state.resumePickerOpen)
|
|
3118
3116
|
return;
|
|
3119
|
-
const decision =
|
|
3117
|
+
const decision = jobWait.takeDecision();
|
|
3120
3118
|
if (decision === 'wait')
|
|
3121
3119
|
return;
|
|
3122
|
-
waitingJobIds = [];
|
|
3123
3120
|
if (decision === 'stop') {
|
|
3124
3121
|
appendStaticEntry({
|
|
3125
3122
|
body: 'A background job finished. Send a message to continue.',
|
|
@@ -3212,7 +3209,7 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
|
|
|
3212
3209
|
};
|
|
3213
3210
|
const unsubscribe = store.subscribe(() => {
|
|
3214
3211
|
renderCurrentFrame();
|
|
3215
|
-
if (
|
|
3212
|
+
if (jobWait.waiting.length > 0 && !store.getState().busy)
|
|
3216
3213
|
scheduleJobFollowUp();
|
|
3217
3214
|
});
|
|
3218
3215
|
const spinnerTimer = setInterval(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const SLASH_COMMANDS = [
|
|
2
|
-
{ command: '/model', description: '
|
|
2
|
+
{ command: '/model', description: 'Choose a model and project reasoning effort' },
|
|
3
3
|
{ command: '/help', description: 'Show available chat commands' },
|
|
4
4
|
{ command: '/usage', description: 'Show account usage percentage and reset times' },
|
|
5
5
|
{
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { fitModelLabel } from './model-label.js';
|
|
2
|
+
import { projectModelEffort } from '../../project-model-preferences.js';
|
|
3
|
+
import { REASONING_EFFORTS, REASONING_EFFORT_LABELS, REASONING_EFFORT_DESCRIPTIONS } from '../../reasoning-effort.js';
|
|
1
4
|
import { agentModeColor, agentModeLabelTiers, agentModeShortLabel, } from '../../agent-mode.js';
|
|
2
5
|
import { singleLinePreview, truncate } from '../../utils.js';
|
|
3
6
|
import { formatClientTokenUsage } from '../repl.js';
|
|
@@ -523,7 +526,7 @@ function composerFooterLines(state, contentWidth) {
|
|
|
523
526
|
return lines;
|
|
524
527
|
}
|
|
525
528
|
const tokenUsageText = state.tokenUsage || formatClientTokenUsage(null);
|
|
526
|
-
lines.push(
|
|
529
|
+
lines.push(...composerFooterModeLines(state, contentWidth, formatModelLabel(state.currentModelId, state.serverModels), tokenUsageText
|
|
527
530
|
? displayWidth(tokenUsageText) + FOOTER_USAGE_SEPARATOR.length
|
|
528
531
|
: 0, tokenUsageText
|
|
529
532
|
? [
|
|
@@ -533,22 +536,48 @@ function composerFooterLines(state, contentWidth) {
|
|
|
533
536
|
: []));
|
|
534
537
|
return lines;
|
|
535
538
|
}
|
|
536
|
-
function
|
|
537
|
-
const
|
|
539
|
+
function composerFooterModeLines(state, contentWidth, modelLabel, usageWidth, usageSpans) {
|
|
540
|
+
const effort = REASONING_EFFORT_LABELS[state.reasoningEffort ?? 'default'];
|
|
541
|
+
const effortText = ` · ${effort} effort`;
|
|
542
|
+
const modeLabels = agentModeLabelTiers(state.agentMode).map((label) => `Mode: ${label}`);
|
|
543
|
+
const modeWidth = displayWidth(modeLabels[0]);
|
|
544
|
+
const separateUsage = usageWidth > 0 && modeWidth + usageWidth > contentWidth;
|
|
545
|
+
const tailWidth = separateUsage ? 0 : usageWidth;
|
|
546
|
+
const canCancel = state.busy && !state.queuedMessage && !state.userInputPrompt;
|
|
547
|
+
const feedbackHints = [canCancel ? FOOTER_CANCEL_HINT : '', footerNotificationHint(state.transientStatus)].filter(Boolean);
|
|
548
|
+
const feedback = feedbackHints.join(' · ');
|
|
549
|
+
const feedbackWidth = feedback ? displayWidth(feedback) + FOOTER_HINT_MIN_GAP : 0;
|
|
550
|
+
const combined = displayWidth(modelLabel + effortText) + FOOTER_MODEL_SEPARATOR.length + modeWidth + tailWidth + feedbackWidth <= contentWidth;
|
|
551
|
+
const modelText = combined ? modelLabel : fitModelLabel(modelLabel, contentWidth - displayWidth(effortText));
|
|
552
|
+
const modelSpans = [
|
|
553
|
+
span(modelText, { color: 'cyan' }),
|
|
554
|
+
span(effortText, { bold: true }),
|
|
555
|
+
];
|
|
538
556
|
const row = fitComposerFooterRow({
|
|
539
|
-
modeLabels
|
|
540
|
-
modeLabelFallback: agentModeShortLabel(state.agentMode)
|
|
557
|
+
modeLabels,
|
|
558
|
+
modeLabelFallback: `Mode: ${agentModeShortLabel(state.agentMode)}`,
|
|
541
559
|
cycleHint: state.busy ? '' : FOOTER_CYCLE_HINT,
|
|
542
560
|
rightHints: composerFooterRightHints(state),
|
|
543
|
-
leadWidth: displayWidth(
|
|
544
|
-
tailWidth
|
|
561
|
+
leadWidth: combined ? displayWidth(modelLabel + effortText) + FOOTER_MODEL_SEPARATOR.length : 0,
|
|
562
|
+
tailWidth,
|
|
545
563
|
contentWidth,
|
|
546
564
|
});
|
|
565
|
+
const remainingHints = feedbackHints.filter((hint) => !row.rightHint.includes(hint));
|
|
566
|
+
const remainingFeedback = remainingHints.join(' · ');
|
|
567
|
+
const feedbackLines = !remainingFeedback ? []
|
|
568
|
+
: displayWidth(remainingFeedback) <= contentWidth ? [remainingFeedback]
|
|
569
|
+
: remainingHints.flatMap((hint) => wrapText(hint, contentWidth));
|
|
547
570
|
const footerMuted = mutedStyle();
|
|
548
|
-
|
|
571
|
+
const modeLine = line(...(combined ? [...modelSpans, span(FOOTER_MODEL_SEPARATOR, footerMuted)] : []), span(row.modeLabel, {
|
|
549
572
|
color: agentModeColor(state.agentMode),
|
|
550
573
|
bold: state.agentMode === 'auto-accept',
|
|
551
|
-
}), ...(row.cycleHint ? [span(row.cycleHint, footerMuted)] : []), ...(row.gap ? [span(' '.repeat(row.gap), footerMuted)] : []), ...(row.rightHint ? [span(row.rightHint, footerMuted)] : []), ...usageSpans);
|
|
574
|
+
}), ...(row.cycleHint ? [span(row.cycleHint, footerMuted)] : []), ...(row.gap ? [span(' '.repeat(row.gap), footerMuted)] : []), ...(row.rightHint ? [span(row.rightHint, footerMuted)] : []), ...(separateUsage ? [] : usageSpans));
|
|
575
|
+
return [
|
|
576
|
+
...(combined ? [] : [line(...modelSpans)]),
|
|
577
|
+
modeLine,
|
|
578
|
+
...feedbackLines.map((text) => plainLine(text, footerMuted)),
|
|
579
|
+
...(separateUsage ? wrapText(usageSpans.slice(1).map((part) => part.text).join(''), contentWidth).map((text) => plainLine(text, { color: 'cyan' })) : []),
|
|
580
|
+
];
|
|
552
581
|
}
|
|
553
582
|
const FOOTER_USAGE_SEPARATOR = ' ';
|
|
554
583
|
const FOOTER_MODEL_SEPARATOR = ' ';
|
|
@@ -807,7 +836,7 @@ function buildOverlayPanel(rows, width, color, height = Number.POSITIVE_INFINITY
|
|
|
807
836
|
];
|
|
808
837
|
}
|
|
809
838
|
function padSpansToInnerWidth(spans, innerWidth, fill) {
|
|
810
|
-
const used = spans.reduce((total, part) => total +
|
|
839
|
+
const used = spans.reduce((total, part) => total + displayWidth(part.text), 0);
|
|
811
840
|
const pad = Math.max(0, innerWidth - used);
|
|
812
841
|
if (pad === 0)
|
|
813
842
|
return spans;
|
|
@@ -817,7 +846,8 @@ function modelPickerPanelSideLine(content, innerWidth) {
|
|
|
817
846
|
return overlayPanelLine(content, innerWidth, MODEL_PICKER_BORDER_COLOR);
|
|
818
847
|
}
|
|
819
848
|
const MODEL_PICKER_COST_WIDTH = 6;
|
|
820
|
-
const
|
|
849
|
+
const MODEL_PICKER_MODEL_MIN_WIDTH = 42;
|
|
850
|
+
const MODEL_PICKER_MODEL_MAX_WIDTH = 54;
|
|
821
851
|
const MODEL_PICKER_SEPARATOR = ' │ ';
|
|
822
852
|
const MODEL_PICKER_WIDE_MIN_WIDTH = 78;
|
|
823
853
|
function modelPickerTopBorder(panelWidth) {
|
|
@@ -842,24 +872,29 @@ function modelPickerCostText(rating) {
|
|
|
842
872
|
const steps = Math.max(1, Math.min(3, Math.round(rating)));
|
|
843
873
|
return '$'.repeat(steps);
|
|
844
874
|
}
|
|
875
|
+
function modelPickerModelWidth(innerWidth) {
|
|
876
|
+
return Math.min(MODEL_PICKER_MODEL_MAX_WIDTH, Math.max(MODEL_PICKER_MODEL_MIN_WIDTH, innerWidth - MODEL_PICKER_COST_WIDTH - MODEL_PICKER_SEPARATOR.length * 2 - 18));
|
|
877
|
+
}
|
|
845
878
|
function modelPickerNotesWidth(innerWidth) {
|
|
846
879
|
return Math.max(18, innerWidth -
|
|
847
|
-
|
|
880
|
+
modelPickerModelWidth(innerWidth) -
|
|
848
881
|
MODEL_PICKER_COST_WIDTH -
|
|
849
882
|
MODEL_PICKER_SEPARATOR.length * 2);
|
|
850
883
|
}
|
|
851
|
-
function modelPickerModelSpans(option, selected, width, showCurrentTag, labelStyle, selectedStyle) {
|
|
884
|
+
function modelPickerModelSpans(option, selected, effort, width, showCurrentTag, labelStyle, selectedStyle) {
|
|
852
885
|
const tag = option.current && showCurrentTag ? ' (current)' : '';
|
|
853
|
-
const
|
|
854
|
-
const
|
|
855
|
-
const
|
|
886
|
+
const effortText = ` · ${REASONING_EFFORT_LABELS[effort]}`;
|
|
887
|
+
const nameWidth = Math.max(1, width - displayWidth(tag + effortText) - 2);
|
|
888
|
+
const label = `${selected ? '▶ ' : ' '}${fitModelLabel(option.label, nameWidth)}`;
|
|
889
|
+
const used = displayWidth(label + effortText + tag);
|
|
856
890
|
return [
|
|
857
891
|
span(label, { ...labelStyle, ...selectedStyle }),
|
|
892
|
+
span(effortText, { color: mutedColor(), bold: selected, ...selectedStyle }),
|
|
858
893
|
span(tag, { color: 'gray', ...selectedStyle }),
|
|
859
894
|
span(' '.repeat(Math.max(0, width - used)), selectedStyle),
|
|
860
895
|
];
|
|
861
896
|
}
|
|
862
|
-
function modelPickerItemLines(option, selected, innerWidth) {
|
|
897
|
+
function modelPickerItemLines(option, selected, effort, innerWidth) {
|
|
863
898
|
const selectedStyle = selected ? { bgColor: MODEL_PICKER_HIGHLIGHT_BG } : {};
|
|
864
899
|
const labelStyle = option.disabled
|
|
865
900
|
? { color: 'gray' }
|
|
@@ -868,18 +903,19 @@ function modelPickerItemLines(option, selected, innerWidth) {
|
|
|
868
903
|
: {};
|
|
869
904
|
const cost = modelPickerCostText(option.costRating);
|
|
870
905
|
if (innerWidth < MODEL_PICKER_WIDE_MIN_WIDTH) {
|
|
871
|
-
const
|
|
906
|
+
const costWidth = 3;
|
|
907
|
+
const modelWidth = Math.max(12, innerWidth - costWidth - 2);
|
|
872
908
|
const row = [
|
|
873
|
-
...modelPickerModelSpans(option, selected, modelWidth, false, labelStyle, selectedStyle),
|
|
909
|
+
...modelPickerModelSpans(option, selected, effort, modelWidth, false, labelStyle, selectedStyle),
|
|
874
910
|
span(' ', selectedStyle),
|
|
875
|
-
modelPickerCell(cost,
|
|
911
|
+
modelPickerCell(cost, costWidth, selectedStyle),
|
|
876
912
|
];
|
|
877
913
|
return [
|
|
878
914
|
modelPickerPanelSideLine(line(...padSpansToInnerWidth(row, innerWidth, selectedStyle)), innerWidth),
|
|
879
915
|
];
|
|
880
916
|
}
|
|
881
917
|
const row = [
|
|
882
|
-
...modelPickerModelSpans(option, selected,
|
|
918
|
+
...modelPickerModelSpans(option, selected, effort, modelPickerModelWidth(innerWidth), true, labelStyle, selectedStyle),
|
|
883
919
|
span(MODEL_PICKER_SEPARATOR, { color: 'gray', ...selectedStyle }),
|
|
884
920
|
modelPickerCell(cost, MODEL_PICKER_COST_WIDTH, selectedStyle),
|
|
885
921
|
span(MODEL_PICKER_SEPARATOR, { color: 'gray', ...selectedStyle }),
|
|
@@ -895,15 +931,20 @@ function modelPickerItemLines(option, selected, innerWidth) {
|
|
|
895
931
|
function modelPickerHeaderLine(innerWidth) {
|
|
896
932
|
const heading = { color: MODEL_PICKER_ACCENT_COLOR, bold: true };
|
|
897
933
|
if (innerWidth < MODEL_PICKER_WIDE_MIN_WIDTH) {
|
|
898
|
-
return line(modelPickerCell('Model', Math.max(1, innerWidth), heading));
|
|
934
|
+
return line(modelPickerCell('Model · effort', Math.max(1, innerWidth), heading));
|
|
899
935
|
}
|
|
900
|
-
return line(modelPickerCell('Model',
|
|
936
|
+
return line(modelPickerCell('Model · effort', modelPickerModelWidth(innerWidth), heading), span(MODEL_PICKER_SEPARATOR, { color: 'gray' }), modelPickerCell('Cost', MODEL_PICKER_COST_WIDTH, heading), span(MODEL_PICKER_SEPARATOR, { color: 'gray' }), modelPickerCell('Notes', modelPickerNotesWidth(innerWidth), heading));
|
|
901
937
|
}
|
|
902
|
-
function buildModelPickerPanel(options, selectedIndex, width, availableHeight) {
|
|
938
|
+
function buildModelPickerPanel(options, selectedIndex, width, availableHeight, efforts = {}) {
|
|
903
939
|
const panelWidth = Math.max(28, Math.min(width, MODEL_PICKER_PANEL_MAX_WIDTH));
|
|
904
940
|
const innerWidth = Math.max(1, panelWidth - 4);
|
|
905
|
-
const
|
|
906
|
-
const
|
|
941
|
+
const showEffortDetails = options.length + 10 <= availableHeight;
|
|
942
|
+
const fixedLineCount = showEffortDetails ? 10 : 7;
|
|
943
|
+
const visibleCount = Math.min(options.length, Math.max(1, availableHeight - fixedLineCount));
|
|
944
|
+
const firstVisible = Math.max(0, Math.min(selectedIndex - visibleCount + 1, options.length - visibleCount));
|
|
945
|
+
const visibleOptions = options.slice(firstVisible, firstVisible + visibleCount);
|
|
946
|
+
const compactBodyLineCount = visibleOptions.length + fixedLineCount;
|
|
947
|
+
const spacerLineCount = Math.max(0, visibleOptions.length - 1);
|
|
907
948
|
const useRowSpacing = compactBodyLineCount + spacerLineCount <= availableHeight;
|
|
908
949
|
const bodyLineCount = compactBodyLineCount + (useRowSpacing ? spacerLineCount : 0);
|
|
909
950
|
const marginLineCount = Math.max(0, Math.min(MODEL_PICKER_PANEL_MARGIN_LINES, Math.floor((availableHeight - bodyLineCount) / 2)));
|
|
@@ -913,16 +954,26 @@ function buildModelPickerPanel(options, selectedIndex, width, availableHeight) {
|
|
|
913
954
|
modelPickerPanelSideLine(modelPickerHeaderLine(innerWidth), innerWidth),
|
|
914
955
|
modelPickerDivider(panelWidth),
|
|
915
956
|
];
|
|
916
|
-
|
|
917
|
-
body.push(...modelPickerItemLines(option, index === selectedIndex, innerWidth));
|
|
918
|
-
if (useRowSpacing && index <
|
|
957
|
+
visibleOptions.forEach((option, index) => {
|
|
958
|
+
body.push(...modelPickerItemLines(option, firstVisible + index === selectedIndex, projectModelEffort(efforts, option.publicId), innerWidth));
|
|
959
|
+
if (useRowSpacing && index < visibleOptions.length - 1) {
|
|
919
960
|
body.push(modelPickerPanelSideLine(plainLine(''), innerWidth));
|
|
920
961
|
}
|
|
921
962
|
});
|
|
922
|
-
const
|
|
923
|
-
const
|
|
963
|
+
const selectedEffort = projectModelEffort(efforts, options[selectedIndex]?.publicId ?? 0);
|
|
964
|
+
const effortChoices = REASONING_EFFORTS.map((effort) => effort === selectedEffort ? `[${REASONING_EFFORT_LABELS[effort]}]` : REASONING_EFFORT_LABELS[effort]).join(' ');
|
|
965
|
+
const fullEffort = `Reasoning effort: ${effortChoices}`;
|
|
966
|
+
const effortText = [...fullEffort].length <= innerWidth
|
|
967
|
+
? fullEffort
|
|
968
|
+
: `Effort: ${REASONING_EFFORT_LABELS[selectedEffort]} ←/→`;
|
|
969
|
+
const fullHint = '↑/↓ model • ←/→ effort • Enter select/save • Esc cancel';
|
|
970
|
+
const compactHint = '↑↓ · ←→ · Enter · Esc';
|
|
924
971
|
const hint = [...fullHint].length <= innerWidth ? fullHint : compactHint;
|
|
925
|
-
body.push(modelPickerDivider(panelWidth), modelPickerPanelSideLine(plainLine(fitLine(
|
|
972
|
+
body.push(modelPickerDivider(panelWidth), modelPickerPanelSideLine(plainLine(fitLine(effortText, innerWidth), { color: 'cyan', bold: true }), innerWidth), ...(showEffortDetails ? [
|
|
973
|
+
modelPickerPanelSideLine(plainLine(''), innerWidth),
|
|
974
|
+
modelPickerPanelSideLine(plainLine(fitLine(REASONING_EFFORT_DESCRIPTIONS[selectedEffort], innerWidth), { color: 'gray' }), innerWidth),
|
|
975
|
+
modelPickerPanelSideLine(plainLine(''), innerWidth),
|
|
976
|
+
] : []), modelPickerPanelSideLine(plainLine(fitLine(hint, innerWidth), { color: 'gray' }), innerWidth), plainLine(`╰${'─'.repeat(panelWidth - 2)}╯`, { color: MODEL_PICKER_BORDER_COLOR }));
|
|
926
977
|
return [...margin, ...body, ...margin];
|
|
927
978
|
}
|
|
928
979
|
const SHORTCUTS_PANEL_MAX_WIDTH = 96;
|
|
@@ -1243,7 +1294,7 @@ function buildOverlayLines(state, width, height, nowMs) {
|
|
|
1243
1294
|
}
|
|
1244
1295
|
if (state.modelPickerOpen) {
|
|
1245
1296
|
const options = buildModelPickerOptions(state.currentModelId, state.serverModels);
|
|
1246
|
-
lines.push(...buildModelPickerPanel(options, state.modelPickerIndex, width, height));
|
|
1297
|
+
lines.push(...buildModelPickerPanel(options, state.modelPickerIndex, width, height, state.modelPickerEfforts));
|
|
1247
1298
|
}
|
|
1248
1299
|
if (state.jobsPickerOpen) {
|
|
1249
1300
|
lines.push(...buildJobsPickerLines(state, width, height, nowMs));
|
|
@@ -1390,7 +1441,7 @@ export function buildTuiFrame(state, cols, rows, spinnerFrame, elapsedSeconds, n
|
|
|
1390
1441
|
}
|
|
1391
1442
|
const overlayHeight = state.userInputPrompt
|
|
1392
1443
|
? Math.max(0, rows - countSectionLines(sections))
|
|
1393
|
-
: state.jobsPickerOpen || state.shortcutsOpen
|
|
1444
|
+
: state.jobsPickerOpen || state.shortcutsOpen || state.modelPickerOpen
|
|
1394
1445
|
? Math.max(Math.min(rows, JOBS_PICKER_MIN_ROWS), rows - countSectionLines(sections))
|
|
1395
1446
|
: rows;
|
|
1396
1447
|
const overlayLines = buildOverlayLines(state, contentWidth, overlayHeight, nowMs);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { displayWidth, sliceToWidth } from './text.js';
|
|
2
|
+
export function fitModelLabel(label, width) {
|
|
3
|
+
if (width <= 0)
|
|
4
|
+
return '';
|
|
5
|
+
if (displayWidth(label) <= width)
|
|
6
|
+
return label;
|
|
7
|
+
const name = label.replace(/\s+\([^()]+\)$/, '');
|
|
8
|
+
if (displayWidth(name) <= width)
|
|
9
|
+
return name;
|
|
10
|
+
if (width === 1)
|
|
11
|
+
return '…';
|
|
12
|
+
return `${sliceToWidth(name, width - 1)}…`;
|
|
13
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { projectModelEffort } from '../../project-model-preferences.js';
|
|
2
|
+
import { cycleReasoningEffort } from '../../reasoning-effort.js';
|
|
1
3
|
import { shortcutsPanelAvailable } from './shortcuts.js';
|
|
2
4
|
import { moveComposerCursorVertically } from './composer-layout.js';
|
|
3
5
|
import { readClipboardImage, readClipboardText } from '../../core/clipboard.js';
|
|
@@ -370,6 +372,23 @@ export function handleShellKeyEvent(store, handlers, event) {
|
|
|
370
372
|
});
|
|
371
373
|
return;
|
|
372
374
|
}
|
|
375
|
+
if (key.leftArrow || key.rightArrow) {
|
|
376
|
+
store.update((current) => {
|
|
377
|
+
const options = buildModelPickerOptions(Number(current.currentModelId ?? 0), current.serverModels ?? []);
|
|
378
|
+
const model = options[current.modelPickerIndex];
|
|
379
|
+
if (!model)
|
|
380
|
+
return current;
|
|
381
|
+
const efforts = current.modelPickerEfforts ?? {};
|
|
382
|
+
return {
|
|
383
|
+
...current,
|
|
384
|
+
modelPickerEfforts: {
|
|
385
|
+
...efforts,
|
|
386
|
+
[String(model.publicId)]: cycleReasoningEffort(projectModelEffort(efforts, model.publicId), key.leftArrow ? -1 : 1),
|
|
387
|
+
},
|
|
388
|
+
};
|
|
389
|
+
});
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
373
392
|
if (key.returnKey) {
|
|
374
393
|
void handlers.onSelectModel();
|
|
375
394
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thegitai/cli",
|
|
3
|
-
"version": "1.0.0-preview.
|
|
3
|
+
"version": "1.0.0-preview.54",
|
|
4
4
|
"description": "TheGitAI is an agentic AI coding tool for your terminal. It reads and searches your repository, writes and edits files, runs your tests, and verifies the change before handing it back.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentic-ai",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"@lydell/node-pty-linux-x64": "1.1.0",
|
|
46
46
|
"@lydell/node-pty-win32-arm64": "1.1.0",
|
|
47
47
|
"@lydell/node-pty-win32-x64": "1.1.0",
|
|
48
|
-
"@thegitai/tui-darwin-arm64": "1.0.0-preview.
|
|
49
|
-
"@thegitai/tui-darwin-x64": "1.0.0-preview.
|
|
50
|
-
"@thegitai/tui-linux-arm64": "1.0.0-preview.
|
|
51
|
-
"@thegitai/tui-linux-x64": "1.0.0-preview.
|
|
52
|
-
"@thegitai/tui-win32-x64": "1.0.0-preview.
|
|
48
|
+
"@thegitai/tui-darwin-arm64": "1.0.0-preview.54",
|
|
49
|
+
"@thegitai/tui-darwin-x64": "1.0.0-preview.54",
|
|
50
|
+
"@thegitai/tui-linux-arm64": "1.0.0-preview.54",
|
|
51
|
+
"@thegitai/tui-linux-x64": "1.0.0-preview.54",
|
|
52
|
+
"@thegitai/tui-win32-x64": "1.0.0-preview.54",
|
|
53
53
|
"@vscode/ripgrep": "1.18.0"
|
|
54
54
|
},
|
|
55
55
|
"repository": {
|