@link-assistant/hive-mind 1.35.1 → 1.35.2

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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # @link-assistant/hive-mind
2
2
 
3
+ ## 1.35.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 0cfcb6a: Fix CI/CD changelog formatting when multiple PRs merge before a release (Issue #1452). The merge-changesets script now keeps each changeset as a separate file (only harmonizing bump types) instead of merging descriptions into one, so @changesets/cli produces separate bullet items. Also enhances release notes PR detection to find all related PRs via tag-range merge commit lookup.
8
+ - a689f6b: fix: use result JSON modelUsage for accurate multi-model display in GitHub comments
9
+
10
+ When Claude Code uses multiple models (e.g., main model + subagent), the completion
11
+ comment now correctly displays all models instead of just the main model.
12
+
3
13
  ## 1.35.1
4
14
 
5
15
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/hive-mind",
3
- "version": "1.35.1",
3
+ "version": "1.35.2",
4
4
  "description": "AI-powered issue solver and hive mind for collaborative problem solving",
5
5
  "main": "src/hive.mjs",
6
6
  "type": "module",
@@ -848,6 +848,7 @@ export const executeClaudeCommand = async params => {
848
848
  let anthropicTotalCostUSD = null; // Capture Anthropic's official total_cost_usd from result
849
849
  let errorDuringExecution = false; // Issue #1088: Track if error_during_execution subtype occurred
850
850
  let resultSummary = null; // Issue #1263: Capture AI result summary for --attach-solution-summary
851
+ let resultModelUsage = null; // Issue #1454
851
852
  // Create interactive mode handler if enabled
852
853
  let interactiveHandler = null;
853
854
  if (argv.interactiveMode && owner && repo && prNumber) {
@@ -1028,6 +1029,7 @@ export const executeClaudeCommand = async params => {
1028
1029
  resultNumTurns = data.num_turns;
1029
1030
  await log(`šŸ“Š Session num_turns: ${resultNumTurns}`, { verbose: true });
1030
1031
  }
1032
+ if (data.subtype === 'success' && data.modelUsage) resultModelUsage = data.modelUsage; // Issue #1454
1031
1033
  if (data.is_error === true) {
1032
1034
  lastMessage = data.result || JSON.stringify(data);
1033
1035
  const subtype = data.subtype || 'unknown';
@@ -1107,7 +1109,6 @@ export const executeClaudeCommand = async params => {
1107
1109
  if (line.trim() && !line.includes('node:internal')) {
1108
1110
  await log(line, { stream: 'raw' });
1109
1111
  lastMessage = line;
1110
-
1111
1112
  // Issue #1015: Detect terms acceptance prompt (non-JSON "[ACTION REQUIRED]..." message)
1112
1113
  const termsAcceptancePattern = /\[ACTION REQUIRED\].*terms|must run.*claude.*review.*terms/i;
1113
1114
  if (termsAcceptancePattern.test(line)) {
@@ -1182,7 +1183,6 @@ export const executeClaudeCommand = async params => {
1182
1183
  await log(`\nāŒ Command not found (exit code 127) - "${claudePath}" is not installed or not in PATH\n Please ensure Claude CLI is installed: npm install -g @anthropic-ai/claude-code`, { level: 'error' });
1183
1184
  }
1184
1185
  }
1185
-
1186
1186
  // Flush any remaining queued comments from interactive mode
1187
1187
  if (interactiveHandler) {
1188
1188
  try {
@@ -1380,6 +1380,7 @@ export const executeClaudeCommand = async params => {
1380
1380
  anthropicTotalCostUSD, // Pass Anthropic's official total cost
1381
1381
  errorDuringExecution, // Issue #1088: Track if error_during_execution subtype occurred
1382
1382
  resultSummary, // Issue #1263: Include result summary for --attach-solution-summary
1383
+ resultModelUsage, // Issue #1454
1383
1384
  };
1384
1385
  } catch (error) {
1385
1386
  reportError(error, {
@@ -366,21 +366,15 @@ export async function attachLogToGitHub(options) {
366
366
  limitResetTime = null,
367
367
  toolName = 'AI tool',
368
368
  resumeCommand = null,
369
- // Whether auto-resume/auto-restart is enabled (determines if CLI commands should be shown)
370
- // See: https://github.com/link-assistant/hive-mind/issues/1152
371
- isAutoResumeEnabled = false,
369
+ isAutoResumeEnabled = false, // Issue #1152: Whether auto-resume/auto-restart is enabled
372
370
  autoResumeMode = 'resume', // 'resume' or 'restart'
373
- // Session type for differentiating solution draft log comments
374
- // See: https://github.com/link-assistant/hive-mind/issues/1152
375
- sessionType = 'new', // 'new', 'resume', 'auto-resume', 'auto-restart'
376
- // New parameters for agent tool pricing support
377
- publicPricingEstimate = null,
371
+ sessionType = 'new', // Issue #1152: 'new', 'resume', 'auto-resume', 'auto-restart'
372
+ publicPricingEstimate = null, // Agent tool pricing support
378
373
  pricingInfo = null,
379
- // Issue #1088: Track error_during_execution for "Finished with errors" state
380
- errorDuringExecution = false,
381
- // Issue #1225: Model information for PR comments
382
- requestedModel = null, // The --model flag value (e.g., "opus", "sonnet")
383
- tool = null, // The tool used (e.g., "claude", "agent", "codex", "opencode")
374
+ errorDuringExecution = false, // Issue #1088
375
+ requestedModel = null, // Issue #1225: The --model flag value
376
+ tool = null, // The tool used (claude, agent, opencode, codex)
377
+ resultModelUsage = null, // Issue #1454
384
378
  } = options;
385
379
  const targetName = targetType === 'pr' ? 'Pull Request' : 'Issue';
386
380
  const ghCommand = targetType === 'pr' ? 'pr' : 'issue';
@@ -391,15 +385,12 @@ export async function attachLogToGitHub(options) {
391
385
  await log(' āš ļø Log file is empty, skipping upload');
392
386
  return false;
393
387
  }
394
- // Issue #1173: Remove premature size check that blocked large files.
395
- // gh-upload-log can handle files of any size by using repositories for large files.
396
- // For files larger than fileMaxSize, we'll skip inline comment attempt and go directly to gh-upload-log.
388
+ // Issue #1173: gh-upload-log handles large files; skip inline comment for files > fileMaxSize
397
389
  const useLargeFileMode = logStats.size > githubLimits.fileMaxSize;
398
390
  if (useLargeFileMode && verbose) {
399
391
  await log(` šŸ“ Large log file (${Math.round(logStats.size / 1024 / 1024)}MB), will use gh-upload-log`, { verbose: true });
400
392
  }
401
- // Calculate token usage if sessionId and tempDir are provided
402
- // For agent tool, publicPricingEstimate is already provided, so we skip Claude-specific calculation
393
+ // Calculate token usage if sessionId and tempDir are provided (skip for agent tool with pricing)
403
394
  let totalCostUSD = publicPricingEstimate;
404
395
  // Issue #1225: Collect actual model IDs from Claude session JSON output
405
396
  let actualModelIds = null;
@@ -429,6 +420,15 @@ export async function attachLogToGitHub(options) {
429
420
  }
430
421
  }
431
422
  }
423
+ // Issue #1454: Use resultModelUsage from result JSON when it has more models (includes subagent models)
424
+ if (resultModelUsage && typeof resultModelUsage === 'object') {
425
+ const ids = Object.keys(resultModelUsage);
426
+ if (ids.length > 0 && (!actualModelIds || ids.length > actualModelIds.length)) {
427
+ ids.sort((a, b) => (resultModelUsage[b]?.costUSD ?? 0) - (resultModelUsage[a]?.costUSD ?? 0));
428
+ actualModelIds = ids;
429
+ if (verbose) await log(` šŸ¤– Using result JSON modelUsage (${ids.length} models): ${ids.join(', ')}`, { verbose: true });
430
+ }
431
+ }
432
432
  // For agent tool, extract actual model ID from pricingInfo (Issue #1225)
433
433
  if (!actualModelIds && pricingInfo?.modelId) {
434
434
  actualModelIds = [pricingInfo.modelId];
package/src/solve.mjs CHANGED
@@ -864,6 +864,7 @@ try {
864
864
  let pricingInfo = toolResult.pricingInfo; // Used by agent tool for detailed pricing
865
865
  let errorDuringExecution = toolResult.errorDuringExecution || false; // Issue #1088: Track error_during_execution
866
866
  let resultSummary = toolResult.resultSummary || null; // Issue #1263: Capture result summary for --attach-solution-summary
867
+ let resultModelUsage = toolResult.resultModelUsage || null; // Issue #1454: Capture modelUsage from result JSON
867
868
  limitReached = toolResult.limitReached;
868
869
  cleanupContext.limitReached = limitReached;
869
870
 
@@ -938,6 +939,8 @@ try {
938
939
  sessionId,
939
940
  requestedModel: argv.model,
940
941
  tool: argv.tool || 'claude',
942
+ // Issue #1454: Pass resultModelUsage for accurate multi-model display
943
+ resultModelUsage,
941
944
  });
942
945
 
943
946
  if (logUploadSuccess) {
@@ -1004,6 +1007,8 @@ try {
1004
1007
  autoResumeMode: limitContinueMode,
1005
1008
  requestedModel: argv.model,
1006
1009
  tool: argv.tool || 'claude',
1010
+ // Issue #1454: Pass resultModelUsage for accurate multi-model display
1011
+ resultModelUsage,
1007
1012
  });
1008
1013
 
1009
1014
  if (logUploadSuccess) {
@@ -1100,6 +1105,8 @@ try {
1100
1105
  errorMessage: limitReached ? undefined : `${argv.tool.toUpperCase()} execution failed`,
1101
1106
  requestedModel: argv.model,
1102
1107
  tool: argv.tool || 'claude',
1108
+ // Issue #1454: Pass resultModelUsage for accurate multi-model display
1109
+ resultModelUsage,
1103
1110
  });
1104
1111
 
1105
1112
  if (logUploadSuccess) {
@@ -1183,7 +1190,7 @@ try {
1183
1190
  }
1184
1191
 
1185
1192
  // Search for newly created pull requests and comments
1186
- const verifyResult = await verifyResults(owner, repo, branchName, issueNumber, prNumber, prUrl, referenceTime, argv, shouldAttachLogs, shouldRestart, sessionId, tempDir, anthropicTotalCostUSD, publicPricingEstimate, pricingInfo, errorDuringExecution, sessionType);
1193
+ const verifyResult = await verifyResults(owner, repo, branchName, issueNumber, prNumber, prUrl, referenceTime, argv, shouldAttachLogs, shouldRestart, sessionId, tempDir, anthropicTotalCostUSD, publicPricingEstimate, pricingInfo, errorDuringExecution, sessionType, resultModelUsage);
1187
1194
  const logsAlreadyUploaded = verifyResult?.logUploadSuccess || false;
1188
1195
 
1189
1196
  // Issue #1162: Auto-restart when PR title/description still has placeholder content
@@ -1230,7 +1237,7 @@ try {
1230
1237
  await cleanupClaudeFile(tempDir, branchName, null, argv);
1231
1238
 
1232
1239
  // Re-verify results after restart (without auto-restart flag to prevent recursion)
1233
- const reVerifyResult = await verifyResults(owner, repo, branchName, issueNumber, prNumber, prUrl, referenceTime, { ...argv, autoRestartOnNonUpdatedPullRequestDescription: false }, shouldAttachLogs, false, sessionId, tempDir, anthropicTotalCostUSD, publicPricingEstimate, pricingInfo, errorDuringExecution, sessionType);
1240
+ const reVerifyResult = await verifyResults(owner, repo, branchName, issueNumber, prNumber, prUrl, referenceTime, { ...argv, autoRestartOnNonUpdatedPullRequestDescription: false }, shouldAttachLogs, false, sessionId, tempDir, anthropicTotalCostUSD, publicPricingEstimate, pricingInfo, errorDuringExecution, sessionType, resultModelUsage);
1234
1241
 
1235
1242
  if (reVerifyResult?.prTitleHasPlaceholder || reVerifyResult?.prBodyHasPlaceholder) {
1236
1243
  await log('āš ļø PR title/description still not updated after restart');
@@ -1353,6 +1360,8 @@ try {
1353
1360
  anthropicTotalCostUSD,
1354
1361
  requestedModel: argv.model,
1355
1362
  tool: argv.tool || 'claude',
1363
+ // Issue #1454: Pass resultModelUsage for accurate multi-model display
1364
+ resultModelUsage,
1356
1365
  });
1357
1366
 
1358
1367
  if (logUploadSuccess) {
@@ -494,7 +494,7 @@ export const showSessionSummary = async (sessionId, limitReached, argv, issueUrl
494
494
  };
495
495
 
496
496
  // Verify results by searching for new PRs and comments
497
- export const verifyResults = async (owner, repo, branchName, issueNumber, prNumber, prUrl, referenceTime, argv, shouldAttachLogs, shouldRestart = false, sessionId = null, tempDir = null, anthropicTotalCostUSD = null, publicPricingEstimate = null, pricingInfo = null, errorDuringExecution = false, sessionType = 'new') => {
497
+ export const verifyResults = async (owner, repo, branchName, issueNumber, prNumber, prUrl, referenceTime, argv, shouldAttachLogs, shouldRestart = false, sessionId = null, tempDir = null, anthropicTotalCostUSD = null, publicPricingEstimate = null, pricingInfo = null, errorDuringExecution = false, sessionType = 'new', resultModelUsage = null) => {
498
498
  await log('\nšŸ” Searching for created pull requests or comments...');
499
499
 
500
500
  try {
@@ -711,6 +711,8 @@ Fixes ${issueRef}
711
711
  // Issue #1225: Pass model and tool info for PR comments
712
712
  requestedModel: argv.model,
713
713
  tool: argv.tool || 'claude',
714
+ // Issue #1454: Pass resultModelUsage for accurate multi-model display
715
+ resultModelUsage,
714
716
  });
715
717
  }
716
718
 
@@ -793,6 +795,8 @@ Fixes ${issueRef}
793
795
  // Issue #1225: Pass model and tool info for issue comments
794
796
  requestedModel: argv.model,
795
797
  tool: argv.tool || 'claude',
798
+ // Issue #1454: Pass resultModelUsage for accurate multi-model display
799
+ resultModelUsage,
796
800
  });
797
801
  }
798
802