@link-assistant/hive-mind 1.48.0 → 1.48.1
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/claude.budget-stats.lib.mjs +11 -3
- package/src/github.lib.mjs +6 -8
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -118,15 +118,23 @@ export const displayModelUsage = async (usage, log) => {
|
|
|
118
118
|
|
|
119
119
|
/**
|
|
120
120
|
* Display cost comparison between public pricing and Anthropic's official cost
|
|
121
|
+
* Issue #1557: Show simplified format when costs match, remove USD suffix
|
|
121
122
|
* @param {number|null} publicCost - Public pricing estimate
|
|
122
123
|
* @param {number|null} anthropicCost - Anthropic's official cost
|
|
123
124
|
* @param {Function} log - Logging function
|
|
124
125
|
*/
|
|
125
126
|
export const displayCostComparison = async (publicCost, anthropicCost, log) => {
|
|
127
|
+
const hasPublic = publicCost !== null && publicCost !== undefined;
|
|
128
|
+
const hasAnthropic = anthropicCost !== null && anthropicCost !== undefined;
|
|
129
|
+
// Issue #1557: When both costs match, show simplified format
|
|
130
|
+
if (hasPublic && hasAnthropic && publicCost.toFixed(6) === anthropicCost.toFixed(6)) {
|
|
131
|
+
await log(`\n 💰 Cost: $${anthropicCost.toFixed(6)}`);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
126
134
|
await log('\n 💰 Cost estimation:');
|
|
127
|
-
await log(` Public pricing estimate: ${
|
|
128
|
-
await log(` Calculated by Anthropic: ${
|
|
129
|
-
if (
|
|
135
|
+
await log(` Public pricing estimate: ${hasPublic ? `$${publicCost.toFixed(6)}` : 'unknown'}`);
|
|
136
|
+
await log(` Calculated by Anthropic: ${hasAnthropic ? `$${anthropicCost.toFixed(6)}` : 'unknown'}`);
|
|
137
|
+
if (hasPublic && hasAnthropic) {
|
|
130
138
|
const difference = anthropicCost - publicCost;
|
|
131
139
|
const percentDiff = publicCost > 0 ? (difference / publicCost) * 100 : 0;
|
|
132
140
|
await log(` Difference: $${difference.toFixed(6)} (${percentDiff > 0 ? '+' : ''}${percentDiff.toFixed(2)}%)`);
|
package/src/github.lib.mjs
CHANGED
|
@@ -15,13 +15,15 @@ import { getToolDisplayName, getModelInfoForComment } from './models/index.mjs';
|
|
|
15
15
|
export { getToolDisplayName }; // Re-export for use by other modules
|
|
16
16
|
import { buildBudgetStatsString } from './claude.budget-stats.lib.mjs';
|
|
17
17
|
|
|
18
|
-
/** Build cost estimation string for log comments (Issue #1250) */
|
|
18
|
+
/** Build cost estimation string for log comments (Issue #1250, Issue #1557) */
|
|
19
19
|
const buildCostInfoString = (totalCostUSD, anthropicTotalCostUSD, pricingInfo) => {
|
|
20
20
|
const hasPublic = totalCostUSD !== null && totalCostUSD !== undefined;
|
|
21
21
|
const hasAnthropic = anthropicTotalCostUSD !== null && anthropicTotalCostUSD !== undefined;
|
|
22
22
|
const hasPricing = pricingInfo && (pricingInfo.modelName || pricingInfo.tokenUsage || pricingInfo.isFreeModel || pricingInfo.isOpencodeFreeModel);
|
|
23
23
|
const hasOpencodeCost = pricingInfo?.opencodeCost !== null && pricingInfo?.opencodeCost !== undefined;
|
|
24
24
|
if (!hasPublic && !hasAnthropic && !hasPricing && !hasOpencodeCost) return '';
|
|
25
|
+
// Issue #1557: Simplified display when public and Anthropic costs match
|
|
26
|
+
if (hasPublic && hasAnthropic && totalCostUSD.toFixed(6) === anthropicTotalCostUSD.toFixed(6)) return `\n\n### 💰 Cost: **$${anthropicTotalCostUSD.toFixed(6)}**`;
|
|
25
27
|
let costInfo = '\n\n### 💰 **Cost estimation:**';
|
|
26
28
|
if (pricingInfo?.modelName) {
|
|
27
29
|
costInfo += `\n- Model: ${pricingInfo.modelName}`;
|
|
@@ -57,7 +59,7 @@ const buildCostInfoString = (totalCostUSD, anthropicTotalCostUSD, pricingInfo) =
|
|
|
57
59
|
costInfo += tokenInfo;
|
|
58
60
|
}
|
|
59
61
|
if (hasAnthropic) {
|
|
60
|
-
costInfo += `\n- Calculated by Anthropic: $${anthropicTotalCostUSD.toFixed(6)}
|
|
62
|
+
costInfo += `\n- Calculated by Anthropic: $${anthropicTotalCostUSD.toFixed(6)}`;
|
|
61
63
|
if (hasPublic) {
|
|
62
64
|
const diff = anthropicTotalCostUSD - totalCostUSD;
|
|
63
65
|
const pct = totalCostUSD > 0 ? (diff / totalCostUSD) * 100 : 0;
|
|
@@ -66,12 +68,8 @@ const buildCostInfoString = (totalCostUSD, anthropicTotalCostUSD, pricingInfo) =
|
|
|
66
68
|
}
|
|
67
69
|
return costInfo;
|
|
68
70
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
export const maskGitHubToken = maskToken;
|
|
72
|
-
// Escape ``` in logs for safe markdown embedding (replaces with \`\`\` to prevent code block closure)
|
|
73
|
-
export const escapeCodeBlocksInLog = logContent => logContent.replace(/```/g, '\\`\\`\\`');
|
|
74
|
-
// Helper function to check if a file exists in a GitHub branch
|
|
71
|
+
export const maskGitHubToken = maskToken; // Alias for backward compatibility
|
|
72
|
+
export const escapeCodeBlocksInLog = logContent => logContent.replace(/```/g, '\\`\\`\\`'); // Escape ``` in logs
|
|
75
73
|
export const checkFileInBranch = async (owner, repo, fileName, branchName) => {
|
|
76
74
|
const { $ } = await use('command-stream');
|
|
77
75
|
|