@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.
@@ -5751,7 +5751,7 @@
5751
5751
  /**
5752
5752
  * AI framework UI config flags fetched from `aiFrameworkConfig` on connect.
5753
5753
  * `debugTelemetryEnabled` (same server-side gate as TOKEN_USAGE emission) turns
5754
- * on the debug drawer toggle and the `/test-warning` / `/test-limit` composer
5754
+ * on the debug drawer toggle and the `/test-context-warning` / `/test-context-limit` composer
5755
5755
  * options — known up front, before any message.
5756
5756
  */
5757
5757
  this._aiFrameworkConfig = {};
@@ -6169,11 +6169,16 @@
6169
6169
  }
6170
6170
  }
6171
6171
  _handleKeyDown(e) {
6172
- // When the skill menu is open, arrow keys / Enter / Escape drive it. The two
6173
- // top actions (Attach Files, Browse All Skills) are index 0 and 1, then the
6174
- // filtered skills follow — all navigable as one list.
6172
+ // When the skill menu is open, arrow keys / Enter / Escape drive it. The top
6173
+ // actions (Attach Files, Browse All Skills, plus the two debug test triggers
6174
+ // when enabled) come first, then the filtered skills — all one navigable list.
6175
6175
  if (this._skillMenuOpened) {
6176
- const count = 2 + this._skillResults.length;
6176
+ const debugActions = this.variant === 'inline' && this._aiFrameworkConfig.debugTelemetryEnabled === true;
6177
+ let actionCount = 2;
6178
+ if (debugActions) {
6179
+ actionCount = 4;
6180
+ }
6181
+ const count = actionCount + this._skillResults.length;
6177
6182
  if (e.key === 'ArrowDown') {
6178
6183
  e.preventDefault();
6179
6184
  this._skillHighlighted = (this._skillHighlighted + 1) % count;
@@ -6200,8 +6205,13 @@
6200
6205
  this._handleSubmit();
6201
6206
  }
6202
6207
  }
6203
- /** Run the skill-menu item at the given flat index (0/1 = actions, then skills). */
6208
+ /** Run the skill-menu item at the given flat index (actions first, then skills). */
6204
6209
  _activateSkillMenuItem(index) {
6210
+ const debugActions = this.variant === 'inline' && this._aiFrameworkConfig.debugTelemetryEnabled === true;
6211
+ let actionCount = 2;
6212
+ if (debugActions) {
6213
+ actionCount = 4;
6214
+ }
6205
6215
  if (index === 0) {
6206
6216
  this._openFilePicker();
6207
6217
  return;
@@ -6210,7 +6220,23 @@
6210
6220
  this._handleSkillBrowseOpen();
6211
6221
  return;
6212
6222
  }
6213
- const skill = this._skillResults[index - 2];
6223
+ if (debugActions && index === 2) {
6224
+ this._skillMenuOpened = false;
6225
+ this._send({
6226
+ message: '/test-context-warning',
6227
+ internalFiles: [],
6228
+ });
6229
+ return;
6230
+ }
6231
+ if (debugActions && index === 3) {
6232
+ this._skillMenuOpened = false;
6233
+ this._send({
6234
+ message: '/test-context-limit',
6235
+ internalFiles: [],
6236
+ });
6237
+ return;
6238
+ }
6239
+ const skill = this._skillResults[index - actionCount];
6214
6240
  if (skill) {
6215
6241
  this._handleSkillSelect(skill);
6216
6242
  }
@@ -6550,9 +6576,21 @@
6550
6576
  if (submitEvent.defaultPrevented) {
6551
6577
  return;
6552
6578
  }
6579
+ this._send({
6580
+ message: messageText,
6581
+ internalFiles
6582
+ });
6583
+ }
6584
+ /**
6585
+ * Append the user message and stream the response. Split out of `_handleSubmit`
6586
+ * so debug test triggers can send a specific message without going through the
6587
+ * composer input. `_handleSubmit` owns reading/validating the composer and
6588
+ * firing the cancelable `message-submit` event; this owns the send + stream.
6589
+ */
6590
+ _send(params) {
6553
6591
  const userMessage = {
6554
6592
  type: 'user',
6555
- content: messageText,
6593
+ content: params.message,
6556
6594
  };
6557
6595
  this.messages = [...this.messages, userMessage];
6558
6596
  this._inputValue = '';
@@ -6618,9 +6656,9 @@
6618
6656
  };
6619
6657
  }
