@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
|
@@ -6386,6 +6386,47 @@ class KRChatbot extends i$3 {
|
|
|
6386
6386
|
}
|
|
6387
6387
|
return '~$' + n.toFixed(4);
|
|
6388
6388
|
}
|
|
6389
|
+
_fmtPrice(n) {
|
|
6390
|
+
if (n == null || isNaN(n)) {
|
|
6391
|
+
return '—';
|
|
6392
|
+
}
|
|
6393
|
+
return '$' + n.toFixed(2);
|
|
6394
|
+
}
|
|
6395
|
+
_fmtPriceDetail(n) {
|
|
6396
|
+
if (n == null || isNaN(n)) {
|
|
6397
|
+
return '—';
|
|
6398
|
+
}
|
|
6399
|
+
return '$' + n.toFixed(4);
|
|
6400
|
+
}
|
|
6401
|
+
_getCustomerPriceLabel() {
|
|
6402
|
+
const rate = this._telemetry?.customerPricePerThousandTokens;
|
|
6403
|
+
if (rate == null || isNaN(rate)) {
|
|
6404
|
+
return 'Customer price';
|
|
6405
|
+
}
|
|
6406
|
+
return `Customer price ($${rate}/1K)`;
|
|
6407
|
+
}
|
|
6408
|
+
_getMarkupPriceLabel() {
|
|
6409
|
+
const pct = this._telemetry?.customerMarkupPercent;
|
|
6410
|
+
if (pct == null || isNaN(pct)) {
|
|
6411
|
+
return 'Customer price (markup)';
|
|
6412
|
+
}
|
|
6413
|
+
return `Customer price (${pct}% markup)`;
|
|
6414
|
+
}
|
|
6415
|
+
_getTurnCacheWriteTokens() {
|
|
6416
|
+
return this._iterationLog.reduce((sum, it) => sum + (it.iterationCacheWrite || 0), 0);
|
|
6417
|
+
}
|
|
6418
|
+
_renderMarkupBreakdown(input, output, cacheRead, cacheWrite) {
|
|
6419
|
+
return b `
|
|
6420
|
+
<span class="debug-metrics__key debug-metrics__key--sub">Input</span>
|
|
6421
|
+
<span class="debug-metrics__val debug-metrics__val--sub">${this._fmtPriceDetail(input)}</span>
|
|
6422
|
+
<span class="debug-metrics__key debug-metrics__key--sub">Output</span>
|
|
6423
|
+
<span class="debug-metrics__val debug-metrics__val--sub">${this._fmtPriceDetail(output)}</span>
|
|
6424
|
+
<span class="debug-metrics__key debug-metrics__key--sub">Cache read</span>
|
|
6425
|
+
<span class="debug-metrics__val debug-metrics__val--sub">${this._fmtPriceDetail(cacheRead)}</span>
|
|
6426
|
+
<span class="debug-metrics__key debug-metrics__key--sub">Cache write</span>
|
|
6427
|
+
<span class="debug-metrics__val debug-metrics__val--sub">${this._fmtPriceDetail(cacheWrite)}</span>
|
|
6428
|
+
`;
|
|
6429
|
+
}
|
|
6389
6430
|
/**
|
|
6390
6431
|
* INTERNAL-ONLY debug telemetry panel. Rendered only in the inline variant
|
|
6391
6432
|
* (guarded by the caller) and only when the user has toggled it open. Shows
|
|
@@ -6759,15 +6800,26 @@ class KRChatbot extends i$3 {
|
|
|
6759
6800
|
<div class="debug-section__label">This turn</div>
|
|
6760
6801
|
<div class="debug-metrics">
|
|
6761
6802
|
<span class="debug-metrics__key">Input</span>
|
|
6762
|
-
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnInputTokens)}</span>
|
|
6803
|
+
<span class="debug-metrics__val">${this._fmtTokens(Math.max(0, (this._telemetry.turnInputTokens || 0) - this._getTurnCacheWriteTokens()))}</span>
|
|
6763
6804
|
<span class="debug-metrics__key">Output</span>
|
|
6764
6805
|
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnOutputTokens)}</span>
|
|
6765
6806
|
<span class="debug-metrics__key">Cache read</span>
|
|
6766
6807
|
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnCacheReadTokens)}</span>
|
|
6808
|
+
<span class="debug-metrics__key">Cache write</span>
|
|
6809
|
+
<span class="debug-metrics__val">${this._fmtTokens(this._getTurnCacheWriteTokens())}</span>
|
|
6767
6810
|
<span class="debug-metrics__key">Hit rate</span>
|
|
6768
6811
|
<span class="debug-metrics__val">${this._telemetry.turnHitRate ?? '—'}%</span>
|
|
6812
|
+
<span class="debug-metrics__key">Total tokens</span>
|
|
6813
|
+
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnTotalTokens)}</span>
|
|
6814
|
+
<span class="debug-metrics__key">Reported total</span>
|
|
6815
|
+
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnReportedTotalTokens)}</span>
|
|
6769
6816
|
<span class="debug-metrics__key">Cost</span>
|
|
6770
6817
|
<span class="debug-metrics__val debug-cost">${this._fmtCost(this._telemetry.turnCostUsd)}</span>
|
|
6818
|
+
<span class="debug-metrics__key">${this._getCustomerPriceLabel()}</span>
|
|
6819
|
+
<span class="debug-metrics__val debug-cost">${this._fmtPrice(this._telemetry.turnCustomerUsd)}</span>
|
|
6820
|
+
<span class="debug-metrics__key">${this._getMarkupPriceLabel()}</span>
|
|
6821
|
+
<span class="debug-metrics__val debug-cost">${this._fmtPrice(this._telemetry.turnMarkupCustomerUsd)}</span>
|
|
6822
|
+
${this._renderMarkupBreakdown(this._telemetry.turnMarkupInputUsd, this._telemetry.turnMarkupOutputUsd, this._telemetry.turnMarkupCacheReadUsd, this._telemetry.turnMarkupCacheWriteUsd)}
|
|
6771
6823
|
</div>
|
|
6772
6824
|
</div>
|
|
6773
6825
|
|
|
@@ -6782,8 +6834,15 @@ class KRChatbot extends i$3 {
|
|
|
6782
6834
|
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.conversationCacheReadTokens)}</span>
|
|
6783
6835
|
<span class="debug-metrics__key">Cache write</span>
|
|
6784
6836
|
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.conversationCacheWriteTokens)}</span>
|
|
6837
|
+
<span class="debug-metrics__key">Total tokens</span>
|
|
6838
|
+
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.conversationTotalTokens)}</span>
|
|
6785
6839
|
<span class="debug-metrics__key">Cost so far</span>
|
|
6786
6840
|
<span class="debug-metrics__val debug-cost">${this._fmtCost(this._telemetry.conversationCostUsd)}</span>
|
|
6841
|
+
<span class="debug-metrics__key">${this._getCustomerPriceLabel()} so far</span>
|
|
6842
|
+
<span class="debug-metrics__val debug-cost">${this._fmtPrice(this._telemetry.conversationCustomerUsd)}</span>
|
|
6843
|
+
<span class="debug-metrics__key">${this._getMarkupPriceLabel()} so far</span>
|
|
6844
|
+
<span class="debug-metrics__val debug-cost">${this._fmtPrice(this._telemetry.conversationMarkupCustomerUsd)}</span>
|
|
6845
|
+
${this._renderMarkupBreakdown(this._telemetry.conversationMarkupInputUsd, this._telemetry.conversationMarkupOutputUsd, this._telemetry.conversationMarkupCacheReadUsd, this._telemetry.conversationMarkupCacheWriteUsd)}
|
|
6787
6846
|
</div>
|
|
6788
6847
|
</div>
|
|
6789
6848
|
` : b `
|
|
@@ -6803,7 +6862,11 @@ class KRChatbot extends i$3 {
|
|
|
6803
6862
|
<th>Cache R</th>
|
|
6804
6863
|
<th>Cache W</th>
|
|
6805
6864
|
<th>Hit</th>
|
|
6865
|
+
<th>Total</th>
|
|
6866
|
+
<th>Reported</th>
|
|
6806
6867
|
<th>Cost</th>
|
|
6868
|
+
<th>Price</th>
|
|
6869
|
+
<th>Markup $</th>
|
|
6807
6870
|
<th>Ckpt</th>
|
|
6808
6871
|
</tr>
|
|
6809
6872
|
</thead>
|
|
@@ -6818,7 +6881,11 @@ class KRChatbot extends i$3 {
|
|
|
6818
6881
|
<td>${this._fmtTokens(it.iterationCacheRead)}</td>
|
|
6819
6882
|
<td>${this._fmtTokens(it.iterationCacheWrite)}</td>
|
|
6820
6883
|
<td>${it.iterationHitRate ?? '—'}%</td>
|
|
6884
|
+
<td>${this._fmtTokens(it.iterationTotalTokens)}</td>
|
|
6885
|
+
<td>${this._fmtTokens(it.reportedTotalTokens)}</td>
|
|
6821
6886
|
<td class="debug-cost">${this._fmtCost(it.iterationCostUsd)}</td>
|
|
6887
|
+
<td class="debug-cost">${this._fmtPrice(it.iterationCustomerUsd)}</td>
|
|
6888
|
+
<td class="debug-cost">${this._fmtPrice(it.iterationMarkupCustomerUsd)}</td>
|
|
6822
6889
|
<td>${ckpt ? ckpt.mode : '—'}</td>
|
|
6823
6890
|
</tr>
|
|
6824
6891
|
`;
|
|
@@ -8950,6 +9017,17 @@ KRChatbot.styles = i$6 `
|
|
|
8950
9017
|
font-weight: 600;
|
|
8951
9018
|
}
|
|
8952
9019
|
|
|
9020
|
+
.debug-metrics__key--sub {
|
|
9021
|
+
padding-left: 14px;
|
|
9022
|
+
font-size: 12px;
|
|
9023
|
+
color: rgba(0, 0, 0, 0.65);
|
|
9024
|
+
}
|
|
9025
|
+
|
|
9026
|
+
.debug-metrics__val--sub {
|
|
9027
|
+
font-size: 12px;
|
|
9028
|
+
color: rgba(0, 0, 0, 0.65);
|
|
9029
|
+
}
|
|
9030
|
+
|
|
8953
9031
|
/* Per-iteration table (verbose). The wrapper scrolls horizontally on its own
|
|
8954
9032
|
so a wide table never forces the whole drawer to scroll sideways. */
|
|
8955
9033
|
.debug-iterations-scroll {
|