fixo-cli 1.0.4 → 2.0.0
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.
Potentially problematic release.
This version of fixo-cli might be problematic. Click here for more details.
- package/CHANGELOG.md +62 -0
- package/README.md +18 -14
- package/dist/agent/agent-client.d.ts +28 -6
- package/dist/agent/agent-client.d.ts.map +1 -1
- package/dist/agent/agent-client.js +118 -39
- package/dist/agent/agent-client.js.map +1 -1
- package/dist/agent/agent-pool.d.ts +55 -6
- package/dist/agent/agent-pool.d.ts.map +1 -1
- package/dist/agent/agent-pool.js +120 -20
- package/dist/agent/agent-pool.js.map +1 -1
- package/dist/agent/auto-verifier.d.ts +55 -0
- package/dist/agent/auto-verifier.d.ts.map +1 -0
- package/dist/agent/auto-verifier.js +50 -0
- package/dist/agent/auto-verifier.js.map +1 -0
- package/dist/agent/command-parser.d.ts.map +1 -1
- package/dist/agent/command-parser.js +176 -0
- package/dist/agent/command-parser.js.map +1 -1
- package/dist/agent/context-builder.d.ts +24 -0
- package/dist/agent/context-builder.d.ts.map +1 -0
- package/dist/agent/context-builder.js +197 -0
- package/dist/agent/context-builder.js.map +1 -0
- package/dist/agent/conversation.d.ts +14 -1
- package/dist/agent/conversation.d.ts.map +1 -1
- package/dist/agent/conversation.js +53 -7
- package/dist/agent/conversation.js.map +1 -1
- package/dist/agent/mcp-bridge.js +1 -1
- package/dist/agent/mcp-bridge.js.map +1 -1
- package/dist/agent/orchestrator.d.ts +45 -0
- package/dist/agent/orchestrator.d.ts.map +1 -1
- package/dist/agent/orchestrator.js +140 -3
- package/dist/agent/orchestrator.js.map +1 -1
- package/dist/agent/parser-adapter.d.ts +17 -0
- package/dist/agent/parser-adapter.d.ts.map +1 -1
- package/dist/agent/parser-adapter.js +254 -2
- package/dist/agent/parser-adapter.js.map +1 -1
- package/dist/agent/predictive-gate.d.ts.map +1 -1
- package/dist/agent/predictive-gate.js +4 -1
- package/dist/agent/predictive-gate.js.map +1 -1
- package/dist/agent/providers-manager.d.ts +5 -0
- package/dist/agent/providers-manager.d.ts.map +1 -1
- package/dist/agent/providers-manager.js +119 -8
- package/dist/agent/providers-manager.js.map +1 -1
- package/dist/agent/repo-map.d.ts +18 -1
- package/dist/agent/repo-map.d.ts.map +1 -1
- package/dist/agent/repo-map.js +144 -54
- package/dist/agent/repo-map.js.map +1 -1
- package/dist/agent/retry.js +1 -2
- package/dist/agent/retry.js.map +1 -1
- package/dist/agent/single-agent.d.ts.map +1 -1
- package/dist/agent/single-agent.js +129 -22
- package/dist/agent/single-agent.js.map +1 -1
- package/dist/agent/skills.d.ts.map +1 -1
- package/dist/agent/skills.js +2 -1
- package/dist/agent/skills.js.map +1 -1
- package/dist/agent/subagent.js +2 -2
- package/dist/agent/subagent.js.map +1 -1
- package/dist/agent/task-router.d.ts +46 -0
- package/dist/agent/task-router.d.ts.map +1 -0
- package/dist/agent/task-router.js +352 -0
- package/dist/agent/task-router.js.map +1 -0
- package/dist/agent/telemetry.d.ts +29 -1
- package/dist/agent/telemetry.d.ts.map +1 -1
- package/dist/agent/telemetry.js +25 -10
- package/dist/agent/telemetry.js.map +1 -1
- package/dist/agent/tool-definitions.d.ts +3 -0
- package/dist/agent/tool-definitions.d.ts.map +1 -0
- package/dist/agent/tool-definitions.js +519 -0
- package/dist/agent/tool-definitions.js.map +1 -0
- package/dist/agent/tool-executor.d.ts +6 -1
- package/dist/agent/tool-executor.d.ts.map +1 -1
- package/dist/agent/tool-executor.js +99 -553
- package/dist/agent/tool-executor.js.map +1 -1
- package/dist/agent/tools/command-tools.d.ts +6 -0
- package/dist/agent/tools/command-tools.d.ts.map +1 -0
- package/dist/agent/tools/command-tools.js +104 -0
- package/dist/agent/tools/command-tools.js.map +1 -0
- package/dist/agent/tools/file-tools.d.ts +15 -0
- package/dist/agent/tools/file-tools.d.ts.map +1 -0
- package/dist/agent/tools/file-tools.js +551 -0
- package/dist/agent/tools/file-tools.js.map +1 -0
- package/dist/agent/tools/todo-tools.d.ts +3 -0
- package/dist/agent/tools/todo-tools.d.ts.map +1 -0
- package/dist/agent/tools/todo-tools.js +70 -0
- package/dist/agent/tools/todo-tools.js.map +1 -0
- package/dist/agent/web-impl.d.ts.map +1 -1
- package/dist/agent/web-impl.js +45 -0
- package/dist/agent/web-impl.js.map +1 -1
- package/dist/agent/worker-agent.d.ts +3 -1
- package/dist/agent/worker-agent.d.ts.map +1 -1
- package/dist/agent/worker-agent.js +51 -14
- package/dist/agent/worker-agent.js.map +1 -1
- package/dist/config.d.ts +242 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +79 -0
- package/dist/config.js.map +1 -1
- package/dist/git/git-manager.d.ts +33 -2
- package/dist/git/git-manager.d.ts.map +1 -1
- package/dist/git/git-manager.js +111 -15
- package/dist/git/git-manager.js.map +1 -1
- package/dist/git/git-ops.d.ts.map +1 -1
- package/dist/git/git-ops.js +2 -1
- package/dist/git/git-ops.js.map +1 -1
- package/dist/index.js +85 -8
- package/dist/index.js.map +1 -1
- package/dist/lsp/lsp-manager.js +1 -1
- package/dist/lsp/lsp-manager.js.map +1 -1
- package/dist/model-outcomes.d.ts.map +1 -1
- package/dist/model-outcomes.js +2 -1
- package/dist/model-outcomes.js.map +1 -1
- package/dist/planner.d.ts +0 -9
- package/dist/planner.d.ts.map +1 -1
- package/dist/planner.js +0 -9
- package/dist/planner.js.map +1 -1
- package/dist/project-memory.d.ts +12 -1
- package/dist/project-memory.d.ts.map +1 -1
- package/dist/project-memory.js +8 -6
- package/dist/project-memory.js.map +1 -1
- package/dist/runtime/loop-mitigation.d.ts +78 -7
- package/dist/runtime/loop-mitigation.d.ts.map +1 -1
- package/dist/runtime/loop-mitigation.js +122 -9
- package/dist/runtime/loop-mitigation.js.map +1 -1
- package/dist/runtime/os-sandbox.d.ts +100 -0
- package/dist/runtime/os-sandbox.d.ts.map +1 -0
- package/dist/runtime/os-sandbox.js +246 -0
- package/dist/runtime/os-sandbox.js.map +1 -0
- package/dist/runtime/run-inventory.d.ts +17 -0
- package/dist/runtime/run-inventory.d.ts.map +1 -0
- package/dist/runtime/run-inventory.js +49 -0
- package/dist/runtime/run-inventory.js.map +1 -0
- package/dist/runtime/staging.d.ts.map +1 -1
- package/dist/runtime/staging.js +4 -1
- package/dist/runtime/staging.js.map +1 -1
- package/dist/runtime/task-session.d.ts +14 -0
- package/dist/runtime/task-session.d.ts.map +1 -1
- package/dist/runtime/task-session.js +26 -0
- package/dist/runtime/task-session.js.map +1 -1
- package/dist/setup-wizard.d.ts +11 -3
- package/dist/setup-wizard.d.ts.map +1 -1
- package/dist/setup-wizard.js +113 -15
- package/dist/setup-wizard.js.map +1 -1
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/commands/context-commands.d.ts +7 -0
- package/dist/ui/commands/context-commands.d.ts.map +1 -0
- package/dist/ui/commands/context-commands.js +241 -0
- package/dist/ui/commands/context-commands.js.map +1 -0
- package/dist/ui/commands/index.d.ts +3 -0
- package/dist/ui/commands/index.d.ts.map +1 -0
- package/dist/ui/commands/index.js +46 -0
- package/dist/ui/commands/index.js.map +1 -0
- package/dist/ui/commands/info-commands.d.ts +15 -0
- package/dist/ui/commands/info-commands.d.ts.map +1 -0
- package/dist/ui/commands/info-commands.js +122 -0
- package/dist/ui/commands/info-commands.js.map +1 -0
- package/dist/ui/commands/model-commands.d.ts +5 -0
- package/dist/ui/commands/model-commands.d.ts.map +1 -0
- package/dist/ui/commands/model-commands.js +417 -0
- package/dist/ui/commands/model-commands.js.map +1 -0
- package/dist/ui/commands/session-commands.d.ts +5 -0
- package/dist/ui/commands/session-commands.d.ts.map +1 -0
- package/dist/ui/commands/session-commands.js +154 -0
- package/dist/ui/commands/session-commands.js.map +1 -0
- package/dist/ui/commands/task-commands.d.ts +8 -0
- package/dist/ui/commands/task-commands.d.ts.map +1 -0
- package/dist/ui/commands/task-commands.js +152 -0
- package/dist/ui/commands/task-commands.js.map +1 -0
- package/dist/ui/commands/types.d.ts +46 -0
- package/dist/ui/commands/types.d.ts.map +1 -0
- package/dist/ui/commands/types.js +2 -0
- package/dist/ui/commands/types.js.map +1 -0
- package/dist/ui/commands/workspace-commands.d.ts +8 -0
- package/dist/ui/commands/workspace-commands.d.ts.map +1 -0
- package/dist/ui/commands/workspace-commands.js +131 -0
- package/dist/ui/commands/workspace-commands.js.map +1 -0
- package/dist/ui/loading-animation.d.ts +24 -0
- package/dist/ui/loading-animation.d.ts.map +1 -0
- package/dist/ui/loading-animation.js +123 -0
- package/dist/ui/loading-animation.js.map +1 -0
- package/dist/ui/markdown-stream.js +2 -2
- package/dist/ui/markdown-stream.js.map +1 -1
- package/dist/ui/prompt.d.ts +7 -0
- package/dist/ui/prompt.d.ts.map +1 -1
- package/dist/ui/prompt.js +435 -1214
- package/dist/ui/prompt.js.map +1 -1
- package/dist/ui/render-primitives.d.ts +6 -0
- package/dist/ui/render-primitives.d.ts.map +1 -1
- package/dist/ui/render-primitives.js +30 -13
- package/dist/ui/render-primitives.js.map +1 -1
- package/dist/ui/render.d.ts.map +1 -1
- package/dist/ui/render.js +2 -0
- package/dist/ui/render.js.map +1 -1
- package/package.json +17 -3
- package/scripts/check-vendor-wasm.js +11 -0
- package/vendor/tree-sitter-go.wasm +0 -0
- package/vendor/tree-sitter-javascript.wasm +0 -0
- package/vendor/tree-sitter-python.wasm +0 -0
- package/vendor/tree-sitter-rust.wasm +0 -0
- package/vendor/tree-sitter-tsx.wasm +0 -0
- package/vendor/tree-sitter-typescript.wasm +0 -0
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
import * as p from '@clack/prompts';
|
|
2
|
+
import { saveConfig } from '../../config.js';
|
|
3
|
+
import { ProvidersManager, PROVIDER_REGISTRY } from '../../agent/providers-manager.js';
|
|
4
|
+
import { C, colors } from '../colors.js';
|
|
5
|
+
function persistModelSelection(config, model, provider) {
|
|
6
|
+
config.lastSession = {
|
|
7
|
+
provider: provider ?? config.lastSession?.provider ?? config.directProvider?.name ?? 'auto',
|
|
8
|
+
model,
|
|
9
|
+
updatedAt: new Date().toISOString(),
|
|
10
|
+
};
|
|
11
|
+
config.defaultModel = model;
|
|
12
|
+
saveConfig(config);
|
|
13
|
+
}
|
|
14
|
+
export const modelCommand = async (ctx) => {
|
|
15
|
+
if (ctx.args[0] === 'list') {
|
|
16
|
+
// Print full model table grouped by provider
|
|
17
|
+
// Uses live-fetched cached models when available, otherwise falls
|
|
18
|
+
// back to the static registry list (tagged [unverified]).
|
|
19
|
+
console.log(`\n${colors.bold}${colors.cyan}Available Models by Provider${colors.reset}`);
|
|
20
|
+
console.log(`${colors.dim}${'─'.repeat(60)}${colors.reset}`);
|
|
21
|
+
for (const def of PROVIDER_REGISTRY) {
|
|
22
|
+
const hasKey = ProvidersManager.has(def.name);
|
|
23
|
+
const keyStatus = hasKey ? `${colors.green}[key ✓]${colors.reset}` : `${colors.dim}[no key]${colors.reset}`;
|
|
24
|
+
const cached = ProvidersManager.getCachedModels(def.name);
|
|
25
|
+
const modelList = cached?.models?.length ? cached.models : def.models;
|
|
26
|
+
const sourceTag = cached?.source === 'live'
|
|
27
|
+
? ''
|
|
28
|
+
: ` ${colors.dim}[unverified]${colors.reset}`;
|
|
29
|
+
console.log(`\n ${C.SNOW}${colors.bold}${def.displayName}${colors.reset} ${keyStatus}${sourceTag}`);
|
|
30
|
+
for (const model of modelList) {
|
|
31
|
+
console.log(` ${colors.cyan}•${colors.reset} ${model}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
console.log(`\n${colors.dim} Use /providers add <name> to connect a provider with your API key.${colors.reset}`);
|
|
35
|
+
console.log(`${colors.dim} Or set model directly: /model <model-id>${colors.reset}\n`);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (ctx.args.length === 0) {
|
|
39
|
+
// Redesigned interactive model picker grouped by provider
|
|
40
|
+
ctx.rl.pause();
|
|
41
|
+
const pickedProvider = await p.select({
|
|
42
|
+
message: `Current model: ${colors.cyan}${ctx.state.currentModel}${colors.reset} — Select AI Provider:`,
|
|
43
|
+
options: [
|
|
44
|
+
{ value: 'all', label: 'Show all models (flat list)', hint: 'classic view' },
|
|
45
|
+
...PROVIDER_REGISTRY.map(def => ({
|
|
46
|
+
value: def.name,
|
|
47
|
+
label: def.displayName,
|
|
48
|
+
hint: ProvidersManager.has(def.name) ? ' [key ✓]' : ' [no key]'
|
|
49
|
+
})),
|
|
50
|
+
{ value: '__manual__', label: 'Enter model ID manually…', hint: '' },
|
|
51
|
+
],
|
|
52
|
+
initialValue: PROVIDER_REGISTRY.find(def => def.models.includes(ctx.state.currentModel))?.name || 'all',
|
|
53
|
+
});
|
|
54
|
+
ctx.rl.resume();
|
|
55
|
+
if (p.isCancel(pickedProvider)) {
|
|
56
|
+
console.log(`\n${colors.dim}Model unchanged: ${colors.cyan}${ctx.state.currentModel}${colors.reset}`);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (pickedProvider === '__manual__') {
|
|
60
|
+
ctx.rl.pause();
|
|
61
|
+
const manual = await p.text({
|
|
62
|
+
message: 'Enter model ID:',
|
|
63
|
+
placeholder: 'e.g. gpt-4o, claude-opus-4-5, gemini-2.5-pro',
|
|
64
|
+
validate: v => !v.trim() ? 'Model ID is required' : undefined,
|
|
65
|
+
});
|
|
66
|
+
ctx.rl.resume();
|
|
67
|
+
if (!p.isCancel(manual) && manual) {
|
|
68
|
+
ctx.state.currentModel = manual.trim();
|
|
69
|
+
persistModelSelection(ctx.config, ctx.state.currentModel);
|
|
70
|
+
ctx.conversation.setContextLimit(ctx.state.currentModel);
|
|
71
|
+
console.log(`\n${colors.green}✓ Model set to: ${colors.bold}${ctx.state.currentModel}${colors.reset}`);
|
|
72
|
+
}
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (pickedProvider === 'all') {
|
|
76
|
+
ctx.rl.pause();
|
|
77
|
+
const allOptions = PROVIDER_REGISTRY.flatMap(def => def.models.map(m => ({
|
|
78
|
+
value: m,
|
|
79
|
+
label: `${m}`,
|
|
80
|
+
hint: def.displayName + (ProvidersManager.has(def.name) ? ' [key ✓]' : ''),
|
|
81
|
+
})));
|
|
82
|
+
const picked = await p.select({
|
|
83
|
+
message: 'Select a model from the flat list:',
|
|
84
|
+
options: [
|
|
85
|
+
{ value: ctx.state.currentModel, label: `Keep current: ${ctx.state.currentModel}`, hint: 'no change' },
|
|
86
|
+
...allOptions,
|
|
87
|
+
],
|
|
88
|
+
initialValue: ctx.state.currentModel,
|
|
89
|
+
});
|
|
90
|
+
ctx.rl.resume();
|
|
91
|
+
if (p.isCancel(picked)) {
|
|
92
|
+
console.log(`\n${colors.dim}Model unchanged: ${colors.cyan}${ctx.state.currentModel}${colors.reset}`);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
ctx.state.currentModel = picked;
|
|
96
|
+
// Store hint — find which provider this model belongs to
|
|
97
|
+
const owningDef = PROVIDER_REGISTRY.find(d => d.models.includes(ctx.state.currentModel)
|
|
98
|
+
|| ProvidersManager.getCachedModels(d.name)?.models?.includes(ctx.state.currentModel));
|
|
99
|
+
if (owningDef)
|
|
100
|
+
ProvidersManager.setModelProviderHint(ctx.state.currentModel, owningDef.name);
|
|
101
|
+
persistModelSelection(ctx.config, ctx.state.currentModel, owningDef?.name);
|
|
102
|
+
ctx.conversation.setContextLimit(ctx.state.currentModel);
|
|
103
|
+
console.log(`\n${colors.green}✓ Model set to: ${colors.bold}${ctx.state.currentModel}${colors.reset}`);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const def = PROVIDER_REGISTRY.find(p => p.name === pickedProvider);
|
|
107
|
+
const hasKey = ProvidersManager.has(def.name);
|
|
108
|
+
const keyStatus = hasKey ? `${colors.green}[key ✓]${colors.reset}` : `${colors.red}[no key]${colors.reset}`;
|
|
109
|
+
// Prefer the cached live model list; fall back to the
|
|
110
|
+
// registry list (tagged `[unverified]`) when no fresh
|
|
111
|
+
// cache exists. Drops the synthetic "(free)" suffix
|
|
112
|
+
// since we no longer know that without provider
|
|
113
|
+
// metadata.
|
|
114
|
+
const cached = ProvidersManager.getCachedModels(def.name);
|
|
115
|
+
const modelList = cached?.models?.length ? cached.models : def.models;
|
|
116
|
+
const sourceSuffix = cached?.source === 'live'
|
|
117
|
+
? ''
|
|
118
|
+
: ` ${colors.dim}[unverified]${colors.reset}`;
|
|
119
|
+
ctx.rl.pause();
|
|
120
|
+
const picked = await p.select({
|
|
121
|
+
message: `Select a model from ${colors.bold}${def.displayName}${colors.reset} ${keyStatus}${sourceSuffix}:`,
|
|
122
|
+
options: modelList.map(m => {
|
|
123
|
+
return {
|
|
124
|
+
value: m,
|
|
125
|
+
label: m,
|
|
126
|
+
hint: m === ctx.state.currentModel ? 'currently selected' : ''
|
|
127
|
+
};
|
|
128
|
+
}),
|
|
129
|
+
initialValue: modelList.includes(ctx.state.currentModel) ? ctx.state.currentModel : undefined,
|
|
130
|
+
});
|
|
131
|
+
ctx.rl.resume();
|
|
132
|
+
if (p.isCancel(picked)) {
|
|
133
|
+
console.log(`\n${colors.dim}Model unchanged: ${colors.cyan}${ctx.state.currentModel}${colors.reset}`);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
ctx.state.currentModel = picked;
|
|
137
|
+
// Store explicit model-provider association so
|
|
138
|
+
// resolveDirectConfig can route this model directly
|
|
139
|
+
// to this provider (critical for live-fetched models
|
|
140
|
+
// that don't appear in the static registry).
|
|
141
|
+
ProvidersManager.setModelProviderHint(ctx.state.currentModel, def.name);
|
|
142
|
+
persistModelSelection(ctx.config, ctx.state.currentModel, def.name);
|
|
143
|
+
ctx.conversation.setContextLimit(ctx.state.currentModel);
|
|
144
|
+
console.log(`\n${colors.green}✓ Model set to: ${colors.bold}${ctx.state.currentModel}${colors.reset}`);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
ctx.state.currentModel = ctx.args.join(' ');
|
|
148
|
+
persistModelSelection(ctx.config, ctx.state.currentModel);
|
|
149
|
+
ctx.conversation.setContextLimit(ctx.state.currentModel);
|
|
150
|
+
console.log(`\n${colors.green}✓ Model set to: ${colors.bold}${ctx.state.currentModel}${colors.reset}`);
|
|
151
|
+
return;
|
|
152
|
+
};
|
|
153
|
+
export const providersCommand = async (ctx) => {
|
|
154
|
+
const sub = ctx.args[0];
|
|
155
|
+
// ── Interactive flow (bare `/providers`): mirrors the
|
|
156
|
+
// /model picker shape. The user picks a provider, then
|
|
157
|
+
// an action, then enters a masked API key via p.password
|
|
158
|
+
// when the action is add/update. The legacy text routes
|
|
159
|
+
// below remain unchanged for muscle-memory + scripting.
|
|
160
|
+
if (!sub) {
|
|
161
|
+
ctx.rl.pause();
|
|
162
|
+
const pickedProvider = await p.select({
|
|
163
|
+
message: 'Select an AI provider:',
|
|
164
|
+
options: PROVIDER_REGISTRY.map(def => ({
|
|
165
|
+
value: def.name,
|
|
166
|
+
label: def.displayName,
|
|
167
|
+
hint: ProvidersManager.has(def.name) ? '[key ✓]' : '[no key]',
|
|
168
|
+
})),
|
|
169
|
+
});
|
|
170
|
+
ctx.rl.resume();
|
|
171
|
+
if (p.isCancel(pickedProvider)) {
|
|
172
|
+
console.log(`\n${colors.dim}/providers cancelled.${colors.reset}`);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
const def = ProvidersManager.getDefinition(pickedProvider);
|
|
176
|
+
if (!def) {
|
|
177
|
+
console.log(`\n${colors.red}✗ Unknown provider: ${pickedProvider}${colors.reset}`);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const hasKey = ProvidersManager.has(def.name);
|
|
181
|
+
ctx.rl.pause();
|
|
182
|
+
const action = await p.select({
|
|
183
|
+
message: `${def.displayName} — choose an action:`,
|
|
184
|
+
options: [
|
|
185
|
+
{ value: 'add', label: hasKey ? 'Update API key' : 'Add API key' },
|
|
186
|
+
{ value: 'test', label: 'Test connection', hint: hasKey ? '' : 'requires a key' },
|
|
187
|
+
{ value: 'remove', label: 'Remove API key', hint: hasKey ? '' : 'no key configured' },
|
|
188
|
+
{ value: 'cancel', label: 'Cancel' },
|
|
189
|
+
],
|
|
190
|
+
});
|
|
191
|
+
ctx.rl.resume();
|
|
192
|
+
if (p.isCancel(action) || action === 'cancel') {
|
|
193
|
+
console.log(`\n${colors.dim}/providers cancelled.${colors.reset}`);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
if (action === 'add') {
|
|
197
|
+
console.log(`${colors.dim} Get your API key at: ${def.docsUrl}${colors.reset}`);
|
|
198
|
+
ctx.rl.pause();
|
|
199
|
+
const key = await p.password({
|
|
200
|
+
message: `Enter your ${def.displayName} API key:`,
|
|
201
|
+
validate: v => !v?.trim() ? 'API key is required' : undefined,
|
|
202
|
+
});
|
|
203
|
+
ctx.rl.resume();
|
|
204
|
+
if (p.isCancel(key)) {
|
|
205
|
+
console.log(`\n${colors.dim}/providers cancelled.${colors.reset}`);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
ProvidersManager.add(def.name, key);
|
|
209
|
+
persistModelSelection(ctx.config, ctx.state.currentModel, def.name);
|
|
210
|
+
console.log(`\n${colors.green}✓ ${def.displayName} API key saved securely to ~/.fixocli/providers.json${colors.reset}`);
|
|
211
|
+
await ctx.refreshModelsForProvider(def.name);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
if (action === 'remove') {
|
|
215
|
+
if (!hasKey) {
|
|
216
|
+
console.log(`\n${colors.yellow}No key configured for ${def.displayName}.${colors.reset}`);
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
ctx.rl.pause();
|
|
220
|
+
const confirmed = await p.confirm({
|
|
221
|
+
message: `Remove API key for ${def.displayName}?`,
|
|
222
|
+
initialValue: false,
|
|
223
|
+
});
|
|
224
|
+
ctx.rl.resume();
|
|
225
|
+
if (!p.isCancel(confirmed) && confirmed) {
|
|
226
|
+
const removed = ProvidersManager.remove(def.name);
|
|
227
|
+
console.log(removed
|
|
228
|
+
? `\n${colors.green}✓ Removed API key for ${def.displayName}.${colors.reset}`
|
|
229
|
+
: `\n${colors.yellow}No key found for provider: ${def.name}${colors.reset}`);
|
|
230
|
+
}
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
if (action === 'test') {
|
|
234
|
+
if (!hasKey) {
|
|
235
|
+
console.log(`\n${colors.yellow}No key configured for ${def.displayName}. Add one first.${colors.reset}`);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
console.log(`\n${colors.dim}Testing connection to ${def.displayName} via live /models fetch…${colors.reset}`);
|
|
239
|
+
await ctx.refreshModelsForProvider(def.name);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
if (sub === 'list') {
|
|
245
|
+
const list = ProvidersManager.list();
|
|
246
|
+
if (list.length === 0) {
|
|
247
|
+
console.log(`\n${colors.yellow}No providers configured.${colors.reset}`);
|
|
248
|
+
console.log(`${colors.dim} Use /providers add <name> to connect a provider (e.g. /providers add groq)${colors.reset}`);
|
|
249
|
+
console.log(`${colors.dim} Available: ${PROVIDER_REGISTRY.map(p => p.name).join(', ')}${colors.reset}`);
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
console.log(`\n${colors.bold}${colors.cyan}Connected Providers${colors.reset}`);
|
|
253
|
+
console.log(`${colors.dim}${'─'.repeat(60)}${colors.reset}`);
|
|
254
|
+
for (const entry of list) {
|
|
255
|
+
const addedDate = new Date(entry.addedAt).toLocaleDateString();
|
|
256
|
+
console.log(` ${colors.cyan}${entry.name.padEnd(14)}${colors.reset}${colors.bold}${entry.displayName.padEnd(22)}${colors.reset}${colors.dim}${entry.maskedKey} (added ${addedDate})${colors.reset}`);
|
|
257
|
+
}
|
|
258
|
+
console.log(`\n${colors.dim} Use /providers remove <name> to remove a key.${colors.reset}`);
|
|
259
|
+
console.log(`${colors.dim} Use /providers test <name> to verify a connection.${colors.reset}`);
|
|
260
|
+
}
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
if (sub === 'add') {
|
|
264
|
+
const name = ctx.args[1]?.toLowerCase();
|
|
265
|
+
if (!name) {
|
|
266
|
+
console.log(`\n${colors.yellow}Usage: /providers add <provider-name>${colors.reset}`);
|
|
267
|
+
console.log(`${colors.dim} Available: ${PROVIDER_REGISTRY.map(p => p.name).join(', ')}${colors.reset}`);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
const def = ProvidersManager.getDefinition(name);
|
|
271
|
+
if (!def) {
|
|
272
|
+
console.log(`\n${colors.red}✗ Unknown provider: ${name}${colors.reset}`);
|
|
273
|
+
console.log(`${colors.dim} Available: ${PROVIDER_REGISTRY.map(p => p.name).join(', ')}${colors.reset}`);
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
console.log(`\n${colors.cyan}${colors.bold}Connecting to ${def.displayName}${colors.reset}`);
|
|
277
|
+
console.log(`${colors.dim} Get your API key at: ${def.docsUrl}${colors.reset}`);
|
|
278
|
+
ctx.rl.pause();
|
|
279
|
+
const apiKeyInput = await p.text({
|
|
280
|
+
message: `Enter your ${def.displayName} API key:`,
|
|
281
|
+
placeholder: 'sk-... or gsk_...',
|
|
282
|
+
validate: v => !v.trim() ? 'API key is required' : undefined,
|
|
283
|
+
});
|
|
284
|
+
ctx.rl.resume();
|
|
285
|
+
if (p.isCancel(apiKeyInput)) {
|
|
286
|
+
console.log(`\n${colors.dim}Provider add cancelled.${colors.reset}`);
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
ProvidersManager.add(name, apiKeyInput);
|
|
290
|
+
persistModelSelection(ctx.config, ctx.state.currentModel, def.name);
|
|
291
|
+
console.log(`\n${colors.green}✓ ${def.displayName} API key saved securely to ~/.fixocli/providers.json${colors.reset}`);
|
|
292
|
+
console.log(`${colors.dim} FixO will now route ${def.displayName} requests directly (bypassing the SaaS proxy).${colors.reset}`);
|
|
293
|
+
await ctx.refreshModelsForProvider(name);
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
if (sub === 'remove') {
|
|
297
|
+
const name = ctx.args[1]?.toLowerCase();
|
|
298
|
+
if (!name) {
|
|
299
|
+
console.log(`\n${colors.yellow}Usage: /providers remove <name>${colors.reset}`);
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
ctx.rl.pause();
|
|
303
|
+
const confirmed = await p.confirm({ message: `Remove API key for ${name}?`, initialValue: false });
|
|
304
|
+
ctx.rl.resume();
|
|
305
|
+
if (!p.isCancel(confirmed) && confirmed) {
|
|
306
|
+
const removed = ProvidersManager.remove(name);
|
|
307
|
+
console.log(removed
|
|
308
|
+
? `\n${colors.green}✓ Removed API key for ${name}.${colors.reset}`
|
|
309
|
+
: `\n${colors.yellow}No key found for provider: ${name}${colors.reset}`);
|
|
310
|
+
}
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
if (sub === 'test') {
|
|
314
|
+
const name = ctx.args[1]?.toLowerCase();
|
|
315
|
+
if (!name) {
|
|
316
|
+
console.log(`\n${colors.yellow}Usage: /providers test <name>${colors.reset}`);
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
const directConf = ProvidersManager.getDirectConfig(name);
|
|
320
|
+
if (!directConf) {
|
|
321
|
+
console.log(`\n${colors.yellow}No key configured for ${name}. Use /providers add ${name} first.${colors.reset}`);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
console.log(`\n${colors.dim}Testing connection to ${directConf.displayName} (${directConf.baseUrl})...${colors.reset}`);
|
|
325
|
+
try {
|
|
326
|
+
const testHeaders = {
|
|
327
|
+
'Authorization': `Bearer ${directConf.apiKey}`,
|
|
328
|
+
};
|
|
329
|
+
if (name === 'zen' || name === 'openrouter') {
|
|
330
|
+
testHeaders['HTTP-Referer'] = 'https://opencode.ai/';
|
|
331
|
+
testHeaders['X-Title'] = 'opencode';
|
|
332
|
+
}
|
|
333
|
+
else if (name === 'nvidia') {
|
|
334
|
+
testHeaders['HTTP-Referer'] = 'https://opencode.ai/';
|
|
335
|
+
testHeaders['X-Title'] = 'opencode';
|
|
336
|
+
testHeaders['X-BILLING-INVOKE-ORIGIN'] = 'OpenCode';
|
|
337
|
+
}
|
|
338
|
+
else if (name === 'cerebras') {
|
|
339
|
+
testHeaders['X-Cerebras-3rd-Party-Integration'] = 'opencode';
|
|
340
|
+
}
|
|
341
|
+
const resp = await fetch(`${directConf.baseUrl}/models`, {
|
|
342
|
+
headers: testHeaders,
|
|
343
|
+
signal: AbortSignal.timeout(8000),
|
|
344
|
+
});
|
|
345
|
+
if (resp.ok) {
|
|
346
|
+
console.log(`${colors.green}✓ Connection to ${directConf.displayName} successful! (HTTP ${resp.status})${colors.reset}`);
|
|
347
|
+
// Warm the cache so /model picker shows live IDs.
|
|
348
|
+
await ctx.refreshModelsForProvider(name);
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
const text = await resp.text().catch(() => '');
|
|
352
|
+
console.log(`${colors.red}✗ ${directConf.displayName} returned HTTP ${resp.status}${text ? ': ' + text.slice(0, 100) : ''}${colors.reset}`);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
catch (err) {
|
|
356
|
+
console.log(`${colors.red}✗ Connection failed: ${err.message}${colors.reset}`);
|
|
357
|
+
}
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
console.log(`\n${colors.yellow}Usage: /providers [list | add <name> | remove <name> | test <name>]${colors.reset}`);
|
|
361
|
+
console.log(`${colors.dim} Available providers: ${PROVIDER_REGISTRY.map(p => p.name).join(', ')}${colors.reset}`);
|
|
362
|
+
return;
|
|
363
|
+
};
|
|
364
|
+
export const modelRoutingCommand = async (ctx) => {
|
|
365
|
+
// Phase 2.4 — list / set the per-capability model tiers.
|
|
366
|
+
//
|
|
367
|
+
// /model-routing → print current
|
|
368
|
+
// /model-routing fast gpt-4o-mini → set fast tier
|
|
369
|
+
// /model-routing heavy claude-opus-4-7 → set heavy tier
|
|
370
|
+
// /model-routing default <model> → set default
|
|
371
|
+
// /model-routing clear fast → unset fast
|
|
372
|
+
// /model-routing clear → unset all tiers
|
|
373
|
+
const sub = ctx.args[0]?.toLowerCase();
|
|
374
|
+
const routing = ctx.config.preferences.modelRouting ?? {};
|
|
375
|
+
if (!sub) {
|
|
376
|
+
console.log(`\n${colors.cyan}Model routing tiers:${colors.reset}`);
|
|
377
|
+
console.log(` ${colors.bold}fast${colors.reset} → ${routing.fast ?? colors.dim + '(unset)' + colors.reset}`);
|
|
378
|
+
console.log(` ${colors.bold}default${colors.reset} → ${routing.default ?? colors.dim + '(unset)' + colors.reset}`);
|
|
379
|
+
console.log(` ${colors.bold}heavy${colors.reset} → ${routing.heavy ?? colors.dim + '(unset)' + colors.reset}`);
|
|
380
|
+
console.log(`${colors.dim}\n Usage:\n /model-routing fast <model>\n /model-routing heavy <model>\n /model-routing default <model>\n /model-routing clear [tier]${colors.reset}`);
|
|
381
|
+
}
|
|
382
|
+
else if (sub === 'clear') {
|
|
383
|
+
const tier = ctx.args[1]?.toLowerCase();
|
|
384
|
+
if (!tier) {
|
|
385
|
+
ctx.config.preferences.modelRouting = {};
|
|
386
|
+
saveConfig(ctx.config);
|
|
387
|
+
console.log(`\n${colors.green}✓ All model-routing tiers cleared${colors.reset}`);
|
|
388
|
+
}
|
|
389
|
+
else if (tier === 'fast' || tier === 'default' || tier === 'heavy') {
|
|
390
|
+
const next = { ...routing };
|
|
391
|
+
delete next[tier];
|
|
392
|
+
ctx.config.preferences.modelRouting = next;
|
|
393
|
+
saveConfig(ctx.config);
|
|
394
|
+
console.log(`\n${colors.green}✓ Cleared ${tier} tier${colors.reset}`);
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
console.log(`\n${colors.yellow}Unknown tier: ${tier}. Expected fast, default, or heavy.${colors.reset}`);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
else if (sub === 'fast' || sub === 'default' || sub === 'heavy') {
|
|
401
|
+
const modelName = ctx.args[1];
|
|
402
|
+
if (!modelName) {
|
|
403
|
+
console.log(`\n${colors.yellow}Usage: /model-routing ${sub} <model-name>${colors.reset}`);
|
|
404
|
+
}
|
|
405
|
+
else {
|
|
406
|
+
ctx.config.preferences.modelRouting = { ...routing, [sub]: modelName };
|
|
407
|
+
saveConfig(ctx.config);
|
|
408
|
+
console.log(`\n${colors.green}✓ Set ${sub} tier → ${modelName}${colors.reset}`);
|
|
409
|
+
console.log(`${colors.dim} Restart the session or run a new task — agents will pick up the new tier on construction.${colors.reset}`);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
console.log(`\n${colors.yellow}Unknown sub-command: ${sub}. Try /model-routing without arguments to see usage.${colors.reset}`);
|
|
414
|
+
}
|
|
415
|
+
return;
|
|
416
|
+
};
|
|
417
|
+
//# sourceMappingURL=model-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-commands.js","sourceRoot":"","sources":["../../../src/ui/commands/model-commands.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAQpC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAW7C,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAEvF,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAezC,SAAS,qBAAqB,CAC5B,MAAqB,EACrB,KAAa,EACb,QAAiB;IAEjB,MAAM,CAAC,WAAW,GAAG;QACnB,QAAQ,EAAE,QAAQ,IAAI,MAAM,CAAC,WAAW,EAAE,QAAQ,IAAI,MAAM,CAAC,cAAc,EAAE,IAAI,IAAI,MAAM;QAC3F,KAAK;QACL,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACpC,CAAC;IACF,MAAM,CAAC,YAAY,GAAG,KAAK,CAAC;IAC5B,UAAU,CAAC,MAAM,CAAC,CAAC;AACrB,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAmB,KAAK,EAAE,GAA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,8FAA8F,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QACzI,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC,MAAM,wBAAwB,GAAG,uDAAuD,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IAClI,CAAC;IACD,OAAO;AACX,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-commands.d.ts","sourceRoot":"","sources":["../../../src/ui/commands/session-commands.ts"],"names":[],"mappings":"AAsCA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,eAAO,MAAM,cAAc,EAAE,cAoH5B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,cAgC3B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,cAY7B,CAAC"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { colors } from '../colors.js';
|
|
2
|
+
export const sessionCommand = async (ctx) => {
|
|
3
|
+
const sub = ctx.args[0];
|
|
4
|
+
const { SessionManager } = await import('../../agent/conversation.js');
|
|
5
|
+
if (sub === 'rename') {
|
|
6
|
+
const id = ctx.args[1];
|
|
7
|
+
const rawLabel = ctx.args.slice(2).join(' ').trim();
|
|
8
|
+
const { isValidSessionLabel, MAX_LABEL_LENGTH } = await import('../../runtime/session-snapshots.js');
|
|
9
|
+
if (!id || !rawLabel) {
|
|
10
|
+
console.log(`\n${colors.yellow}Usage: /session rename <id> <label>${colors.reset}`);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (!isValidSessionLabel(rawLabel)) {
|
|
14
|
+
console.log(`\n${colors.red}✗ Invalid label.${colors.reset} ${colors.dim}Max ${MAX_LABEL_LENGTH} chars; letters, digits, space, dash, underscore, dot only.${colors.reset}`);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const ok = SessionManager.renameSession(id, rawLabel);
|
|
18
|
+
if (!ok) {
|
|
19
|
+
console.log(`\n${colors.red}✗ Session not found: ${id}${colors.reset}`);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (id === ctx.state.currentSessionId)
|
|
23
|
+
ctx.state.currentSessionLabel = rawLabel;
|
|
24
|
+
console.log(`\n${colors.green}✓ Renamed${colors.reset} ${colors.dim}${id}${colors.reset} → ${colors.cyan}${rawLabel}${colors.reset}`);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (sub === 'list') {
|
|
28
|
+
const list = SessionManager.listSessions();
|
|
29
|
+
if (list.length === 0) {
|
|
30
|
+
console.log(`\n${colors.dim}No saved sessions found.${colors.reset}`);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
console.log(`\n${colors.cyan}${colors.bold}Saved Sessions:${colors.reset}`);
|
|
34
|
+
for (const s of list) {
|
|
35
|
+
const date = new Date(s.timestamp).toLocaleString();
|
|
36
|
+
const labelDisplay = s.label
|
|
37
|
+
? `${colors.cyan}${s.label}${colors.reset} ${colors.dim}(${s.sessionId.slice(0, 8)})${colors.reset}`
|
|
38
|
+
: `${colors.cyan}${s.sessionId}${colors.reset}`;
|
|
39
|
+
console.log(` ${labelDisplay} - ${colors.bold}${s.model}${colors.reset} (${s.messageCount} msgs)`);
|
|
40
|
+
console.log(` ${colors.dim}Created: ${date} | Tokens: ${s.totalTokens.toLocaleString()}${colors.reset}`);
|
|
41
|
+
if (s.summary) {
|
|
42
|
+
console.log(` ${colors.dim}Summary: ${s.summary.slice(0, 80)}...${colors.reset}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
else if (sub === 'load') {
|
|
48
|
+
const uuid = ctx.args[1];
|
|
49
|
+
if (!uuid) {
|
|
50
|
+
console.log(`\n${colors.yellow}Usage: /session load <uuid>${colors.reset}`);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
const data = SessionManager.loadSession(uuid);
|
|
55
|
+
ctx.conversation.clear();
|
|
56
|
+
ctx.conversation.importHistory(data.history);
|
|
57
|
+
ctx.conversation.setSummary(data.summary || '');
|
|
58
|
+
ctx.state.currentModel = data.model;
|
|
59
|
+
ctx.conversation.setContextLimit(ctx.state.currentModel);
|
|
60
|
+
ctx.state.sessionModifiedFiles = data.modifiedFiles || [];
|
|
61
|
+
ctx.state.currentSessionId = data.sessionId;
|
|
62
|
+
ctx.state.currentSessionLabel = data.label;
|
|
63
|
+
ctx.state.stats.totalPromptTokens = data.tokenUsage?.prompt_tokens || 0;
|
|
64
|
+
ctx.state.stats.totalCompletionTokens = data.tokenUsage?.completion_tokens || 0;
|
|
65
|
+
console.log(`\n${colors.green}✓ Session restored successfully: ${colors.bold}${uuid}${colors.reset}`);
|
|
66
|
+
console.log(`${colors.dim} Model set to: ${colors.cyan}${ctx.state.currentModel}${colors.reset}`);
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
console.log(`\n${colors.red}✗ Failed to load session: ${err.message}${colors.reset}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else if (sub === 'new') {
|
|
73
|
+
ctx.conversation.clear();
|
|
74
|
+
ctx.state.sessionModifiedFiles = [];
|
|
75
|
+
ctx.state.stats.totalPromptTokens = 0;
|
|
76
|
+
ctx.state.stats.totalCompletionTokens = 0;
|
|
77
|
+
ctx.state.stats.totalToolCalls = 0;
|
|
78
|
+
ctx.state.stats.totalTasks = 0;
|
|
79
|
+
ctx.state.stats.totalDurationMs = 0;
|
|
80
|
+
const { randomUUID } = await import('node:crypto');
|
|
81
|
+
ctx.state.currentSessionId = randomUUID();
|
|
82
|
+
ctx.state.currentSessionLabel = undefined;
|
|
83
|
+
SessionManager.saveSession(ctx.conversation, ctx.state.currentModel, ctx.state.sessionModifiedFiles, {
|
|
84
|
+
prompt_tokens: ctx.state.stats.totalPromptTokens,
|
|
85
|
+
completion_tokens: ctx.state.stats.totalCompletionTokens,
|
|
86
|
+
total_tokens: ctx.state.stats.totalPromptTokens + ctx.state.stats.totalCompletionTokens,
|
|
87
|
+
}, ctx.state.currentSessionId, ctx.state.currentSessionLabel);
|
|
88
|
+
try {
|
|
89
|
+
const { saveSnapshot } = await import('../../runtime/session-snapshots.js');
|
|
90
|
+
saveSnapshot({
|
|
91
|
+
cwd: ctx.cwd,
|
|
92
|
+
conversation: [],
|
|
93
|
+
tokens: 0,
|
|
94
|
+
model: ctx.state.currentModel,
|
|
95
|
+
mode: ctx.state.currentMode,
|
|
96
|
+
selectedFiles: [],
|
|
97
|
+
summary: '',
|
|
98
|
+
label: undefined,
|
|
99
|
+
id: ctx.state.currentSessionId,
|
|
100
|
+
fixedInstructions: ctx.projectConfig?.systemPrompt,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
// Ignore snapshot save errors on new session
|
|
105
|
+
}
|
|
106
|
+
console.log(`\n${colors.green}✓ Active ctx.conversation memory purged. New session initialized: ${colors.bold}${ctx.state.currentSessionId}${colors.reset}`);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
console.log(`\n${colors.yellow}Usage: /session [list | load <uuid> | new | rename <id> <label>]${colors.reset}`);
|
|
110
|
+
}
|
|
111
|
+
return;
|
|
112
|
+
};
|
|
113
|
+
export const renameCommand = async (ctx) => {
|
|
114
|
+
// Renames the *active* session. Accepts the rest of the
|
|
115
|
+
// input as a free-form label (so spaces don't need quoting).
|
|
116
|
+
const rawLabel = ctx.args.join(' ').trim();
|
|
117
|
+
const { isValidSessionLabel, MAX_LABEL_LENGTH } = await import('../../runtime/session-snapshots.js');
|
|
118
|
+
const { SessionManager } = await import('../../agent/conversation.js');
|
|
119
|
+
if (!rawLabel) {
|
|
120
|
+
console.log(`\n${colors.yellow}Usage: /rename <label>${colors.reset}\n` +
|
|
121
|
+
`${colors.dim} Labels are 1..${MAX_LABEL_LENGTH} chars: letters, digits, space, dash, underscore, dot.${colors.reset}`);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (!isValidSessionLabel(rawLabel)) {
|
|
125
|
+
console.log(`\n${colors.red}✗ Invalid label.${colors.reset} ${colors.dim}Allowed: letters, digits, space, dash, underscore, dot — max ${MAX_LABEL_LENGTH} chars.${colors.reset}`);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
// Persist if the session has already been saved at least
|
|
129
|
+
// once; otherwise just remember the label in memory until
|
|
130
|
+
// the next save fires.
|
|
131
|
+
try {
|
|
132
|
+
SessionManager.renameSession(ctx.state.currentSessionId, rawLabel);
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
/* tolerate first-rename-before-save */
|
|
136
|
+
}
|
|
137
|
+
ctx.state.currentSessionLabel = rawLabel;
|
|
138
|
+
console.log(`\n${colors.green}✓ Session renamed:${colors.reset} ${colors.cyan}${rawLabel}${colors.reset} ${colors.dim}(id: ${ctx.state.currentSessionId})${colors.reset}`);
|
|
139
|
+
return;
|
|
140
|
+
};
|
|
141
|
+
export const snapshotCommand = async (ctx) => {
|
|
142
|
+
const label = ctx.args.join(' ').trim() || `snapshot-${Date.now()}`;
|
|
143
|
+
if (!ctx.git.isGitRepo()) {
|
|
144
|
+
console.log(`\n${colors.yellow}⚠ Not a ctx.git repository — cannot create snapshot.${colors.reset}`);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const hash = ctx.git.createSnapshot(label);
|
|
148
|
+
if (hash) {
|
|
149
|
+
console.log(`\n${colors.green}✓ Workspace snapshot created: ${colors.bold}${hash}${colors.reset}${colors.dim} (label: ${label})${colors.reset}`);
|
|
150
|
+
console.log(`${colors.dim} Use /undo or ctx.git revert to roll back to this point.${colors.reset}`);
|
|
151
|
+
}
|
|
152
|
+
return;
|
|
153
|
+
};
|
|
154
|
+
//# sourceMappingURL=session-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-commands.js","sourceRoot":"","sources":["../../../src/ui/commands/session-commands.ts"],"names":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,CAAC,KAAK,iCAAiC,MAAM,CAAC,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,YAAY,KAAK,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QACjJ,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,4DAA4D,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IACvG,CAAC;IACD,OAAO;AACX,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type CommandHandler } from './types.js';
|
|
2
|
+
export declare const reviewCommand: CommandHandler;
|
|
3
|
+
export declare const testCommand: CommandHandler;
|
|
4
|
+
export declare const fixTestsCommand: CommandHandler;
|
|
5
|
+
export declare const fixCiCommand: CommandHandler;
|
|
6
|
+
export declare const planCommand: CommandHandler;
|
|
7
|
+
export declare const runPlanCommand: CommandHandler;
|
|
8
|
+
//# sourceMappingURL=task-commands.d.ts.map
|