@link-assistant/hive-mind 1.51.0 ā 1.52.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.
- package/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/agent.prompts.lib.mjs +4 -9
- package/src/claude.lib.mjs +3 -1
- package/src/claude.prompts.lib.mjs +5 -13
- package/src/codex.options.lib.mjs +1 -0
- package/src/codex.prompts.lib.mjs +4 -9
- package/src/config.lib.mjs +133 -31
- package/src/models/index.mjs +11 -6
- package/src/opencode.prompts.lib.mjs +4 -9
- package/src/solve.config.lib.mjs +7 -2
- package/src/telegram-bot.mjs +1 -1
- package/src/thinking-prompt.lib.mjs +61 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @link-assistant/hive-mind
|
|
2
2
|
|
|
3
|
+
## 1.52.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5b24866: Add Claude Opus 4.7 model support with adaptive thinking, model-correct xhigh/max effort mapping, Opus 4.5/Mythos effort detection, and the --show-thinking-content option.
|
|
8
|
+
|
|
3
9
|
## 1.51.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { getArchitectureCareSubPrompt } from './architecture-care.prompts.lib.mjs';
|
|
7
7
|
import { getExperimentsExamplesSubPrompt } from './experiments-examples.prompts.lib.mjs';
|
|
8
|
+
import { getThinkingPromptInstruction } from './thinking-prompt.lib.mjs';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Build the user prompt for Agent
|
|
@@ -58,15 +59,9 @@ export const buildUserPrompt = params => {
|
|
|
58
59
|
promptLines.push('');
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
if (
|
|
63
|
-
|
|
64
|
-
low: 'Think.',
|
|
65
|
-
medium: 'Think hard.',
|
|
66
|
-
high: 'Think harder.',
|
|
67
|
-
max: 'Ultrathink.',
|
|
68
|
-
};
|
|
69
|
-
promptLines.push(thinkMessages[argv.think]);
|
|
62
|
+
const thinkingPromptInstruction = getThinkingPromptInstruction({ tool: 'agent', argv });
|
|
63
|
+
if (thinkingPromptInstruction) {
|
|
64
|
+
promptLines.push(thinkingPromptInstruction);
|
|
70
65
|
}
|
|
71
66
|
|
|
72
67
|
// Final instruction
|
package/src/claude.lib.mjs
CHANGED
|
@@ -301,6 +301,7 @@ export const executeClaude = async params => {
|
|
|
301
301
|
owner,
|
|
302
302
|
repo,
|
|
303
303
|
argv,
|
|
304
|
+
claudeVersion: getClaudeVersion(),
|
|
304
305
|
});
|
|
305
306
|
// Build the system prompt
|
|
306
307
|
const systemPrompt = buildSystemPrompt({
|
|
@@ -784,7 +785,7 @@ export const executeClaudeCommand = async params => {
|
|
|
784
785
|
}
|
|
785
786
|
try {
|
|
786
787
|
const { thinkingBudget: resolvedThinkingBudget, thinkLevel, isNewVersion, maxBudget } = await resolveThinkingSettings(argv, log);
|
|
787
|
-
const claudeEnv = getClaudeEnv({ thinkingBudget: resolvedThinkingBudget, model: effectiveModel, thinkLevel, maxBudget, planModel: resolvedPlanModel, executionModel: resolvedExecutionModel });
|
|
788
|
+
const claudeEnv = getClaudeEnv({ thinkingBudget: resolvedThinkingBudget, model: effectiveModel, thinkLevel, maxBudget, planModel: resolvedPlanModel, executionModel: resolvedExecutionModel, showThinkingContent: argv.showThinkingContent });
|
|
788
789
|
if (argv.verbose) claudeEnv.ANTHROPIC_LOG = 'debug';
|
|
789
790
|
const modelMaxOutputTokens = getMaxOutputTokensForModel(effectiveModel);
|
|
790
791
|
if (argv.verbose) {
|
|
@@ -792,6 +793,7 @@ export const executeClaudeCommand = async params => {
|
|
|
792
793
|
if (resolvedPlanModel) await log(`š opusplan: plan=${resolvedPlanModel}, exec=${resolvedExecutionModel}`, { verbose: true });
|
|
793
794
|
if (resolvedThinkingBudget !== undefined) await log(`š MAX_THINKING_TOKENS: ${resolvedThinkingBudget}`, { verbose: true });
|
|
794
795
|
if (claudeEnv.CLAUDE_CODE_EFFORT_LEVEL) await log(`š CLAUDE_CODE_EFFORT_LEVEL: ${claudeEnv.CLAUDE_CODE_EFFORT_LEVEL}`, { verbose: true });
|
|
796
|
+
if (claudeEnv.CLAUDE_CODE_SHOW_THINKING) await log(`š CLAUDE_CODE_SHOW_THINKING: ${claudeEnv.CLAUDE_CODE_SHOW_THINKING}`, { verbose: true });
|
|
795
797
|
if (!isNewVersion && thinkLevel) await log(`š Thinking level (via keywords): ${thinkLevel}`, { verbose: true });
|
|
796
798
|
}
|
|
797
799
|
const simpleEscapedSystem = systemPrompt.replace(/"/g, '\\"');
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { getArchitectureCareSubPrompt } from './architecture-care.prompts.lib.mjs';
|
|
7
7
|
import { getExperimentsExamplesSubPrompt } from './experiments-examples.prompts.lib.mjs';
|
|
8
8
|
import { primaryModelNames } from './models/index.mjs';
|
|
9
|
+
import { getThinkingPromptInstruction } from './thinking-prompt.lib.mjs';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Build the user prompt for Claude
|
|
@@ -13,7 +14,7 @@ import { primaryModelNames } from './models/index.mjs';
|
|
|
13
14
|
* @returns {string} The formatted user prompt
|
|
14
15
|
*/
|
|
15
16
|
export const buildUserPrompt = params => {
|
|
16
|
-
const { issueUrl, issueNumber, prNumber, prUrl, branchName, tempDir, workspaceTmpDir, isContinueMode, forkedRepo, feedbackLines, owner, repo, argv, contributingGuidelines } = params;
|
|
17
|
+
const { issueUrl, issueNumber, prNumber, prUrl, branchName, tempDir, workspaceTmpDir, isContinueMode, forkedRepo, feedbackLines, owner, repo, argv, contributingGuidelines, claudeVersion } = params;
|
|
17
18
|
|
|
18
19
|
const promptLines = [];
|
|
19
20
|
|
|
@@ -65,18 +66,9 @@ export const buildUserPrompt = params => {
|
|
|
65
66
|
promptLines.push('');
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
// Keeping keywords for backward compatibility with older Claude Code versions
|
|
72
|
-
if (argv && argv.think) {
|
|
73
|
-
const thinkMessages = {
|
|
74
|
-
low: 'Think.',
|
|
75
|
-
medium: 'Think hard.',
|
|
76
|
-
high: 'Think harder.',
|
|
77
|
-
max: 'Ultrathink.',
|
|
78
|
-
};
|
|
79
|
-
promptLines.push(thinkMessages[argv.think]);
|
|
69
|
+
const thinkingPromptInstruction = getThinkingPromptInstruction({ tool: 'claude', argv, claudeVersion });
|
|
70
|
+
if (thinkingPromptInstruction) {
|
|
71
|
+
promptLines.push(thinkingPromptInstruction);
|
|
80
72
|
}
|
|
81
73
|
|
|
82
74
|
// Final instruction
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { getArchitectureCareSubPrompt } from './architecture-care.prompts.lib.mjs';
|
|
7
7
|
import { getExperimentsExamplesSubPrompt } from './experiments-examples.prompts.lib.mjs';
|
|
8
|
+
import { getThinkingPromptInstruction } from './thinking-prompt.lib.mjs';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Build the user prompt for Codex
|
|
@@ -58,15 +59,9 @@ export const buildUserPrompt = params => {
|
|
|
58
59
|
promptLines.push('');
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
if (
|
|
63
|
-
|
|
64
|
-
low: 'Think.',
|
|
65
|
-
medium: 'Think hard.',
|
|
66
|
-
high: 'Think harder.',
|
|
67
|
-
max: 'Ultrathink.',
|
|
68
|
-
};
|
|
69
|
-
promptLines.push(thinkMessages[argv.think]);
|
|
62
|
+
const thinkingPromptInstruction = getThinkingPromptInstruction({ tool: 'codex', argv });
|
|
63
|
+
if (thinkingPromptInstruction) {
|
|
64
|
+
promptLines.push(thinkingPromptInstruction);
|
|
70
65
|
}
|
|
71
66
|
|
|
72
67
|
// Final instruction
|
package/src/config.lib.mjs
CHANGED
|
@@ -178,11 +178,82 @@ export const isOpus46OrLater = model => {
|
|
|
178
178
|
if (!model) return false;
|
|
179
179
|
const normalizedModel = model.toLowerCase();
|
|
180
180
|
// Check for explicit opus-4-6 or later versions, or opusplan (Issue #1223)
|
|
181
|
-
// Note: The 'opus' alias now maps to Opus 4.
|
|
181
|
+
// Note: The 'opus' alias now maps to Opus 4.7 (Issue #1620), so we also check for the alias directly
|
|
182
182
|
// opusplan uses Opus for planning, so it should get Opus-level settings
|
|
183
183
|
return normalizedModel === 'opus' || normalizedModel === 'opusplan' || normalizedModel.includes('opus-4-6') || normalizedModel.includes('opus-4-7') || normalizedModel.includes('opus-5');
|
|
184
184
|
};
|
|
185
185
|
|
|
186
|
+
const isOpus47 = model => {
|
|
187
|
+
if (!model) return false;
|
|
188
|
+
const normalizedModel = model.toLowerCase();
|
|
189
|
+
// 'opus' alias now maps to Opus 4.7 (Issue #1620)
|
|
190
|
+
// opusplan uses Opus for planning, so it gets Opus-level settings
|
|
191
|
+
return normalizedModel === 'opus' || normalizedModel === 'opusplan' || normalizedModel.includes('opus-4-7');
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Check if a model is Opus 4.7 or later (Issue #1620)
|
|
196
|
+
* These models use Opus 4.7+ adaptive thinking behavior.
|
|
197
|
+
* @param {string} model - The model name or ID
|
|
198
|
+
* @returns {boolean} True if the model is Opus 4.7 or later
|
|
199
|
+
*/
|
|
200
|
+
export const isOpus47OrLater = model => {
|
|
201
|
+
if (!model) return false;
|
|
202
|
+
const normalizedModel = model.toLowerCase();
|
|
203
|
+
return isOpus47(model) || normalizedModel.includes('opus-5');
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const isOpus45 = model => {
|
|
207
|
+
if (!model) return false;
|
|
208
|
+
const m = model.toLowerCase();
|
|
209
|
+
return m === 'opus-4-5' || m.includes('opus-4-5');
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
const isOpus46 = model => {
|
|
213
|
+
if (!model) return false;
|
|
214
|
+
const m = model.toLowerCase();
|
|
215
|
+
return m === 'opus-4-6' || m.includes('opus-4-6');
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const isSonnet46OrLater = model => {
|
|
219
|
+
if (!model) return false;
|
|
220
|
+
const m = model.toLowerCase();
|
|
221
|
+
return m === 'sonnet' || m === 'sonnet-4-6' || m.includes('sonnet-4-6') || m.includes('sonnet-5');
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const isMythosPreview = model => {
|
|
225
|
+
if (!model) return false;
|
|
226
|
+
return model.toLowerCase().includes('mythos');
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Check if a model supports CLAUDE_CODE_EFFORT_LEVEL (Issue #1238, Issue #1620)
|
|
231
|
+
* Official effort support: Claude Mythos Preview, Opus 4.7, Opus 4.6, Sonnet 4.6, and Opus 4.5.
|
|
232
|
+
* Haiku 4.5 and older models use MAX_THINKING_TOKENS only.
|
|
233
|
+
* @param {string} model - The model name or ID
|
|
234
|
+
* @returns {boolean} True if the model supports effort levels
|
|
235
|
+
*/
|
|
236
|
+
export const supportsEffortLevel = model => {
|
|
237
|
+
if (!model) return false;
|
|
238
|
+
return isMythosPreview(model) || isOpus47OrLater(model) || isOpus46(model) || isSonnet46OrLater(model) || isOpus45(model);
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Check if a model supports the xhigh effort level.
|
|
243
|
+
* Official docs list xhigh only for Claude Opus 4.7.
|
|
244
|
+
* @param {string} model - The model name or ID
|
|
245
|
+
* @returns {boolean} True if the model supports xhigh effort
|
|
246
|
+
*/
|
|
247
|
+
export const supportsXHighEffortLevel = model => isOpus47(model);
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Check if a model supports the max effort level.
|
|
251
|
+
* Official docs list max for Claude Mythos Preview, Opus 4.7, Opus 4.6, and Sonnet 4.6.
|
|
252
|
+
* @param {string} model - The model name or ID
|
|
253
|
+
* @returns {boolean} True if the model supports max effort
|
|
254
|
+
*/
|
|
255
|
+
export const supportsMaxEffortLevel = model => isMythosPreview(model) || isOpus47OrLater(model) || isOpus46(model) || isSonnet46OrLater(model);
|
|
256
|
+
|
|
186
257
|
/**
|
|
187
258
|
* Get the max output tokens for a specific model (Issue #1221)
|
|
188
259
|
* @param {string} model - The model name or ID
|
|
@@ -218,6 +289,7 @@ export const getThinkingLevelToTokens = (maxBudget = DEFAULT_MAX_THINKING_BUDGET
|
|
|
218
289
|
low: Math.floor(maxBudget / 4), // ~8000 for default 31999
|
|
219
290
|
medium: Math.floor(maxBudget / 2), // ~16000 for default 31999
|
|
220
291
|
high: Math.floor((maxBudget * 3) / 4), // ~24000 for default 31999
|
|
292
|
+
xhigh: maxBudget, // same as max when represented as MAX_THINKING_TOKENS
|
|
221
293
|
max: maxBudget, // 31999 by default
|
|
222
294
|
});
|
|
223
295
|
|
|
@@ -250,56 +322,73 @@ export const getTokensToThinkingLevel = (maxBudget = DEFAULT_MAX_THINKING_BUDGET
|
|
|
250
322
|
export const tokensToThinkingLevel = getTokensToThinkingLevel(DEFAULT_MAX_THINKING_BUDGET);
|
|
251
323
|
|
|
252
324
|
/**
|
|
253
|
-
* Valid effort levels for Opus 4.6 (Issue #1238)
|
|
254
|
-
*
|
|
325
|
+
* Valid effort levels for Opus 4.6 and Sonnet 4.6 (Issue #1238, Issue #1620)
|
|
326
|
+
* These models use CLAUDE_CODE_EFFORT_LEVEL for thinking depth control
|
|
327
|
+
* @type {string[]}
|
|
328
|
+
*/
|
|
329
|
+
export const OPUS_46_EFFORT_LEVELS = ['low', 'medium', 'high', 'max'];
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Valid effort levels for Opus 4.7 (Issue #1620)
|
|
333
|
+
* Opus 4.7 supports the additional 'xhigh' level.
|
|
334
|
+
* See: https://platform.claude.com/docs/en/build-with-claude/effort
|
|
255
335
|
* @type {string[]}
|
|
256
336
|
*/
|
|
257
|
-
export const
|
|
337
|
+
export const OPUS_47_EFFORT_LEVELS = ['low', 'medium', 'high', 'xhigh', 'max'];
|
|
258
338
|
|
|
259
339
|
/**
|
|
260
|
-
* Convert thinking level to
|
|
261
|
-
* Opus 4.
|
|
262
|
-
*
|
|
263
|
-
* @
|
|
340
|
+
* Convert thinking level to effort level (Issue #1238, Issue #1620)
|
|
341
|
+
* Models with max support keep max as max. Opus 4.7 keeps xhigh as xhigh.
|
|
342
|
+
* Models with effort but without max support use high for max/xhigh.
|
|
343
|
+
* @param {string|undefined} thinkLevel - The thinking level (off/low/medium/high/xhigh/max)
|
|
344
|
+
* @param {Object} [options] - Options
|
|
345
|
+
* @param {boolean} [options.isOpus47] - Backward-compatible shorthand for supportsXHigh
|
|
346
|
+
* @param {boolean} [options.supportsXHigh] - Whether the model supports xhigh effort
|
|
347
|
+
* @param {boolean} [options.supportsMax] - Whether the model supports max effort
|
|
348
|
+
* @returns {string|undefined} The effort level or undefined if thinking is off
|
|
264
349
|
*/
|
|
265
|
-
export const thinkLevelToEffortLevel = thinkLevel => {
|
|
350
|
+
export const thinkLevelToEffortLevel = (thinkLevel, options = {}) => {
|
|
266
351
|
if (!thinkLevel || thinkLevel === 'off') {
|
|
267
|
-
// No effort level when thinking is disabled
|
|
268
352
|
return undefined;
|
|
269
353
|
}
|
|
270
354
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
355
|
+
const supportsXHigh = options.supportsXHigh ?? options.isOpus47 ?? false;
|
|
356
|
+
const supportsMax = options.supportsMax ?? true;
|
|
357
|
+
|
|
274
358
|
switch (thinkLevel) {
|
|
275
359
|
case 'low':
|
|
276
360
|
return 'low';
|
|
277
361
|
case 'medium':
|
|
278
362
|
return 'medium';
|
|
279
363
|
case 'high':
|
|
280
|
-
case 'max':
|
|
281
364
|
return 'high';
|
|
365
|
+
case 'xhigh':
|
|
366
|
+
return supportsXHigh ? 'xhigh' : supportsMax ? 'max' : 'high';
|
|
367
|
+
case 'max':
|
|
368
|
+
return supportsMax ? 'max' : 'high';
|
|
282
369
|
default:
|
|
283
370
|
return undefined;
|
|
284
371
|
}
|
|
285
372
|
};
|
|
286
373
|
|
|
287
374
|
/**
|
|
288
|
-
* Convert thinking budget (tokens) to
|
|
375
|
+
* Convert thinking budget (tokens) to effort level (Issue #1238, Issue #1620)
|
|
289
376
|
* Uses token thresholds to determine the appropriate effort level
|
|
290
377
|
* @param {number|undefined} thinkingBudget - The thinking budget in tokens
|
|
291
378
|
* @param {number} maxBudget - Maximum thinking budget (default: 31999)
|
|
292
|
-
* @
|
|
379
|
+
* @param {Object} [options] - Options
|
|
380
|
+
* @param {boolean} [options.isOpus47] - Backward-compatible shorthand for supportsXHigh
|
|
381
|
+
* @param {boolean} [options.supportsXHigh] - Whether the model supports xhigh effort
|
|
382
|
+
* @param {boolean} [options.supportsMax] - Whether the model supports max effort
|
|
383
|
+
* @returns {string|undefined} The effort level or undefined if thinking is off
|
|
293
384
|
*/
|
|
294
|
-
export const thinkingBudgetToEffortLevel = (thinkingBudget, maxBudget = DEFAULT_MAX_THINKING_BUDGET) => {
|
|
385
|
+
export const thinkingBudgetToEffortLevel = (thinkingBudget, maxBudget = DEFAULT_MAX_THINKING_BUDGET, options = {}) => {
|
|
295
386
|
if (thinkingBudget === undefined || thinkingBudget === 0) {
|
|
296
|
-
// No effort level when thinking is disabled
|
|
297
387
|
return undefined;
|
|
298
388
|
}
|
|
299
389
|
|
|
300
|
-
// Convert tokens to thinking level, then to effort level
|
|
301
390
|
const thinkLevel = getTokensToThinkingLevel(maxBudget)(thinkingBudget);
|
|
302
|
-
return thinkLevelToEffortLevel(thinkLevel);
|
|
391
|
+
return thinkLevelToEffortLevel(thinkLevel, options);
|
|
303
392
|
};
|
|
304
393
|
|
|
305
394
|
// Check if a version supports thinking budget (>= minimum version)
|
|
@@ -339,27 +428,40 @@ export const getClaudeEnv = (options = {}) => {
|
|
|
339
428
|
MCP_TOOL_TIMEOUT: String(claudeCode.mcpToolTimeout),
|
|
340
429
|
};
|
|
341
430
|
|
|
342
|
-
//
|
|
343
|
-
//
|
|
344
|
-
//
|
|
345
|
-
|
|
431
|
+
// Opus 4.7+ always uses adaptive thinking ā MAX_THINKING_TOKENS has no effect (Issue #1620)
|
|
432
|
+
// For Opus 4.6 and earlier, MAX_THINKING_TOKENS controls extended thinking (Claude Code >= 2.1.12)
|
|
433
|
+
// Default is 0 (thinking disabled) per Issue #1238.
|
|
434
|
+
const opus47 = options.model && isOpus47OrLater(options.model);
|
|
435
|
+
if (opus47) {
|
|
436
|
+
// Remove any inherited MAX_THINKING_TOKENS from process.env ā Opus 4.7 ignores it
|
|
437
|
+
delete env.MAX_THINKING_TOKENS;
|
|
438
|
+
} else {
|
|
439
|
+
env.MAX_THINKING_TOKENS = String(options.thinkingBudget ?? 0);
|
|
440
|
+
}
|
|
346
441
|
|
|
347
|
-
//
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
442
|
+
// Set CLAUDE_CODE_EFFORT_LEVEL for models that support it (Issue #1238, Issue #1620)
|
|
443
|
+
if (options.model && supportsEffortLevel(options.model)) {
|
|
444
|
+
const effortOptions = {
|
|
445
|
+
supportsXHigh: supportsXHighEffortLevel(options.model),
|
|
446
|
+
supportsMax: supportsMaxEffortLevel(options.model),
|
|
447
|
+
};
|
|
352
448
|
let effortLevel;
|
|
353
449
|
if (options.thinkLevel) {
|
|
354
|
-
effortLevel = thinkLevelToEffortLevel(options.thinkLevel);
|
|
450
|
+
effortLevel = thinkLevelToEffortLevel(options.thinkLevel, effortOptions);
|
|
355
451
|
} else if (options.thinkingBudget !== undefined && options.thinkingBudget > 0) {
|
|
356
|
-
effortLevel = thinkingBudgetToEffortLevel(options.thinkingBudget, options.maxBudget);
|
|
452
|
+
effortLevel = thinkingBudgetToEffortLevel(options.thinkingBudget, options.maxBudget, effortOptions);
|
|
357
453
|
}
|
|
358
454
|
|
|
359
455
|
if (effortLevel) {
|
|
360
456
|
env.CLAUDE_CODE_EFFORT_LEVEL = effortLevel;
|
|
361
457
|
}
|
|
362
458
|
}
|
|
459
|
+
|
|
460
|
+
// Opus 4.7 omits thinking content by default; opt in with --show-thinking-content (Issue #1620)
|
|
461
|
+
// Sets CLAUDE_CODE_SHOW_THINKING=1 which Claude Code uses to request display: "summarized"
|
|
462
|
+
if (options.showThinkingContent) {
|
|
463
|
+
env.CLAUDE_CODE_SHOW_THINKING = '1';
|
|
464
|
+
}
|
|
363
465
|
// Set ANTHROPIC_DEFAULT_OPUS_MODEL when planModel is specified (Issue #1223)
|
|
364
466
|
// This tells Claude Code which model to use during plan mode in opusplan
|
|
365
467
|
if (options.planModel) {
|
package/src/models/index.mjs
CHANGED
|
@@ -23,23 +23,25 @@ import { log } from '../lib.mjs';
|
|
|
23
23
|
// āāā MODEL DATA āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
24
24
|
|
|
25
25
|
// Claude models (Anthropic API)
|
|
26
|
-
// Updated for Opus 4.5/4.6 and Sonnet 4.6 support (Issue #1221, Issue #1238, Issue #1329, Issue #1433)
|
|
26
|
+
// Updated for Opus 4.5/4.6/4.7 and Sonnet 4.6 support (Issue #1221, Issue #1238, Issue #1329, Issue #1433, Issue #1620)
|
|
27
27
|
export const claudeModels = {
|
|
28
28
|
sonnet: 'claude-sonnet-4-6', // Sonnet 4.6 (default, Issue #1329)
|
|
29
|
-
opus: 'claude-opus-4-
|
|
29
|
+
opus: 'claude-opus-4-7', // Opus 4.7 (Issue #1620)
|
|
30
30
|
haiku: 'claude-haiku-4-5-20251001', // Haiku 4.5
|
|
31
31
|
'haiku-3-5': 'claude-3-5-haiku-20241022', // Haiku 3.5
|
|
32
32
|
'haiku-3': 'claude-3-haiku-20240307', // Haiku 3
|
|
33
33
|
opusplan: 'opusplan', // Special mode: Opus for planning, Sonnet for execution (Issue #1223)
|
|
34
34
|
// Shorter version aliases (Issue #1221, Issue #1329 - PR comment feedback)
|
|
35
35
|
'sonnet-4-6': 'claude-sonnet-4-6', // Sonnet 4.6 short alias (Issue #1329)
|
|
36
|
-
'opus-4-
|
|
36
|
+
'opus-4-7': 'claude-opus-4-7', // Opus 4.7 short alias (Issue #1620)
|
|
37
|
+
'opus-4-6': 'claude-opus-4-6', // Opus 4.6 short alias (backward compatibility)
|
|
37
38
|
'opus-4-5': 'claude-opus-4-5-20251101', // Opus 4.5 short alias
|
|
38
39
|
'sonnet-4-5': 'claude-sonnet-4-5-20250929', // Sonnet 4.5 short alias (backward compatibility)
|
|
39
40
|
'haiku-4-5': 'claude-haiku-4-5-20251001', // Haiku 4.5 short alias
|
|
40
|
-
// Version aliases for backward compatibility (Issue #1221, Issue #1329)
|
|
41
|
+
// Version aliases for backward compatibility (Issue #1221, Issue #1329, Issue #1620)
|
|
42
|
+
'claude-opus-4-7': 'claude-opus-4-7', // Opus 4.7 (Issue #1620)
|
|
41
43
|
'claude-sonnet-4-6': 'claude-sonnet-4-6', // Sonnet 4.6 (Issue #1329)
|
|
42
|
-
'claude-opus-4-6': 'claude-opus-4-6', // Opus 4.6
|
|
44
|
+
'claude-opus-4-6': 'claude-opus-4-6', // Opus 4.6 (backward compatibility)
|
|
43
45
|
'claude-opus-4-5': 'claude-opus-4-5-20251101', // Opus 4.5
|
|
44
46
|
'claude-sonnet-4-5': 'claude-sonnet-4-5-20250929', // Sonnet 4.5 (backward compatibility)
|
|
45
47
|
'claude-haiku-4-5': 'claude-haiku-4-5-20251001', // Haiku 4.5
|
|
@@ -129,6 +131,7 @@ export const defaultModels = {
|
|
|
129
131
|
// Models that support 1M token context window via [1m] suffix (Issue #1221, Issue #1238, Issue #1329)
|
|
130
132
|
// See: https://code.claude.com/docs/en/model-config
|
|
131
133
|
export const MODELS_SUPPORTING_1M_CONTEXT = [
|
|
134
|
+
'claude-opus-4-7', // Opus 4.7 (Issue #1620)
|
|
132
135
|
'claude-opus-4-6',
|
|
133
136
|
'claude-opus-4-5-20251101',
|
|
134
137
|
'claude-sonnet-4-6', // Sonnet 4.6 (Issue #1329)
|
|
@@ -136,7 +139,8 @@ export const MODELS_SUPPORTING_1M_CONTEXT = [
|
|
|
136
139
|
'claude-sonnet-4-5',
|
|
137
140
|
'sonnet', // Now maps to Sonnet 4.6 (Issue #1329)
|
|
138
141
|
'sonnet-4-6', // Short alias (Issue #1329)
|
|
139
|
-
'opus',
|
|
142
|
+
'opus', // Now maps to Opus 4.7 (Issue #1620)
|
|
143
|
+
'opus-4-7', // Short alias (Issue #1620)
|
|
140
144
|
'opus-4-6', // Short alias (Issue #1221 - PR comment feedback)
|
|
141
145
|
'opus-4-5', // Short alias (Issue #1238)
|
|
142
146
|
'sonnet-4-5', // Short alias (Issue #1221 - PR comment feedback)
|
|
@@ -165,6 +169,7 @@ export const freeToBaseModelMap = {
|
|
|
165
169
|
|
|
166
170
|
export const CLAUDE_MODELS = {
|
|
167
171
|
...claudeModels,
|
|
172
|
+
'claude-opus-4-7': 'claude-opus-4-7', // Opus 4.7 full ID (Issue #1620)
|
|
168
173
|
'claude-sonnet-4-5-20250929': 'claude-sonnet-4-5-20250929',
|
|
169
174
|
'claude-opus-4-5-20251101': 'claude-opus-4-5-20251101',
|
|
170
175
|
'claude-haiku-4-5-20251001': 'claude-haiku-4-5-20251001',
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { getArchitectureCareSubPrompt } from './architecture-care.prompts.lib.mjs';
|
|
7
7
|
import { getExperimentsExamplesSubPrompt } from './experiments-examples.prompts.lib.mjs';
|
|
8
|
+
import { getThinkingPromptInstruction } from './thinking-prompt.lib.mjs';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Build the user prompt for OpenCode
|
|
@@ -58,15 +59,9 @@ export const buildUserPrompt = params => {
|
|
|
58
59
|
promptLines.push('');
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
if (
|
|
63
|
-
|
|
64
|
-
low: 'Think.',
|
|
65
|
-
medium: 'Think hard.',
|
|
66
|
-
high: 'Think harder.',
|
|
67
|
-
max: 'Ultrathink.',
|
|
68
|
-
};
|
|
69
|
-
promptLines.push(thinkMessages[argv.think]);
|
|
62
|
+
const thinkingPromptInstruction = getThinkingPromptInstruction({ tool: 'opencode', argv });
|
|
63
|
+
if (thinkingPromptInstruction) {
|
|
64
|
+
promptLines.push(thinkingPromptInstruction);
|
|
70
65
|
}
|
|
71
66
|
|
|
72
67
|
// Final instruction
|
package/src/solve.config.lib.mjs
CHANGED
|
@@ -229,8 +229,8 @@ export const SOLVE_OPTION_DEFINITIONS = {
|
|
|
229
229
|
},
|
|
230
230
|
think: {
|
|
231
231
|
type: 'string',
|
|
232
|
-
description: 'Thinking level hint. For Claude, translated to --thinking-budget for Claude Code >= 2.1.12 (off=0, low=~8000, medium=~16000, high=~24000, max=31999). For Codex, mapped to reasoning effort (off=none, low=low, medium=medium, high=high, max=xhigh).',
|
|
233
|
-
choices: ['off', 'low', 'medium', 'high', 'max'],
|
|
232
|
+
description: 'Thinking level hint. For Claude, translated to --thinking-budget for Claude Code >= 2.1.12 (off=0, low=~8000, medium=~16000, high=~24000, xhigh/max=31999) and to CLAUDE_CODE_EFFORT_LEVEL when supported. Opus 4.7 supports xhigh and max; Opus 4.6/Sonnet 4.6/Mythos support max; Opus 4.5 uses high for xhigh/max. For Codex, mapped to reasoning effort (off=none, low=low, medium=medium, high=high, xhigh/max=xhigh).',
|
|
233
|
+
choices: ['off', 'low', 'medium', 'high', 'xhigh', 'max'],
|
|
234
234
|
default: undefined,
|
|
235
235
|
},
|
|
236
236
|
'thinking-budget': {
|
|
@@ -248,6 +248,11 @@ export const SOLVE_OPTION_DEFINITIONS = {
|
|
|
248
248
|
description: 'Maximum thinking budget for calculating --think level mappings (default: 31999 for Claude Code). Values: off=0, low=max/4, medium=max/2, high=max*3/4, max=max.',
|
|
249
249
|
default: 31999,
|
|
250
250
|
},
|
|
251
|
+
'show-thinking-content': {
|
|
252
|
+
type: 'boolean',
|
|
253
|
+
description: 'Show thinking content in Claude responses. Opus 4.7 omits thinking content by default; this option opts in to receive summarized thinking blocks. Disabled by default. Only affects --tool claude.',
|
|
254
|
+
default: false,
|
|
255
|
+
},
|
|
251
256
|
'prompt-plan-sub-agent': {
|
|
252
257
|
type: 'boolean',
|
|
253
258
|
description: 'Encourage AI to use a planning sub-agent or planning workflow for initial planning. Supported for --tool claude and --tool codex.',
|
package/src/telegram-bot.mjs
CHANGED
|
@@ -651,7 +651,7 @@ bot.command('help', async ctx => {
|
|
|
651
651
|
message += 'š§ *Common Options:*\n';
|
|
652
652
|
message += `⢠\`--model <model>\` or \`-m\` - ${buildModelOptionDescription()}\n`;
|
|
653
653
|
message += '⢠`--base-branch <branch>` or `-b` - Target branch for PR (default: repo default branch)\n';
|
|
654
|
-
message += '⢠`--think <level>` - Thinking level (off/low/medium/high/max) | `--thinking-budget <num>` - Token budget (0-63999)\n';
|
|
654
|
+
message += '⢠`--think <level>` - Thinking level (off/low/medium/high/xhigh/max) | `--thinking-budget <num>` - Token budget (0-63999)\n';
|
|
655
655
|
message += '⢠`--verbose` or `-v` - Verbose output | `--attach-logs` - Attach logs to PR\n';
|
|
656
656
|
message += '\nš” *Tip:* Many more options available. See full documentation for complete list.\n';
|
|
657
657
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { supportsEffortLevel, supportsThinkingBudget } from './config.lib.mjs';
|
|
4
|
+
import { defaultModels, mapModelForTool } from './models/index.mjs';
|
|
5
|
+
|
|
6
|
+
export const THINK_PROMPT_MESSAGES = Object.freeze({
|
|
7
|
+
low: 'Think.',
|
|
8
|
+
medium: 'Think hard.',
|
|
9
|
+
high: 'Think harder.',
|
|
10
|
+
xhigh: 'Ultrathink.',
|
|
11
|
+
max: 'Ultrathink.',
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const isClaudeLikeModel = model => {
|
|
15
|
+
if (!model) return false;
|
|
16
|
+
const normalized = String(model).toLowerCase();
|
|
17
|
+
return normalized === 'opusplan' || normalized.includes('claude') || normalized.startsWith('anthropic/');
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const resolvePromptModelForTool = (tool = 'claude', model) => {
|
|
21
|
+
const selectedModel = model || defaultModels[tool];
|
|
22
|
+
return selectedModel ? mapModelForTool(tool, selectedModel) : null;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const toolSupportsStructuredThinkingBudget = ({ tool = 'claude', claudeVersion, thinkingBudgetClaudeMinimumVersion } = {}) => {
|
|
26
|
+
if (tool === 'claude') {
|
|
27
|
+
return supportsThinkingBudget(claudeVersion || '0.0.0', thinkingBudgetClaudeMinimumVersion || '2.1.12');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Codex maps --think/--thinking-budget to model_reasoning_effort instead of prompt text.
|
|
31
|
+
return tool === 'codex';
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const shouldAddThinkingPromptInstruction = ({ tool = 'claude', argv, claudeVersion } = {}) => {
|
|
35
|
+
const thinkLevel = argv?.think;
|
|
36
|
+
if (!thinkLevel || !THINK_PROMPT_MESSAGES[thinkLevel]) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const resolvedModel = resolvePromptModelForTool(tool, argv?.model);
|
|
41
|
+
if (!isClaudeLikeModel(resolvedModel)) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (supportsEffortLevel(resolvedModel)) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return !toolSupportsStructuredThinkingBudget({
|
|
50
|
+
tool,
|
|
51
|
+
claudeVersion,
|
|
52
|
+
thinkingBudgetClaudeMinimumVersion: argv?.thinkingBudgetClaudeMinimumVersion,
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const getThinkingPromptInstruction = options => {
|
|
57
|
+
if (!shouldAddThinkingPromptInstruction(options)) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
return THINK_PROMPT_MESSAGES[options?.argv?.think];
|
|
61
|
+
};
|