@kodaris/krubble-app-components 1.0.165 → 1.0.167

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.
@@ -21659,6 +21659,28 @@
21659
21659
  this._inputValue = payload.message;
21660
21660
  this._handleSubmit();
21661
21661
  }
21662
+ /**
21663
+ * Open the panel and place `payload.message` in the composer, selected, without sending it.
21664
+ *
21665
+ * For a host app that wants to suggest an opening message rather than send one (e.g. a site
21666
+ * editor deep link): Enter sends it as is, typing replaces it. Nothing is persisted beyond the
21667
+ * composer draft state any typed text gets.
21668
+ */
21669
+ draft(payload) {
21670
+ this.open();
21671
+ this._inputValue = payload.message;
21672
+ this._saveState();
21673
+ // Same delay as the open-focus in `updated`: the panel has to finish showing before the
21674
+ // textarea can take focus, and this has to run after that focus so the selection sticks.
21675
+ this.updateComplete.then(() => {
21676
+ setTimeout(() => {
21677
+ if (this._inputEl) {
21678
+ this._inputEl.focus();
21679
+ this._inputEl.select();
21680
+ }
21681
+ }, 200);
21682
+ });
21683
+ }
21662
21684
  // --- Private methods ---
21663
21685
  /**
21664
21686
  * Shows a full-viewport transparent overlay during drag/resize operations.
@@ -24349,6 +24371,19 @@
24349
24371
  }
24350
24372
  return '~$' + n.toFixed(4);
24351
24373
  }
24374
+ _fmtPrice(n) {
24375
+ if (n == null || isNaN(n)) {
24376
+ return '—';
24377
+ }
24378
+ return '$' + n.toFixed(2);
24379
+ }
24380
+ _getCustomerPriceLabel() {
24381
+ const rate = this._telemetry?.customerPricePerThousandTokens;
24382
+ if (rate == null || isNaN(rate)) {
24383
+ return 'Customer price';
24384
+ }
24385
+ return `Customer price ($${rate}/1K)`;
24386
+ }
24352
24387
  /**
24353
24388
  * INTERNAL-ONLY debug telemetry panel. Rendered only in the inline variant
24354
24389
  * (guarded by the caller) and only when the user has toggled it open. Shows
@@ -24729,8 +24764,14 @@
24729
24764
  <span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnCacheReadTokens)}</span>
24730
24765
  <span class="debug-metrics__key">Hit rate</span>
24731
24766
  <span class="debug-metrics__val">${this._telemetry.turnHitRate ?? '—'}%</span>
24767
+ <span class="debug-metrics__key">Total tokens</span>
24768
+ <span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnTotalTokens)}</span>
24769
+ <span class="debug-metrics__key">Reported total</span>
24770
+ <span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnReportedTotalTokens)}</span>
24732
24771
  <span class="debug-metrics__key">Cost</span>
24733
24772
  <span class="debug-metrics__val debug-cost">${this._fmtCost(this._telemetry.turnCostUsd)}</span>
24773
+ <span class="debug-metrics__key">${this._getCustomerPriceLabel()}</span>
24774
+ <span class="debug-metrics__val debug-cost">${this._fmtPrice(this._telemetry.turnCustomerUsd)}</span>
24734
24775
  </div>
24735
24776
  </div>
24736
24777
 
@@ -24745,8 +24786,12 @@
24745
24786
  <span class="debug-metrics__val">${this._fmtTokens(this._telemetry.conversationCacheReadTokens)}</span>
24746
24787
  <span class="debug-metrics__key">Cache write</span>
24747
24788
  <span class="debug-metrics__val">${this._fmtTokens(this._telemetry.conversationCacheWriteTokens)}</span>
24789
+ <span class="debug-metrics__key">Total tokens</span>
24790
+ <span class="debug-metrics__val">${this._fmtTokens(this._telemetry.conversationTotalTokens)}</span>
24748
24791
  <span class="debug-metrics__key">Cost so far</span>
24749
24792
  <span class="debug-metrics__val debug-cost">${this._fmtCost(this._telemetry.conversationCostUsd)}</span>
24793
+ <span class="debug-metrics__key">${this._getCustomerPriceLabel()} so far</span>
24794
+ <span class="debug-metrics__val debug-cost">${this._fmtPrice(this._telemetry.conversationCustomerUsd)}</span>
24750
24795
  </div>
24751
24796
  </div>
24752
24797
  ` : b `
@@ -24766,7 +24811,10 @@
24766
24811
  <th>Cache R</th>
24767
24812
  <th>Cache W</th>
24768
24813
  <th>Hit</th>
24814
+ <th>Total</th>
24815
+ <th>Reported</th>
24769
24816
  <th>Cost</th>
24817
+ <th>Price</th>
24770
24818
  <th>Ckpt</th>
24771
24819
  </tr>
24772
24820
  </thead>
@@ -24781,7 +24829,10 @@
24781
24829
  <td>${this._fmtTokens(it.iterationCacheRead)}</td>
24782
24830
  <td>${this._fmtTokens(it.iterationCacheWrite)}</td>
24783
24831
  <td>${it.iterationHitRate ?? '—'}%</td>
24832
+ <td>${this._fmtTokens(it.iterationTotalTokens)}</td>
24833
+ <td>${this._fmtTokens(it.reportedTotalTokens)}</td>
24784
24834
  <td class="debug-cost">${this._fmtCost(it.iterationCostUsd)}</td>
24835
+ <td class="debug-cost">${this._fmtPrice(it.iterationCustomerUsd)}</td>
24785
24836
  <td>${ckpt ? ckpt.mode : '—'}</td>
24786
24837
  </tr>
24787
24838
  `;