@kodaris/krubble-app-components 1.0.78 → 1.0.80

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.
@@ -5748,7 +5748,7 @@ let KRChatbot = class KRChatbot extends i$3 {
5748
5748
  /**
5749
5749
  * AI framework UI config flags fetched from `aiFrameworkConfig` on connect.
5750
5750
  * `debugTelemetryEnabled` (same server-side gate as TOKEN_USAGE emission) turns
5751
- * on the debug drawer toggle and the `/test-warning` / `/test-limit` composer
5751
+ * on the debug drawer toggle and the `/test-context-warning` / `/test-context-limit` composer
5752
5752
  * options — known up front, before any message.
5753
5753
  */
5754
5754
  this._aiFrameworkConfig = {};
@@ -6166,11 +6166,16 @@ let KRChatbot = class KRChatbot extends i$3 {
6166
6166
  }
6167
6167
  }
6168
6168
  _handleKeyDown(e) {
6169
- // When the skill menu is open, arrow keys / Enter / Escape drive it. The two
6170
- // top actions (Attach Files, Browse All Skills) are index 0 and 1, then the
6171
- // filtered skills follow — all navigable as one list.
6169
+ // When the skill menu is open, arrow keys / Enter / Escape drive it. The top
6170
+ // actions (Attach Files, Browse All Skills, plus the two debug test triggers
6171
+ // when enabled) come first, then the filtered skills — all one navigable list.
6172
6172
  if (this._skillMenuOpened) {
6173
- const count = 2 + this._skillResults.length;
6173
+ const debugActions = this.variant === 'inline' && this._aiFrameworkConfig.debugTelemetryEnabled === true;
6174
+ let actionCount = 2;
6175
+ if (debugActions) {
6176
+ actionCount = 4;
6177
+ }
6178
+ const count = actionCount + this._skillResults.length;
6174
6179
  if (e.key === 'ArrowDown') {
6175
6180
  e.preventDefault();
6176
6181
  this._skillHighlighted = (this._skillHighlighted + 1) % count;
@@ -6197,8 +6202,13 @@ let KRChatbot = class KRChatbot extends i$3 {
6197
6202
  this._handleSubmit();
6198
6203
  }
6199
6204
  }
6200
- /** Run the skill-menu item at the given flat index (0/1 = actions, then skills). */
6205
+ /** Run the skill-menu item at the given flat index (actions first, then skills). */
6201
6206
  _activateSkillMenuItem(index) {
6207
+ const debugActions = this.variant === 'inline' && this._aiFrameworkConfig.debugTelemetryEnabled === true;
6208
+ let actionCount = 2;
6209
+ if (debugActions) {
6210
+ actionCount = 4;
6211
+ }
6202
6212
  if (index === 0) {
6203
6213
  this._openFilePicker();
6204
6214
  return;
@@ -6207,7 +6217,23 @@ let KRChatbot = class KRChatbot extends i$3 {
6207
6217
  this._handleSkillBrowseOpen();
6208
6218
  return;
6209
6219
  }
6210
- const skill = this._skillResults[index - 2];
6220
+ if (debugActions && index === 2) {
6221
+ this._skillMenuOpened = false;
6222
+ this._send({
6223
+ message: '/test-context-warning',
6224
+ internalFiles: [],
6225
+ });
6226
+ return;
6227
+ }
6228
+ if (debugActions && index === 3) {
6229
+ this._skillMenuOpened = false;
6230
+ this._send({
6231
+ message: '/test-context-limit',
6232
+ internalFiles: [],
6233
+ });
6234
+ return;
6235
+ }
6236
+ const skill = this._skillResults[index - actionCount];
6211
6237
  if (skill) {
6212
6238
  this._handleSkillSelect(skill);
6213
6239
  }
@@ -6547,9 +6573,21 @@ let KRChatbot = class KRChatbot extends i$3 {
6547
6573
  if (submitEvent.defaultPrevented) {
6548
6574
  return;
6549
6575
  }
6576
+ this._send({
6577
+ message: messageText,
6578
+ internalFiles
6579
+ });
6580
+ }
6581
+ /**
6582
+ * Append the user message and stream the response. Split out of `_handleSubmit`
6583
+ * so debug test triggers can send a specific message without going through the
6584
+ * composer input. `_handleSubmit` owns reading/validating the composer and
6585
+ * firing the cancelable `message-submit` event; this owns the send + stream.
6586
+ */
6587
+ _send(params) {
6550
6588
  const userMessage = {
6551
6589
  type: 'user',
6552
- content: messageText,
6590
+ content: params.message,
6553
6591
  };
6554
6592
  this.messages = [...this.messages, userMessage];
6555
6593
  this._inputValue = '';
@@ -6615,9 +6653,9 @@ let KRChatbot = class KRChatbot extends i$3 {
6615
6653
  };
6616
6654
  }
6617
6655
  this.send({
6618
- message: messageText,
6656
+ message: params.message,
6619
6657
  messages: this.messages.slice(0, -1),
6620
- internalFiles,
6658
+ internalFiles: params.internalFiles,
6621
6659
  }).then((response) => {
6622
6660
  if (!response.ok) {
6623
6661
  this._handleStreamError('Request failed: ' + response.status);
@@ -6838,6 +6876,14 @@ let KRChatbot = class KRChatbot extends i$3 {
6838
6876
  /** The `/` skill menu shown above the composer while typing a slash command. */
6839
6877
  _renderSkillMenu() {
6840
6878
  const skills = this._skillResults;
6879
+ // Debug test triggers are extra actions after Attach Files / Browse. The
6880
+ // flat keyboard index counts actions first, then skills, so the skills'
6881
+ // index offset is the number of actions shown.
6882
+ const debugActions = this.variant === 'inline' && this._aiFrameworkConfig.debugTelemetryEnabled === true;
6883
+ let actionCount = 2;
6884
+ if (debugActions) {
6885
+ actionCount = 4;
6886
+ }
6841
6887
  return b `
6842
6888
  <div class="skill-menu">
6843
6889
  <div class="skill-menu__actions">
@@ -6859,6 +6905,26 @@ let KRChatbot = class KRChatbot extends i$3 {
6859
6905
  >
6860
6906
  Browse All Skills
6861
6907
  </button>
6908
+ ${debugActions ? b `
6909
+ <button
6910
+ class=${e({
6911
+ 'skill-menu__action': true,
6912
+ 'skill-menu__item--highlighted': this._skillHighlighted === 2,
6913
+ })}
6914
+ @click=${() => this._activateSkillMenuItem(2)}
6915
+ >
6916
+ Test Context Warning
6917
+ </button>
6918
+ <button
6919
+ class=${e({
6920
+ 'skill-menu__action': true,
6921
+ 'skill-menu__item--highlighted': this._skillHighlighted === 3,
6922
+ })}
6923
+ @click=${() => this._activateSkillMenuItem(3)}
6924
+ >
6925
+ Test Context Limit
6926
+ </button>
6927
+ ` : A}
6862
6928
  </div>
6863
6929
  ${skills.length ? b `
6864
6930
  <ul class="skill-menu__list">
@@ -6867,7 +6933,7 @@ let KRChatbot = class KRChatbot extends i$3 {
6867
6933
  <button
6868
6934
  class=${e({
6869
6935
  'skill-menu__item': true,
6870
- 'skill-menu__item--highlighted': index + 2 === this._skillHighlighted,
6936
+ 'skill-menu__item--highlighted': index + actionCount === this._skillHighlighted,
6871
6937
  })}
6872
6938
  @click=${() => this._handleSkillSelect(skill)}
6873
6939
  >
@@ -7179,7 +7245,7 @@ let KRChatbot = class KRChatbot extends i$3 {
7179
7245
  'panel--opened': this.opened,
7180
7246
  'panel--resizing-debug': this._isDebugResizing,
7181
7247
  })}
7182
- style=${o(this._debugPanelOpen ? { paddingRight: `${this._debugDrawerWidth}px` } : {})}
7248
+ style=${o(isDebugEnabled && this._debugPanelOpen ? { paddingRight: `${this._debugDrawerWidth}px` } : {})}
7183
7249
  @dragenter=${this._handleDragEnter}
7184
7250
  @dragover=${this._handleDragOver}
7185
7251
  @dragleave=${this._handleDragLeave}
@@ -7439,9 +7505,7 @@ let KRChatbot = class KRChatbot extends i$3 {
7439
7505
  </svg>
7440
7506
  </button>
7441
7507
  </div>
7442
- ` : A}
7443
-
7444
- ${this._contextLimitReached ? b `
7508
+ ` : this._contextLimitReached ? b `
7445
7509
  <div class="context-limit" role="alert">
7446
7510
  ${this._contextLimitMessage
7447
7511
  || 'This conversation has reached its limit. Please start a new one to continue.'}
@@ -8027,14 +8091,22 @@ KRChatbot.styles = i$6 `
8027
8091
 
8028
8092
  /* Context warning banner (user-facing, dismissible, non-blocking) */
8029
8093
  .context-warning {
8030
- padding: 8px 16px;
8094
+ /* Match the message text column: 768px cap minus its 32px side padding
8095
+ (704px), and viewport minus that padding on narrower screens. */
8096
+ width: 100%;
8097
+ max-width: 735px;
8098
+ margin: 8px auto 0;
8099
+ padding: 10px 14px;
8100
+ border: 1px solid #fde68a;
8101
+ border-radius: 8px;
8031
8102
  background: #fffbeb;
8032
8103
  color: #92400e;
8033
8104
  font-size: 13px;
8105
+ line-height: 1.4;
8034
8106
  display: flex;
8035
8107
  align-items: center;
8036
8108
  justify-content: space-between;
8037
- gap: 8px;
8109
+ gap: 10px;
8038
8110
  flex-shrink: 0;
8039
8111
  }
8040
8112
 
@@ -8047,6 +8119,11 @@ KRChatbot.styles = i$6 `
8047
8119
  display: flex;
8048
8120
  align-items: center;
8049
8121
  flex-shrink: 0;
8122
+ opacity: 0.7;
8123
+ }
8124
+
8125
+ .context-warning-dismiss:hover {
8126
+ opacity: 1;
8050
8127
  }
8051
8128
 
8052
8129
  .context-warning-dismiss-icon {
@@ -8056,11 +8133,18 @@ KRChatbot.styles = i$6 `
8056
8133
 
8057
8134
  /* Context-limit notice (user-facing, blocking — steers to a new conversation) */
8058
8135
  .context-limit {
8059
- padding: 10px 16px;
8136
+ /* Match the message text column: 768px cap minus its 32px side padding
8137
+ (704px), and viewport minus that padding on narrower screens. */
8138
+ width: 100%;
8139
+ max-width: 735px;
8140
+ margin: 8px auto 0;
8141
+ padding: 10px 14px;
8142
+ border: 1px solid #fecaca;
8143
+ border-radius: 8px;
8060
8144
  background: var(--kr-chatbot-error-bg);
8061
8145
  color: var(--kr-chatbot-error-text);
8062
8146
  font-size: 13px;
8063
- line-height: 1.5;
8147
+ line-height: 1.4;
8064
8148
  flex-shrink: 0;
8065
8149
  }
8066
8150