@kodaris/krubble-app-components 1.0.166 → 1.0.168
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/dist/chatbot.d.ts +26 -1
- package/dist/chatbot.d.ts.map +1 -1
- package/dist/chatbot.js +79 -1
- package/dist/chatbot.js.map +1 -1
- package/dist/krubble-app.bundled.js +79 -1
- package/dist/krubble-app.bundled.js.map +1 -1
- package/dist/krubble-app.bundled.min.js +57 -11
- package/dist/krubble-app.bundled.min.js.map +1 -1
- package/dist/krubble-app.umd.js +79 -1
- package/dist/krubble-app.umd.js.map +1 -1
- package/dist/krubble-app.umd.min.js +57 -11
- package/dist/krubble-app.umd.min.js.map +1 -1
- package/dist/krubble-shell-chatbot.umd.js +79 -1
- package/dist/krubble-shell-chatbot.umd.js.map +1 -1
- package/dist/krubble-shell-chatbot.umd.min.js +215 -169
- package/dist/krubble-shell-chatbot.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/krubble-app.umd.js
CHANGED
|
@@ -6389,6 +6389,47 @@
|
|
|
6389
6389
|
}
|
|
6390
6390
|
return '~$' + n.toFixed(4);
|
|
6391
6391
|
}
|
|
6392
|
+
_fmtPrice(n) {
|
|
6393
|
+
if (n == null || isNaN(n)) {
|
|
6394
|
+
return '—';
|
|
6395
|
+
}
|
|
6396
|
+
return '$' + n.toFixed(2);
|
|
6397
|
+
}
|
|
6398
|
+
_fmtPriceDetail(n) {
|
|
6399
|
+
if (n == null || isNaN(n)) {
|
|
6400
|
+
return '—';
|
|
6401
|
+
}
|
|
6402
|
+
return '$' + n.toFixed(4);
|
|
6403
|
+
}
|
|
6404
|
+
_getCustomerPriceLabel() {
|
|
6405
|
+
const rate = this._telemetry?.customerPricePerThousandTokens;
|
|
6406
|
+
if (rate == null || isNaN(rate)) {
|
|
6407
|
+
return 'Customer price';
|
|
6408
|
+
}
|
|
6409
|
+
return `Customer price ($${rate}/1K)`;
|
|
6410
|
+
}
|
|
6411
|
+
_getMarkupPriceLabel() {
|
|
6412
|
+
const pct = this._telemetry?.customerMarkupPercent;
|
|
6413
|
+
if (pct == null || isNaN(pct)) {
|
|
6414
|
+
return 'Customer price (markup)';
|
|
6415
|
+
}
|
|
6416
|
+
return `Customer price (${pct}% markup)`;
|
|
6417
|
+
}
|
|
6418
|
+
_getTurnCacheWriteTokens() {
|
|
6419
|
+
return this._iterationLog.reduce((sum, it) => sum + (it.iterationCacheWrite || 0), 0);
|
|
6420
|
+
}
|
|
6421
|
+
_renderMarkupBreakdown(input, output, cacheRead, cacheWrite) {
|
|
6422
|
+
return b `
|
|
6423
|
+
<span class="debug-metrics__key debug-metrics__key--sub">Input</span>
|
|
6424
|
+
<span class="debug-metrics__val debug-metrics__val--sub">${this._fmtPriceDetail(input)}</span>
|
|
6425
|
+
<span class="debug-metrics__key debug-metrics__key--sub">Output</span>
|
|
6426
|
+
<span class="debug-metrics__val debug-metrics__val--sub">${this._fmtPriceDetail(output)}</span>
|
|
6427
|
+
<span class="debug-metrics__key debug-metrics__key--sub">Cache read</span>
|
|
6428
|
+
<span class="debug-metrics__val debug-metrics__val--sub">${this._fmtPriceDetail(cacheRead)}</span>
|
|
6429
|
+
<span class="debug-metrics__key debug-metrics__key--sub">Cache write</span>
|
|
6430
|
+
<span class="debug-metrics__val debug-metrics__val--sub">${this._fmtPriceDetail(cacheWrite)}</span>
|
|
6431
|
+
`;
|
|
6432
|
+
}
|
|
6392
6433
|
/**
|
|
6393
6434
|
* INTERNAL-ONLY debug telemetry panel. Rendered only in the inline variant
|
|
6394
6435
|
* (guarded by the caller) and only when the user has toggled it open. Shows
|
|
@@ -6762,15 +6803,26 @@
|
|
|
6762
6803
|
<div class="debug-section__label">This turn</div>
|
|
6763
6804
|
<div class="debug-metrics">
|
|
6764
6805
|
<span class="debug-metrics__key">Input</span>
|
|
6765
|
-
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnInputTokens)}</span>
|
|
6806
|
+
<span class="debug-metrics__val">${this._fmtTokens(Math.max(0, (this._telemetry.turnInputTokens || 0) - this._getTurnCacheWriteTokens()))}</span>
|
|
6766
6807
|
<span class="debug-metrics__key">Output</span>
|
|
6767
6808
|
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnOutputTokens)}</span>
|
|
6768
6809
|
<span class="debug-metrics__key">Cache read</span>
|
|
6769
6810
|
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnCacheReadTokens)}</span>
|
|
6811
|
+
<span class="debug-metrics__key">Cache write</span>
|
|
6812
|
+
<span class="debug-metrics__val">${this._fmtTokens(this._getTurnCacheWriteTokens())}</span>
|
|
6770
6813
|
<span class="debug-metrics__key">Hit rate</span>
|
|
6771
6814
|
<span class="debug-metrics__val">${this._telemetry.turnHitRate ?? '—'}%</span>
|
|
6815
|
+
<span class="debug-metrics__key">Total tokens</span>
|
|
6816
|
+
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnTotalTokens)}</span>
|
|
6817
|
+
<span class="debug-metrics__key">Reported total</span>
|
|
6818
|
+
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnReportedTotalTokens)}</span>
|
|
6772
6819
|
<span class="debug-metrics__key">Cost</span>
|
|
6773
6820
|
<span class="debug-metrics__val debug-cost">${this._fmtCost(this._telemetry.turnCostUsd)}</span>
|
|
6821
|
+
<span class="debug-metrics__key">${this._getCustomerPriceLabel()}</span>
|
|
6822
|
+
<span class="debug-metrics__val debug-cost">${this._fmtPrice(this._telemetry.turnCustomerUsd)}</span>
|
|
6823
|
+
<span class="debug-metrics__key">${this._getMarkupPriceLabel()}</span>
|
|
6824
|
+
<span class="debug-metrics__val debug-cost">${this._fmtPrice(this._telemetry.turnMarkupCustomerUsd)}</span>
|
|
6825
|
+
${this._renderMarkupBreakdown(this._telemetry.turnMarkupInputUsd, this._telemetry.turnMarkupOutputUsd, this._telemetry.turnMarkupCacheReadUsd, this._telemetry.turnMarkupCacheWriteUsd)}
|
|
6774
6826
|
</div>
|
|
6775
6827
|
</div>
|
|
6776
6828
|
|
|
@@ -6785,8 +6837,15 @@
|
|
|
6785
6837
|
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.conversationCacheReadTokens)}</span>
|
|
6786
6838
|
<span class="debug-metrics__key">Cache write</span>
|
|
6787
6839
|
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.conversationCacheWriteTokens)}</span>
|
|
6840
|
+
<span class="debug-metrics__key">Total tokens</span>
|
|
6841
|
+
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.conversationTotalTokens)}</span>
|
|
6788
6842
|
<span class="debug-metrics__key">Cost so far</span>
|
|
6789
6843
|
<span class="debug-metrics__val debug-cost">${this._fmtCost(this._telemetry.conversationCostUsd)}</span>
|
|
6844
|
+
<span class="debug-metrics__key">${this._getCustomerPriceLabel()} so far</span>
|
|
6845
|
+
<span class="debug-metrics__val debug-cost">${this._fmtPrice(this._telemetry.conversationCustomerUsd)}</span>
|
|
6846
|
+
<span class="debug-metrics__key">${this._getMarkupPriceLabel()} so far</span>
|
|
6847
|
+
<span class="debug-metrics__val debug-cost">${this._fmtPrice(this._telemetry.conversationMarkupCustomerUsd)}</span>
|
|
6848
|
+
${this._renderMarkupBreakdown(this._telemetry.conversationMarkupInputUsd, this._telemetry.conversationMarkupOutputUsd, this._telemetry.conversationMarkupCacheReadUsd, this._telemetry.conversationMarkupCacheWriteUsd)}
|
|
6790
6849
|
</div>
|
|
6791
6850
|
</div>
|
|
6792
6851
|
` : b `
|
|
@@ -6806,7 +6865,11 @@
|
|
|
6806
6865
|
<th>Cache R</th>
|
|
6807
6866
|
<th>Cache W</th>
|
|
6808
6867
|
<th>Hit</th>
|
|
6868
|
+
<th>Total</th>
|
|
6869
|
+
<th>Reported</th>
|
|
6809
6870
|
<th>Cost</th>
|
|
6871
|
+
<th>Price</th>
|
|
6872
|
+
<th>Markup $</th>
|
|
6810
6873
|
<th>Ckpt</th>
|
|
6811
6874
|
</tr>
|
|
6812
6875
|
</thead>
|
|
@@ -6821,7 +6884,11 @@
|
|
|
6821
6884
|
<td>${this._fmtTokens(it.iterationCacheRead)}</td>
|
|
6822
6885
|
<td>${this._fmtTokens(it.iterationCacheWrite)}</td>
|
|
6823
6886
|
<td>${it.iterationHitRate ?? '—'}%</td>
|
|
6887
|
+
<td>${this._fmtTokens(it.iterationTotalTokens)}</td>
|
|
6888
|
+
<td>${this._fmtTokens(it.reportedTotalTokens)}</td>
|
|
6824
6889
|
<td class="debug-cost">${this._fmtCost(it.iterationCostUsd)}</td>
|
|
6890
|
+
<td class="debug-cost">${this._fmtPrice(it.iterationCustomerUsd)}</td>
|
|
6891
|
+
<td class="debug-cost">${this._fmtPrice(it.iterationMarkupCustomerUsd)}</td>
|
|
6825
6892
|
<td>${ckpt ? ckpt.mode : '—'}</td>
|
|
6826
6893
|
</tr>
|
|
6827
6894
|
`;
|
|
@@ -8953,6 +9020,17 @@
|
|
|
8953
9020
|
font-weight: 600;
|
|
8954
9021
|
}
|
|
8955
9022
|
|
|
9023
|
+
.debug-metrics__key--sub {
|
|
9024
|
+
padding-left: 14px;
|
|
9025
|
+
font-size: 12px;
|
|
9026
|
+
color: rgba(0, 0, 0, 0.65);
|
|
9027
|
+
}
|
|
9028
|
+
|
|
9029
|
+
.debug-metrics__val--sub {
|
|
9030
|
+
font-size: 12px;
|
|
9031
|
+
color: rgba(0, 0, 0, 0.65);
|
|
9032
|
+
}
|
|
9033
|
+
|
|
8956
9034
|
/* Per-iteration table (verbose). The wrapper scrolls horizontally on its own
|
|
8957
9035
|
so a wide table never forces the whole drawer to scroll sideways. */
|
|
8958
9036
|
.debug-iterations-scroll {
|