@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
|
@@ -24371,6 +24371,47 @@
|
|
|
24371
24371
|
}
|
|
24372
24372
|
return '~$' + n.toFixed(4);
|
|
24373
24373
|
}
|
|
24374
|
+
_fmtPrice(n) {
|
|
24375
|
+
if (n == null || isNaN(n)) {
|
|
24376
|
+
return '—';
|
|
24377
|
+
}
|
|
24378
|
+
return '$' + n.toFixed(2);
|
|
24379
|
+
}
|
|
24380
|
+
_fmtPriceDetail(n) {
|
|
24381
|
+
if (n == null || isNaN(n)) {
|
|
24382
|
+
return '—';
|
|
24383
|
+
}
|
|
24384
|
+
return '$' + n.toFixed(4);
|
|
24385
|
+
}
|
|
24386
|
+
_getCustomerPriceLabel() {
|
|
24387
|
+
const rate = this._telemetry?.customerPricePerThousandTokens;
|
|
24388
|
+
if (rate == null || isNaN(rate)) {
|
|
24389
|
+
return 'Customer price';
|
|
24390
|
+
}
|
|
24391
|
+
return `Customer price ($${rate}/1K)`;
|
|
24392
|
+
}
|
|
24393
|
+
_getMarkupPriceLabel() {
|
|
24394
|
+
const pct = this._telemetry?.customerMarkupPercent;
|
|
24395
|
+
if (pct == null || isNaN(pct)) {
|
|
24396
|
+
return 'Customer price (markup)';
|
|
24397
|
+
}
|
|
24398
|
+
return `Customer price (${pct}% markup)`;
|
|
24399
|
+
}
|
|
24400
|
+
_getTurnCacheWriteTokens() {
|
|
24401
|
+
return this._iterationLog.reduce((sum, it) => sum + (it.iterationCacheWrite || 0), 0);
|
|
24402
|
+
}
|
|
24403
|
+
_renderMarkupBreakdown(input, output, cacheRead, cacheWrite) {
|
|
24404
|
+
return b `
|
|
24405
|
+
<span class="debug-metrics__key debug-metrics__key--sub">Input</span>
|
|
24406
|
+
<span class="debug-metrics__val debug-metrics__val--sub">${this._fmtPriceDetail(input)}</span>
|
|
24407
|
+
<span class="debug-metrics__key debug-metrics__key--sub">Output</span>
|
|
24408
|
+
<span class="debug-metrics__val debug-metrics__val--sub">${this._fmtPriceDetail(output)}</span>
|
|
24409
|
+
<span class="debug-metrics__key debug-metrics__key--sub">Cache read</span>
|
|
24410
|
+
<span class="debug-metrics__val debug-metrics__val--sub">${this._fmtPriceDetail(cacheRead)}</span>
|
|
24411
|
+
<span class="debug-metrics__key debug-metrics__key--sub">Cache write</span>
|
|
24412
|
+
<span class="debug-metrics__val debug-metrics__val--sub">${this._fmtPriceDetail(cacheWrite)}</span>
|
|
24413
|
+
`;
|
|
24414
|
+
}
|
|
24374
24415
|
/**
|
|
24375
24416
|
* INTERNAL-ONLY debug telemetry panel. Rendered only in the inline variant
|
|
24376
24417
|
* (guarded by the caller) and only when the user has toggled it open. Shows
|
|
@@ -24744,15 +24785,26 @@
|
|
|
24744
24785
|
<div class="debug-section__label">This turn</div>
|
|
24745
24786
|
<div class="debug-metrics">
|
|
24746
24787
|
<span class="debug-metrics__key">Input</span>
|
|
24747
|
-
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnInputTokens)}</span>
|
|
24788
|
+
<span class="debug-metrics__val">${this._fmtTokens(Math.max(0, (this._telemetry.turnInputTokens || 0) - this._getTurnCacheWriteTokens()))}</span>
|
|
24748
24789
|
<span class="debug-metrics__key">Output</span>
|
|
24749
24790
|
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnOutputTokens)}</span>
|
|
24750
24791
|
<span class="debug-metrics__key">Cache read</span>
|
|
24751
24792
|
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnCacheReadTokens)}</span>
|
|
24793
|
+
<span class="debug-metrics__key">Cache write</span>
|
|
24794
|
+
<span class="debug-metrics__val">${this._fmtTokens(this._getTurnCacheWriteTokens())}</span>
|
|
24752
24795
|
<span class="debug-metrics__key">Hit rate</span>
|
|
24753
24796
|
<span class="debug-metrics__val">${this._telemetry.turnHitRate ?? '—'}%</span>
|
|
24797
|
+
<span class="debug-metrics__key">Total tokens</span>
|
|
24798
|
+
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnTotalTokens)}</span>
|
|
24799
|
+
<span class="debug-metrics__key">Reported total</span>
|
|
24800
|
+
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnReportedTotalTokens)}</span>
|
|
24754
24801
|
<span class="debug-metrics__key">Cost</span>
|
|
24755
24802
|
<span class="debug-metrics__val debug-cost">${this._fmtCost(this._telemetry.turnCostUsd)}</span>
|
|
24803
|
+
<span class="debug-metrics__key">${this._getCustomerPriceLabel()}</span>
|
|
24804
|
+
<span class="debug-metrics__val debug-cost">${this._fmtPrice(this._telemetry.turnCustomerUsd)}</span>
|
|
24805
|
+
<span class="debug-metrics__key">${this._getMarkupPriceLabel()}</span>
|
|
24806
|
+
<span class="debug-metrics__val debug-cost">${this._fmtPrice(this._telemetry.turnMarkupCustomerUsd)}</span>
|
|
24807
|
+
${this._renderMarkupBreakdown(this._telemetry.turnMarkupInputUsd, this._telemetry.turnMarkupOutputUsd, this._telemetry.turnMarkupCacheReadUsd, this._telemetry.turnMarkupCacheWriteUsd)}
|
|
24756
24808
|
</div>
|
|
24757
24809
|
</div>
|
|
24758
24810
|
|
|
@@ -24767,8 +24819,15 @@
|
|
|
24767
24819
|
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.conversationCacheReadTokens)}</span>
|
|
24768
24820
|
<span class="debug-metrics__key">Cache write</span>
|
|
24769
24821
|
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.conversationCacheWriteTokens)}</span>
|
|
24822
|
+
<span class="debug-metrics__key">Total tokens</span>
|
|
24823
|
+
<span class="debug-metrics__val">${this._fmtTokens(this._telemetry.conversationTotalTokens)}</span>
|
|
24770
24824
|
<span class="debug-metrics__key">Cost so far</span>
|
|
24771
24825
|
<span class="debug-metrics__val debug-cost">${this._fmtCost(this._telemetry.conversationCostUsd)}</span>
|
|
24826
|
+
<span class="debug-metrics__key">${this._getCustomerPriceLabel()} so far</span>
|
|
24827
|
+
<span class="debug-metrics__val debug-cost">${this._fmtPrice(this._telemetry.conversationCustomerUsd)}</span>
|
|
24828
|
+
<span class="debug-metrics__key">${this._getMarkupPriceLabel()} so far</span>
|
|
24829
|
+
<span class="debug-metrics__val debug-cost">${this._fmtPrice(this._telemetry.conversationMarkupCustomerUsd)}</span>
|
|
24830
|
+
${this._renderMarkupBreakdown(this._telemetry.conversationMarkupInputUsd, this._telemetry.conversationMarkupOutputUsd, this._telemetry.conversationMarkupCacheReadUsd, this._telemetry.conversationMarkupCacheWriteUsd)}
|
|
24772
24831
|
</div>
|
|
24773
24832
|
</div>
|
|
24774
24833
|
` : b `
|
|
@@ -24788,7 +24847,11 @@
|
|
|
24788
24847
|
<th>Cache R</th>
|
|
24789
24848
|
<th>Cache W</th>
|
|
24790
24849
|
<th>Hit</th>
|
|
24850
|
+
<th>Total</th>
|
|
24851
|
+
<th>Reported</th>
|
|
24791
24852
|
<th>Cost</th>
|
|
24853
|
+
<th>Price</th>
|
|
24854
|
+
<th>Markup $</th>
|
|
24792
24855
|
<th>Ckpt</th>
|
|
24793
24856
|
</tr>
|
|
24794
24857
|
</thead>
|
|
@@ -24803,7 +24866,11 @@
|
|
|
24803
24866
|
<td>${this._fmtTokens(it.iterationCacheRead)}</td>
|
|
24804
24867
|
<td>${this._fmtTokens(it.iterationCacheWrite)}</td>
|
|
24805
24868
|
<td>${it.iterationHitRate ?? '—'}%</td>
|
|
24869
|
+
<td>${this._fmtTokens(it.iterationTotalTokens)}</td>
|
|
24870
|
+
<td>${this._fmtTokens(it.reportedTotalTokens)}</td>
|
|
24806
24871
|
<td class="debug-cost">${this._fmtCost(it.iterationCostUsd)}</td>
|
|
24872
|
+
<td class="debug-cost">${this._fmtPrice(it.iterationCustomerUsd)}</td>
|
|
24873
|
+
<td class="debug-cost">${this._fmtPrice(it.iterationMarkupCustomerUsd)}</td>
|
|
24807
24874
|
<td>${ckpt ? ckpt.mode : '—'}</td>
|
|
24808
24875
|
</tr>
|
|
24809
24876
|
`;
|
|
@@ -26935,6 +27002,17 @@
|
|
|
26935
27002
|
font-weight: 600;
|
|
26936
27003
|
}
|
|
26937
27004
|
|
|
27005
|
+
.debug-metrics__key--sub {
|
|
27006
|
+
padding-left: 14px;
|
|
27007
|
+
font-size: 12px;
|
|
27008
|
+
color: rgba(0, 0, 0, 0.65);
|
|
27009
|
+
}
|
|
27010
|
+
|
|
27011
|
+
.debug-metrics__val--sub {
|
|
27012
|
+
font-size: 12px;
|
|
27013
|
+
color: rgba(0, 0, 0, 0.65);
|
|
27014
|
+
}
|
|
27015
|
+
|
|
26938
27016
|
/* Per-iteration table (verbose). The wrapper scrolls horizontally on its own
|
|
26939
27017
|
so a wide table never forces the whole drawer to scroll sideways. */
|
|
26940
27018
|
.debug-iterations-scroll {
|