@kodaris/krubble-app-components 1.0.74 → 1.0.76

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.
@@ -6062,7 +6062,7 @@
6062
6062
  // top actions (Attach Files, Browse All Skills) are index 0 and 1, then the
6063
6063
  // filtered skills follow — all navigable as one list.
6064
6064
  if (this._skillMenuOpened) {
6065
- const count = 2 + this._filteredSkills().length;
6065
+ const count = 2 + this._skillResults.length;
6066
6066
  if (e.key === 'ArrowDown') {
6067
6067
  e.preventDefault();
6068
6068
  this._skillHighlighted = (this._skillHighlighted + 1) % count;
@@ -6099,7 +6099,7 @@
6099
6099
  this._handleSkillBrowseOpen();
6100
6100
  return;
6101
6101
  }
6102
- const skill = this._filteredSkills()[index - 2];
6102
+ const skill = this._skillResults[index - 2];
6103
6103
  if (skill) {
6104
6104
  this._handleSkillSelect(skill);
6105
6105
  }
@@ -6121,15 +6121,26 @@
6121
6121
  this._skillRequestId++;
6122
6122
  const requestId = this._skillRequestId;
6123
6123
  const trimmed = query.trim();
6124
- // multi_match with an empty string matches nothing, so an empty query falls
6125
- // back to match_all to show everything.
6124
+ // An empty query matches everything; otherwise substring-match the query
6125
+ // against name/code/description. We use case-insensitive wildcard queries on
6126
+ // the `.raw` keyword subfields so "ord" matches anywhere in "Create Order"
6127
+ // (a plain match/multi_match only matches whole tokens). Escape the wildcard
6128
+ // specials so user input is treated literally, then wrap with `*...*`.
6126
6129
  let must = { match_all: {} };
6127
6130
  if (trimmed) {
6131
+ const pattern = `*${trimmed.replace(/([*?\\])/g, '\\$1')}*`;
6132
+ const value = {
6133
+ value: pattern,
6134
+ case_insensitive: true,
6135
+ };
6128
6136
  must = {
6129
- multi_match: {
6130
- query: trimmed,
6131
- fields: ['name^3', 'description^2', 'instructions'],
6132
- type: 'best_fields',
6137
+ bool: {
6138
+ should: [
6139
+ { wildcard: { 'name.raw': value } },
6140
+ { wildcard: { 'code.raw': value } },
6141
+ { wildcard: { 'description.raw': value } },
6142
+ ],
6143
+ minimum_should_match: 1,
6133
6144
  },
6134
6145
  };
6135
6146
  }
@@ -6158,10 +6169,6 @@
6158
6169
  console.error('kr-chatbot: skill search failed', error);
6159
6170
  });
6160
6171
  }
6161
- /** Skills shown in the `/` menu — the shared results, capped at the first 15. */
6162
- _filteredSkills() {
6163
- return this._skillResults.slice(0, 15);
6164
- }
6165
6172
  /** The `+` button toggles the skill/attachment menu open (showing all skills). */
6166
6173
  _handlePlusClick() {
6167
6174
  if (this._skillMenuOpened) {
@@ -6566,7 +6573,7 @@
6566
6573
  // --- Render ---
6567
6574
  /** The `/` skill menu shown above the composer while typing a slash command. */
6568
6575
  _renderSkillMenu() {
6569
- const skills = this._filteredSkills();
6576
+ const skills = this._skillResults;
6570
6577
  return b `
6571
6578
  <div class="skill-menu">
6572
6579
  <div class="skill-menu__actions">