6620
6658
  this.send({
6621
- message: messageText,
6659
+ message: params.message,
6622
6660
  messages: this.messages.slice(0, -1),
6623
- internalFiles,
6661
+ internalFiles: params.internalFiles,
6624
6662
  }).then((response) => {
6625
6663
  if (!response.ok) {
6626
6664
  this._handleStreamError('Request failed: ' + response.status);
@@ -6841,6 +6879,14 @@
6841
6879
  /** The `/` skill menu shown above the composer while typing a slash command. */
6842
6880
  _renderSkillMenu() {
6843
6881
  const skills = this._skillResults;
6882
+ // Debug test triggers are extra actions after Attach Files / Browse. The
6883
+ // flat keyboard index counts actions first, then skills, so the skills'
6884
+ // index offset is the number of actions shown.
6885
+ const debugActions = this.variant === 'inline' && this._aiFrameworkConfig.debugTelemetryEnabled === true;
6886
+ let actionCount = 2;
6887
+ if (debugActions) {
6888
+ actionCount = 4;
6889
+ }
6844
6890
  return b `
6845
6891
  <div class="skill-menu">
6846
6892
  <div class="skill-menu__actions">
@@ -6862,6 +6908,26 @@
6862
6908
  >
6863
6909
  Browse All Skills
6864
6910
  </button>
6911
+ ${debugActions ? b `
6912
+ <button
6913
+ class=${e({
6914
+ 'skill-menu__action': true,
6915
+ 'skill-menu__item--highlighted': this._skillHighlighted === 2,
6916
+ })}
6917
+ @click=${() => this._activateSkillMenuItem(2)}
6918
+ >
6919
+ Test Context Warning
6920
+ </button>
6921
+ <button
6922
+ class=${e({
6923
+ 'skill-menu__action': true,
6924
+ 'skill-menu__item--highlighted': this._skillHighlighted === 3,
6925
+ })}
6926
+ @click=${() => this._activateSkillMenuItem(3)}
6927
+ >
6928
+ Test Context Limit
6929
+ </button>
6930
+ ` : A}
6865
6931
  </div>
6866
6932
  ${skills.length ? b `
6867
6933
  <ul class="skill-menu__list">
@@ -6870,7 +6936,7 @@
6870
6936
  <button
6871
6937
  class=${e({
6872
6938
  'skill-menu__item': true,
6873
- 'skill-menu__item--highlighted': index + 2 === this._skillHighlighted,
6939
+ 'skill-menu__item--highlighted': index + actionCount === this._skillHighlighted,
6874
6940
  })}
6875
6941
  @click=${() => this._handleSkillSelect(skill)}
6876
6942
  >
@@ -7182,7 +7248,7 @@
7182
7248
  'panel--opened': this.opened,
7183
7249
  'panel--resizing-debug': this._isDebugResizing,
7184
7250
  })}
7185
- style=${o(this._debugPanelOpen ? { paddingRight: `${this._debugDrawerWidth}px` } : {})}
7251
+ style=${o(isDebugEnabled && this._debugPanelOpen ? { paddingRight: `${this._debugDrawerWidth}px` } : {})}
7186
7252
  @dragenter=${this._handleDragEnter}
7187
7253
  @dragover=${this._handleDragOver}
7188
7254
  @dragleave=${this._handleDragLeave}
@@ -7442,9 +7508,7 @@
7442
7508
  </svg>
7443
7509
  </button>
7444
7510
  </div>
7445
- ` : A}
7446
-
7447
- ${this._contextLimitReached ? b `
7511
+ ` : this._contextLimitReached ? b `
7448
7512
  <div class="context-limit" role="alert">
7449
7513
  ${this._contextLimitMessage
7450
7514
  || 'This conversation has reached its limit. Please start a new one to continue.'}
@@ -8030,14 +8094,22 @@
8030
8094
 
8031
8095
  /* Context warning banner (user-facing, dismissible, non-blocking) */
8032
8096
  .context-warning {
8033
- padding: 8px 16px;
8097
+ /* Match the message text column: 768px cap minus its 32px side padding
8098
+ (704px), and viewport minus that padding on narrower screens. */
8099
+ width: 100%;
8100
+ max-width: 735px;
8101
+ margin: 8px auto 0;
8102
+ padding: 10px 14px;
8103
+ border: 1px solid #fde68a;
8104
+ border-radius: 8px;
8034
8105
  background: #fffbeb;
8035
8106
  color: #92400e;
8036
8107
  font-size: 13px;
8108
+ line-height: 1.4;
8037
8109
  display: flex;
8038
8110
  align-items: center;
8039
8111
  justify-content: space-between;
8040
- gap: 8px;
8112
+ gap: 10px;
8041
8113
  flex-shrink: 0;
8042
8114
  }
8043
8115
 
@@ -8050,6 +8122,11 @@
8050
8122
  display: flex;
8051
8123
  align-items: center;
8052
8124
  flex-shrink: 0;
8125
+ opacity: 0.7;
8126
+ }
8127
+
8128
+ .context-warning-dismiss:hover {
8129
+ opacity: 1;
8053
8130
  }
8054
8131
 
8055
8132
  .context-warning-dismiss-icon {
@@ -8059,11 +8136,18 @@
8059
8136
 
8060
8137
  /* Context-limit notice (user-facing, blocking — steers to a new conversation) */
8061
8138
  .context-limit {
8062
- padding: 10px 16px;
8139
+ /* Match the message text column: 768px cap minus its 32px side padding
8140
+ (704px), and viewport minus that padding on narrower screens. */
8141
+ width: 100%;
8142
+ max-width: 735px;
8143
+ margin: 8px auto 0;
8144
+ padding: 10px 14px;
8145
+ border: 1px solid #fecaca;
8146
+ border-radius: 8px;
8063
8147
  background: var(--kr-chatbot-error-bg);
8064
8148
  color: var(--kr-chatbot-error-text);
8065
8149
  font-size: 13px;
8066
- line-height: 1.5;
8150
+ line-height: 1.4;
8067
8151
  flex-shrink: 0;
8068
8152
  }
8069
8153