@kodaris/krubble-app-components 1.0.80 → 1.0.82
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 +41 -18
- package/dist/chatbot.d.ts.map +1 -1
- package/dist/chatbot.js +196 -105
- package/dist/chatbot.js.map +1 -1
- package/dist/krubble-app.bundled.js +196 -105
- package/dist/krubble-app.bundled.js.map +1 -1
- package/dist/krubble-app.bundled.min.js +45 -76
- package/dist/krubble-app.bundled.min.js.map +1 -1
- package/dist/krubble-app.umd.js +196 -105
- package/dist/krubble-app.umd.js.map +1 -1
- package/dist/krubble-app.umd.min.js +43 -74
- package/dist/krubble-app.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/chatbot.d.ts
CHANGED
|
@@ -234,8 +234,9 @@ export declare class KRChatbot extends LitElement {
|
|
|
234
234
|
* responses are dropped (mirrors the kr-combo-box `_requestId` pattern). Org and
|
|
235
235
|
* global searches run concurrently into separate buffers, so each has its own.
|
|
236
236
|
*/
|
|
237
|
-
private
|
|
237
|
+
private _orgSkillRequestId;
|
|
238
238
|
private _globalSkillRequestId;
|
|
239
|
+
private _invocableSkillRequestId;
|
|
239
240
|
/**
|
|
240
241
|
* Codes of global skills with an in-flight enable/disable request. The `+`
|
|
241
242
|
* button reads this to show a pending state and ignore repeat clicks. Mutated
|
|
@@ -342,20 +343,27 @@ export declare class KRChatbot extends LitElement {
|
|
|
342
343
|
private _isDraggingFile;
|
|
343
344
|
/** Whether the `/` skill menu is open above the composer. */
|
|
344
345
|
private _skillMenuOpened;
|
|
345
|
-
/** Current `/` query (text after the slash), sent to `
|
|
346
|
+
/** Current `/` query (text after the slash), sent to `_searchOrgSkills`. */
|
|
346
347
|
private _skillQuery;
|
|
347
348
|
/**
|
|
348
|
-
* Latest org skill search results (this instance's own skills). Backs the
|
|
349
|
-
*
|
|
349
|
+
* Latest org skill search results (this instance's own skills). Backs the
|
|
350
|
+
* browse dialog's "Your Org" tab only — global skills never appear here.
|
|
350
351
|
*/
|
|
351
|
-
private
|
|
352
|
+
private _orgSkills;
|
|
352
353
|
/**
|
|
353
354
|
* Latest shared-Kodaris (global) skill results, for the browse dialog's
|
|
354
|
-
* "Kodaris" tab. Kept separate from `
|
|
355
|
+
* "Kodaris" tab. Kept separate from `_orgSkills` so switching tabs shows
|
|
355
356
|
* fresh results immediately instead of the other tab's stale list — the browse
|
|
356
357
|
* search fills both buffers at once.
|
|
357
358
|
*/
|
|
358
|
-
private
|
|
359
|
+
private _globalSkills;
|
|
360
|
+
/**
|
|
361
|
+
* Latest results for the `/` composer menu: this instance's own org skills PLUS
|
|
362
|
+
* the global skills installed on it (both are invocable by code). A separate
|
|
363
|
+
* buffer from the two browse-tab lists so merging installed globals into the
|
|
364
|
+
* menu never leaks them into the "Your Org" tab.
|
|
365
|
+
*/
|
|
366
|
+
private _invocableSkills;
|
|
359
367
|
/**
|
|
360
368
|
* AI framework UI config flags fetched from `aiFrameworkConfig` on connect.
|
|
361
369
|
* `debugTelemetryEnabled` (same server-side gate as TOKEN_USAGE emission) turns
|
|
@@ -370,8 +378,8 @@ export declare class KRChatbot extends LitElement {
|
|
|
370
378
|
/** Whether the "Browse all skills" dialog is open. */
|
|
371
379
|
private _skillBrowseOpened;
|
|
372
380
|
/**
|
|
373
|
-
* Active tab in the browse dialog. `org` shows `
|
|
374
|
-
* skills); `kodaris` shows `
|
|
381
|
+
* Active tab in the browse dialog. `org` shows `_orgSkills` (this instance's
|
|
382
|
+
* skills); `kodaris` shows `_globalSkills` (the shared global catalog).
|
|
375
383
|
*/
|
|
376
384
|
private _skillBrowseSource;
|
|
377
385
|
/** Search text in the browse dialog, routed to the active tab's search. */
|
|
@@ -431,7 +439,7 @@ export declare class KRChatbot extends LitElement {
|
|
|
431
439
|
/** Run the skill-menu item at the given flat index (actions first, then skills). */
|
|
432
440
|
private _activateSkillMenuItem;
|
|
433
441
|
/**
|
|
434
|
-
* Search the Kodaris AI skills index and store the results in `
|
|
442
|
+
* Search the Kodaris AI skills index and store the results in `_orgSkills`.
|
|
435
443
|
* The `/` menu and the browse dialog both call this; results are shared since
|
|
436
444
|
* the two are never open at once. Mirrors the backend's own skill search (BM25
|
|
437
445
|
* over name^3/description^2/instructions, active-only) so the menu ranks skills
|
|
@@ -442,9 +450,20 @@ export declare class KRChatbot extends LitElement {
|
|
|
442
450
|
* that arrive out of order. `/aiskills/search` returns a raw OpenSearch response,
|
|
443
451
|
* so we lift each hit's `_source` (already in KRChatbotSkill shape) out.
|
|
444
452
|
*/
|
|
445
|
-
private
|
|
453
|
+
private _searchOrgSkills;
|
|
454
|
+
/**
|
|
455
|
+
* Search skills for the `/` composer menu into `_invocableSkills`: this instance's
|
|
456
|
+
* own org skills PLUS the global skills installed on it, since both are
|
|
457
|
+
* invocable by code. They come from two indexes (the local aiskills search and
|
|
458
|
+
* the registry search filtered client-side to enabled), so we fire both and
|
|
459
|
+
* concat — org skills first, then installed globals. Skill codes are unique
|
|
460
|
+
* across the two, so no dedup is needed. Kept out of `_orgSkills` so
|
|
461
|
+
* installed globals never leak into the browse dialog's "Your Org" tab.
|
|
462
|
+
* (Cross-list relevance ranking is a later concern; for now org skills lead.)
|
|
463
|
+
*/
|
|
464
|
+
private _searchInvocableSkills;
|
|
446
465
|
/**
|
|
447
|
-
* Search the shared Kodaris global-skill registry into `
|
|
466
|
+
* Search the shared Kodaris global-skill registry into `_globalSkills`
|
|
448
467
|
* (the browse dialog's "Kodaris" tab). Unlike `/aiskills/search`,
|
|
449
468
|
* `/aiskills/global/search` returns a digested list
|
|
450
469
|
* (`data: [{ code, name, description, enabled }]`) already in `KRChatbotSkill`
|
|
@@ -512,16 +531,20 @@ export declare class KRChatbot extends LitElement {
|
|
|
512
531
|
/**
|
|
513
532
|
* The card grid of skill search results for the browse dialog. Clicking a card
|
|
514
533
|
* inserts `/code ` into the composer. In the shared-Kodaris (`global`) tab each
|
|
515
|
-
* card also gets a
|
|
516
|
-
*
|
|
534
|
+
* card also gets a footer row with an Enabled toggle that installs/removes the
|
|
535
|
+
* skill on this instance.
|
|
517
536
|
*/
|
|
518
537
|
private _renderSkillGrid;
|
|
538
|
+
/** Keep a click on the card footer from bubbling to the card's insert handler. */
|
|
539
|
+
private _stopFooterClick;
|
|
519
540
|
/**
|
|
520
|
-
* The install affordance on a global skill card: a
|
|
521
|
-
*
|
|
522
|
-
* while the enable/disable request is in flight
|
|
541
|
+
* The install affordance on a global skill card: a footer row with an
|
|
542
|
+
* install/remove button. The button owns its own spinner via KRButton's
|
|
543
|
+
* showLoading()/showError() while the enable/disable request is in flight, so
|
|
544
|
+
* the async call has clear feedback. Clicks are stopped from bubbling so the
|
|
545
|
+
* button never also inserts the skill (the card body does that).
|
|
523
546
|
*/
|
|
524
|
-
private
|
|
547
|
+
private _renderSkillToggle;
|
|
525
548
|
/**
|
|
526
549
|
* Render a user message, highlighting a leading `/skill-code` token (like the
|
|
527
550
|
* way Claude highlights slash commands). The composer only inserts valid skill
|
package/dist/chatbot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatbot.d.ts","sourceRoot":"","sources":["../src/chatbot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAYrD;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,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3B,OAAO,CAAC,4BAA4B;IAIpC,OAAO,CAAC,uBAAuB;IAK/B,OAAO,CAAC,2BAA2B;IAUnC,OAAO,CAAC,2BAA2B,CAYjC;IAEF,OAAO,CAAC,yBAAyB,CAK/B;IAEF,OAAO,CAAC,gBAAgB;IAwHxB,OAAO,CAAC,kBAAkB;IAqB1B,gFAAgF;IAChF,OAAO,CAAC,gBAAgB;IA4ExB,iFAAiF;IACjF,OAAO,CAAC,kBAAkB;IA8B1B;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IA6BxB,kFAAkF;IAClF,OAAO,CAAC,gBAAgB;IAIxB;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB;IAmB1B;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;IAQ1B,8EAA8E;IAC9E,OAAO,CAAC,UAAU;IAOlB,iFAAiF;IACjF,OAAO,CAAC,QAAQ;IAOhB;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAqIhB,MAAM;CA4ahB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,YAAY,EAAE,SAAS,CAAC;KACzB;CACF"}
|
package/dist/chatbot.js
CHANGED
|
@@ -85,8 +85,9 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
85
85
|
* responses are dropped (mirrors the kr-combo-box `_requestId` pattern). Org and
|
|
86
86
|
* global searches run concurrently into separate buffers, so each has its own.
|
|
87
87
|
*/
|
|
88
|
-
this.
|
|
88
|
+
this._orgSkillRequestId = 0;
|
|
89
89
|
this._globalSkillRequestId = 0;
|
|
90
|
+
this._invocableSkillRequestId = 0;
|
|
90
91
|
/**
|
|
91
92
|
* Codes of global skills with an in-flight enable/disable request. The `+`
|
|
92
93
|
* button reads this to show a pending state and ignore repeat clicks. Mutated
|
|
@@ -195,20 +196,27 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
195
196
|
this._isDraggingFile = false;
|
|
196
197
|
/** Whether the `/` skill menu is open above the composer. */
|
|
197
198
|
this._skillMenuOpened = false;
|
|
198
|
-
/** Current `/` query (text after the slash), sent to `
|
|
199
|
+
/** Current `/` query (text after the slash), sent to `_searchOrgSkills`. */
|
|
199
200
|
this._skillQuery = '';
|
|
200
201
|
/**
|
|
201
|
-
* Latest org skill search results (this instance's own skills). Backs the
|
|
202
|
-
*
|
|
202
|
+
* Latest org skill search results (this instance's own skills). Backs the
|
|
203
|
+
* browse dialog's "Your Org" tab only — global skills never appear here.
|
|
203
204
|
*/
|
|
204
|
-
this.
|
|
205
|
+
this._orgSkills = [];
|
|
205
206
|
/**
|
|
206
207
|
* Latest shared-Kodaris (global) skill results, for the browse dialog's
|
|
207
|
-
* "Kodaris" tab. Kept separate from `
|
|
208
|
+
* "Kodaris" tab. Kept separate from `_orgSkills` so switching tabs shows
|
|
208
209
|
* fresh results immediately instead of the other tab's stale list — the browse
|
|
209
210
|
* search fills both buffers at once.
|
|
210
211
|
*/
|
|
211
|
-
this.
|
|
212
|
+
this._globalSkills = [];
|
|
213
|
+
/**
|
|
214
|
+
* Latest results for the `/` composer menu: this instance's own org skills PLUS
|
|
215
|
+
* the global skills installed on it (both are invocable by code). A separate
|
|
216
|
+
* buffer from the two browse-tab lists so merging installed globals into the
|
|
217
|
+
* menu never leaks them into the "Your Org" tab.
|
|
218
|
+
*/
|
|
219
|
+
this._invocableSkills = [];
|
|
212
220
|
/**
|
|
213
221
|
* AI framework UI config flags fetched from `aiFrameworkConfig` on connect.
|
|
214
222
|
* `debugTelemetryEnabled` (same server-side gate as TOKEN_USAGE emission) turns
|
|
@@ -223,8 +231,8 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
223
231
|
/** Whether the "Browse all skills" dialog is open. */
|
|
224
232
|
this._skillBrowseOpened = false;
|
|
225
233
|
/**
|
|
226
|
-
* Active tab in the browse dialog. `org` shows `
|
|
227
|
-
* skills); `kodaris` shows `
|
|
234
|
+
* Active tab in the browse dialog. `org` shows `_orgSkills` (this instance's
|
|
235
|
+
* skills); `kodaris` shows `_globalSkills` (the shared global catalog).
|
|
228
236
|
*/
|
|
229
237
|
this._skillBrowseSource = 'org';
|
|
230
238
|
/** Search text in the browse dialog, routed to the active tab's search. */
|
|
@@ -617,13 +625,14 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
617
625
|
textarea.style.height = Math.min(textarea.scrollHeight, 120) + 'px';
|
|
618
626
|
// Open the skill menu while the message is a `/` command being typed (a
|
|
619
627
|
// leading slash with no space yet). The text after the slash is the search
|
|
620
|
-
// query, run server-side via `
|
|
628
|
+
// query, run server-side via `_searchInvocableSkills`.
|
|
629
|
+
// (org skills + installed globals — everything invocable by /code)
|
|
621
630
|
const slashMatch = this._inputValue.match(/^\/(\S*)$/);
|
|
622
631
|
if (slashMatch) {
|
|
623
632
|
this._skillMenuOpened = true;
|
|
624
633
|
this._skillQuery = slashMatch[1];
|
|
625
634
|
this._skillHighlighted = 0;
|
|
626
|
-
this.
|
|
635
|
+
this._searchInvocableSkills(this._skillQuery);
|
|
627
636
|
}
|
|
628
637
|
else {
|
|
629
638
|
this._skillMenuOpened = false;
|
|
@@ -639,7 +648,7 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
639
648
|
if (debugActions) {
|
|
640
649
|
actionCount = 4;
|
|
641
650
|
}
|
|
642
|
-
const count = actionCount + this.
|
|
651
|
+
const count = actionCount + this._invocableSkills.length;
|
|
643
652
|
if (e.key === 'ArrowDown') {
|
|
644
653
|
e.preventDefault();
|
|
645
654
|
this._skillHighlighted = (this._skillHighlighted + 1) % count;
|
|
@@ -697,14 +706,14 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
697
706
|
});
|
|
698
707
|
return;
|
|
699
708
|
}
|
|
700
|
-
const skill = this.
|
|
709
|
+
const skill = this._invocableSkills[index - actionCount];
|
|
701
710
|
if (skill) {
|
|
702
711
|
this._handleSkillSelect(skill);
|
|
703
712
|
}
|
|
704
713
|
}
|
|
705
714
|
// --- Skills ---
|
|
706
715
|
/**
|
|
707
|
-
* Search the Kodaris AI skills index and store the results in `
|
|
716
|
+
* Search the Kodaris AI skills index and store the results in `_orgSkills`.
|
|
708
717
|
* The `/` menu and the browse dialog both call this; results are shared since
|
|
709
718
|
* the two are never open at once. Mirrors the backend's own skill search (BM25
|
|
710
719
|
* over name^3/description^2/instructions, active-only) so the menu ranks skills
|
|
@@ -715,9 +724,9 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
715
724
|
* that arrive out of order. `/aiskills/search` returns a raw OpenSearch response,
|
|
716
725
|
* so we lift each hit's `_source` (already in KRChatbotSkill shape) out.
|
|
717
726
|
*/
|
|
718
|
-
|
|
719
|
-
this.
|
|
720
|
-
const requestId = this.
|
|
727
|
+
_searchOrgSkills(query) {
|
|
728
|
+
this._orgSkillRequestId++;
|
|
729
|
+
const requestId = this._orgSkillRequestId;
|
|
721
730
|
const trimmed = query.trim();
|
|
722
731
|
// An empty query matches everything; otherwise substring-match the query
|
|
723
732
|
// against name/code/description. We use case-insensitive wildcard queries on
|
|
@@ -767,6 +776,11 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
767
776
|
bool: {
|
|
768
777
|
must: [must],
|
|
769
778
|
filter: [{ term: { active: true } }],
|
|
779
|
+
// The "Your Org" tab lists only this instance's own skills. Globally-
|
|
780
|
+
// published skills belong to the "Kodaris" tab (fed by the registry),
|
|
781
|
+
// so exclude them here. Documents without the field aren't matched by
|
|
782
|
+
// the term, so ordinary org skills are kept.
|
|
783
|
+
must_not: [{ term: { globalPublished: true } }],
|
|
770
784
|
},
|
|
771
785
|
},
|
|
772
786
|
},
|
|
@@ -774,17 +788,106 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
774
788
|
.then((r) => r.json())
|
|
775
789
|
.then((res) => {
|
|
776
790
|
// Ignore a stale response superseded by a newer search.
|
|
777
|
-
if (requestId !== this.
|
|
791
|
+
if (requestId !== this._orgSkillRequestId) {
|
|
778
792
|
return;
|
|
779
793
|
}
|
|
780
|
-
this.
|
|
794
|
+
this._orgSkills = (res?.data?.hits?.hits || []).map((hit) => hit._source);
|
|
781
795
|
})
|
|
782
796
|
.catch((error) => {
|
|
783
797
|
console.error('kr-chatbot: skill search failed', error);
|
|
784
798
|
});
|
|
785
799
|
}
|
|
786
800
|
/**
|
|
787
|
-
* Search the
|
|
801
|
+
* Search skills for the `/` composer menu into `_invocableSkills`: this instance's
|
|
802
|
+
* own org skills PLUS the global skills installed on it, since both are
|
|
803
|
+
* invocable by code. They come from two indexes (the local aiskills search and
|
|
804
|
+
* the registry search filtered client-side to enabled), so we fire both and
|
|
805
|
+
* concat — org skills first, then installed globals. Skill codes are unique
|
|
806
|
+
* across the two, so no dedup is needed. Kept out of `_orgSkills` so
|
|
807
|
+
* installed globals never leak into the browse dialog's "Your Org" tab.
|
|
808
|
+
* (Cross-list relevance ranking is a later concern; for now org skills lead.)
|
|
809
|
+
*/
|
|
810
|
+
_searchInvocableSkills(query) {
|
|
811
|
+
this._invocableSkillRequestId++;
|
|
812
|
+
const requestId = this._invocableSkillRequestId;
|
|
813
|
+
// Same wildcard matching as _searchOrgSkills (see there for the rationale).
|
|
814
|
+
let must = { match_all: {} };
|
|
815
|
+
if (query.trim()) {
|
|
816
|
+
must = {
|
|
817
|
+
bool: {
|
|
818
|
+
should: [
|
|
819
|
+
{
|
|
820
|
+
wildcard: {
|
|
821
|
+
'name.raw': {
|
|
822
|
+
value: `*${query.trim().replace(/([*?\\])/g, '\\$1')}*`,
|
|
823
|
+
case_insensitive: true,
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
wildcard: {
|
|
829
|
+
'code.raw': {
|
|
830
|
+
value: `*${query.trim().replace(/([*?\\])/g, '\\$1')}*`,
|
|
831
|
+
case_insensitive: true,
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
wildcard: {
|
|
837
|
+
'description.raw': {
|
|
838
|
+
value: `*${query.trim().replace(/([*?\\])/g, '\\$1')}*`,
|
|
839
|
+
case_insensitive: true,
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
},
|
|
843
|
+
],
|
|
844
|
+
minimum_should_match: 1,
|
|
845
|
+
},
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
// Org skills — this instance's own catalog (globalPublished excluded).
|
|
849
|
+
const orgSearch = KRHttp.fetch({
|
|
850
|
+
url: '/api/system/opensearch/aiskills/search',
|
|
851
|
+
method: 'POST',
|
|
852
|
+
body: {
|
|
853
|
+
size: 100,
|
|
854
|
+
query: {
|
|
855
|
+
bool: {
|
|
856
|
+
must: [must],
|
|
857
|
+
filter: [{ term: { active: true } }],
|
|
858
|
+
must_not: [{ term: { globalPublished: true } }],
|
|
859
|
+
},
|
|
860
|
+
},
|
|
861
|
+
},
|
|
862
|
+
})
|
|
863
|
+
.then((r) => r.json())
|
|
864
|
+
.then((res) => (res?.data?.hits?.hits || []).map((hit) => hit._source))
|
|
865
|
+
.catch((error) => {
|
|
866
|
+
console.error('kr-chatbot: invocable skill search failed', error);
|
|
867
|
+
return [];
|
|
868
|
+
});
|
|
869
|
+
// Installed globals — the registry catalog, kept only where enabled=true.
|
|
870
|
+
const globalSearch = KRHttp.fetch({
|
|
871
|
+
url: '/api/system/opensearch/aiskills/global/search',
|
|
872
|
+
method: 'POST',
|
|
873
|
+
body: { query: query.trim() },
|
|
874
|
+
})
|
|
875
|
+
.then((r) => r.json())
|
|
876
|
+
.then((res) => (res?.data || []).filter((s) => !!s.enabled))
|
|
877
|
+
.catch((error) => {
|
|
878
|
+
console.error('kr-chatbot: installed global skill search failed', error);
|
|
879
|
+
return [];
|
|
880
|
+
});
|
|
881
|
+
Promise.all([orgSearch, globalSearch]).then(([orgSkills, globalSkills]) => {
|
|
882
|
+
// Ignore a stale response superseded by a newer search.
|
|
883
|
+
if (requestId !== this._invocableSkillRequestId) {
|
|
884
|
+
return;
|
|
885
|
+
}
|
|
886
|
+
this._invocableSkills = [...orgSkills, ...globalSkills];
|
|
887
|
+
});
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Search the shared Kodaris global-skill registry into `_globalSkills`
|
|
788
891
|
* (the browse dialog's "Kodaris" tab). Unlike `/aiskills/search`,
|
|
789
892
|
* `/aiskills/global/search` returns a digested list
|
|
790
893
|
* (`data: [{ code, name, description, enabled }]`) already in `KRChatbotSkill`
|
|
@@ -805,7 +908,7 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
805
908
|
if (requestId !== this._globalSkillRequestId) {
|
|
806
909
|
return;
|
|
807
910
|
}
|
|
808
|
-
this.
|
|
911
|
+
this._globalSkills = (res?.data || []);
|
|
809
912
|
})
|
|
810
913
|
.catch((error) => {
|
|
811
914
|
console.error('kr-chatbot: global skill search failed', error);
|
|
@@ -817,13 +920,16 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
817
920
|
* matching card. Ignores clicks while a request for the same code is pending.
|
|
818
921
|
*/
|
|
819
922
|
_handleGlobalSkillEnable(skill, e) {
|
|
820
|
-
// The card body inserts the skill; the
|
|
923
|
+
// The card body inserts the skill; the install button must not also do that.
|
|
821
924
|
e.stopPropagation();
|
|
822
925
|
if (this._globalSkillPending.has(skill.code)) {
|
|
823
926
|
return;
|
|
824
927
|
}
|
|
928
|
+
// Drive the clicked button's own spinner (KRButton disables itself while
|
|
929
|
+
// loading, so a second click can't fire until the request settles).
|
|
930
|
+
const btn = e.currentTarget;
|
|
825
931
|
this._globalSkillPending.add(skill.code);
|
|
826
|
-
|
|
932
|
+
btn?.showLoading();
|
|
827
933
|
KRHttp.fetch({
|
|
828
934
|
url: `/api/system/opensearch/aiskills/global/${encodeURIComponent(skill.code)}/enabled`,
|
|
829
935
|
method: 'POST',
|
|
@@ -831,16 +937,18 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
831
937
|
})
|
|
832
938
|
.then((r) => r.json())
|
|
833
939
|
.then((res) => {
|
|
834
|
-
// Reflect the server's returned flag on the card.
|
|
940
|
+
// Reflect the server's returned flag on the card. The button label/style
|
|
941
|
+
// re-render from skill.enabled; reset() clears the spinner to idle.
|
|
835
942
|
skill.enabled = res?.data?.enabled;
|
|
943
|
+
btn?.reset();
|
|
836
944
|
this.requestUpdate();
|
|
837
945
|
})
|
|
838
946
|
.catch((error) => {
|
|
839
947
|
console.error('kr-chatbot: global skill enable failed', error);
|
|
948
|
+
btn?.showError('Error');
|
|
840
949
|
})
|
|
841
950
|
.finally(() => {
|
|
842
951
|
this._globalSkillPending.delete(skill.code);
|
|
843
|
-
this.requestUpdate();
|
|
844
952
|
});
|
|
845
953
|
}
|
|
846
954
|
/** The `+` button toggles the skill/attachment menu open (showing all skills). */
|
|
@@ -852,10 +960,17 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
852
960
|
this._skillQuery = '';
|
|
853
961
|
this._skillHighlighted = 0;
|
|
854
962
|
this._skillMenuOpened = true;
|
|
855
|
-
this.
|
|
963
|
+
this._searchInvocableSkills('');
|
|
856
964
|
}
|
|
857
965
|
/** Insert `/code ` into the composer and focus it, ready for the message. */
|
|
858
966
|
_handleSkillSelect(skill) {
|
|
967
|
+
// A global skill must be installed before it can be chosen — inserting /code
|
|
968
|
+
// for one not enabled on this instance would just fail. `enabled` is only set
|
|
969
|
+
// on global skills (false = not installed); org skills leave it undefined and
|
|
970
|
+
// are always selectable. So an uninstalled global card click does nothing.
|
|
971
|
+
if (skill.enabled === false) {
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
859
974
|
this._inputValue = `/${skill.code} `;
|
|
860
975
|
this._saveState();
|
|
861
976
|
this._skillMenuOpened = false;
|
|
@@ -885,7 +1000,7 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
885
1000
|
this._skillBrowseQuery = '';
|
|
886
1001
|
this._skillBrowseOpened = true;
|
|
887
1002
|
// Fill both tabs up front so switching between them is instant, not stale.
|
|
888
|
-
this.
|
|
1003
|
+
this._searchOrgSkills('');
|
|
889
1004
|
this._searchGlobalSkills('');
|
|
890
1005
|
}
|
|
891
1006
|
_handleSkillBrowseClose() {
|
|
@@ -894,7 +1009,7 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
894
1009
|
_handleSkillBrowseSearch(e) {
|
|
895
1010
|
this._skillBrowseQuery = e.target.value;
|
|
896
1011
|
// Filter both catalogs so whichever tab the user switches to is already current.
|
|
897
|
-
this.
|
|
1012
|
+
this._searchOrgSkills(this._skillBrowseQuery);
|
|
898
1013
|
this._searchGlobalSkills(this._skillBrowseQuery);
|
|
899
1014
|
}
|
|
900
1015
|
_handleSkillBrowseTabChange(e) {
|
|
@@ -1339,7 +1454,7 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
1339
1454
|
// --- Render ---
|
|
1340
1455
|
/** The `/` skill menu shown above the composer while typing a slash command. */
|
|
1341
1456
|
_renderSkillMenu() {
|
|
1342
|
-
const skills = this.
|
|
1457
|
+
const skills = this._invocableSkills;
|
|
1343
1458
|
// Debug test triggers are extra actions after Attach Files / Browse. The
|
|
1344
1459
|
// flat keyboard index counts actions first, then skills, so the skills'
|
|
1345
1460
|
// index offset is the number of actions shown.
|
|
@@ -1446,13 +1561,13 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
1446
1561
|
/**
|
|
1447
1562
|
* The card grid of skill search results for the browse dialog. Clicking a card
|
|
1448
1563
|
* inserts `/code ` into the composer. In the shared-Kodaris (`global`) tab each
|
|
1449
|
-
* card also gets a
|
|
1450
|
-
*
|
|
1564
|
+
* card also gets a footer row with an Enabled toggle that installs/removes the
|
|
1565
|
+
* skill on this instance.
|
|
1451
1566
|
*/
|
|
1452
1567
|
_renderSkillGrid(global = false) {
|
|
1453
|
-
let skills = this.
|
|
1568
|
+
let skills = this._orgSkills;
|
|
1454
1569
|
if (global) {
|
|
1455
|
-
skills = this.
|
|
1570
|
+
skills = this._globalSkills;
|
|
1456
1571
|
}
|
|
1457
1572
|
if (!skills.length) {
|
|
1458
1573
|
return nothing;
|
|
@@ -1471,44 +1586,39 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
1471
1586
|
${skill.description ? html `
|
|
1472
1587
|
<span class="skill-card__desc">${skill.description}</span>
|
|
1473
1588
|
` : nothing}
|
|
1474
|
-
${global ? this.
|
|
1589
|
+
${global ? this._renderSkillToggle(skill) : nothing}
|
|
1475
1590
|
</div>
|
|
1476
1591
|
`)}
|
|
1477
1592
|
</div>
|
|
1478
1593
|
`;
|
|
1479
1594
|
}
|
|
1595
|
+
/** Keep a click on the card footer from bubbling to the card's insert handler. */
|
|
1596
|
+
_stopFooterClick(e) {
|
|
1597
|
+
e.stopPropagation();
|
|
1598
|
+
}
|
|
1480
1599
|
/**
|
|
1481
|
-
* The install affordance on a global skill card: a
|
|
1482
|
-
*
|
|
1483
|
-
* while the enable/disable request is in flight
|
|
1600
|
+
* The install affordance on a global skill card: a footer row with an
|
|
1601
|
+
* install/remove button. The button owns its own spinner via KRButton's
|
|
1602
|
+
* showLoading()/showError() while the enable/disable request is in flight, so
|
|
1603
|
+
* the async call has clear feedback. Clicks are stopped from bubbling so the
|
|
1604
|
+
* button never also inserts the skill (the card body does that).
|
|
1484
1605
|
*/
|
|
1485
|
-
|
|
1606
|
+
_renderSkillToggle(skill) {
|
|
1607
|
+
const on = !!skill.enabled;
|
|
1486
1608
|
return html `
|
|
1487
|
-
<
|
|
1488
|
-
class
|
|
1489
|
-
|
|
1490
|
-
'skill-card__install--installed': !!skill.enabled,
|
|
1491
|
-
})}
|
|
1492
|
-
?disabled=${this._globalSkillPending.has(skill.code)}
|
|
1493
|
-
title=${!!skill.enabled ? 'Installed — click to remove' : 'Install this skill'}
|
|
1494
|
-
aria-label=${!!skill.enabled ? 'Remove skill' : 'Install skill'}
|
|
1495
|
-
@click=${(e) => this._handleGlobalSkillEnable(skill, e)}
|
|
1609
|
+
<div
|
|
1610
|
+
class="skill-card__footer"
|
|
1611
|
+
@click=${this._stopFooterClick}
|
|
1496
1612
|
>
|
|
1497
|
-
<
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
>
|
|
1505
|
-
|
|
1506
|
-
stroke-linecap="round"
|
|
1507
|
-
stroke-linejoin="round"
|
|
1508
|
-
d=${!!skill.enabled ? 'm4.5 12.75 6 6 9-13.5' : 'M12 4.5v15m7.5-7.5h-15'}
|
|
1509
|
-
/>
|
|
1510
|
-
</svg>
|
|
1511
|
-
</button>
|
|
1613
|
+
<span class="skill-card__price">Free</span>
|
|
1614
|
+
<kr-button
|
|
1615
|
+
class="skill-card__install-btn"
|
|
1616
|
+
size="small"
|
|
1617
|
+
variant=${on ? 'outline' : 'flat'}
|
|
1618
|
+
color=${on ? 'secondary' : 'primary'}
|
|
1619
|
+
@click=${(e) => this._handleGlobalSkillEnable(skill, e)}
|
|
1620
|
+
>${on ? 'Uninstall' : 'Install'}</kr-button>
|
|
1621
|
+
</div>
|
|
1512
1622
|
`;
|
|
1513
1623
|
}
|
|
1514
1624
|
/**
|
|
@@ -3136,7 +3246,7 @@ KRChatbot.styles = css `
|
|
|
3136
3246
|
height: 100%;
|
|
3137
3247
|
overflow-y: auto;
|
|
3138
3248
|
display: grid;
|
|
3139
|
-
grid-template-columns: repeat(
|
|
3249
|
+
grid-template-columns: repeat(2, 1fr);
|
|
3140
3250
|
grid-auto-rows: min-content;
|
|
3141
3251
|
align-content: start;
|
|
3142
3252
|
gap: 12px;
|
|
@@ -3164,53 +3274,31 @@ KRChatbot.styles = css `
|
|
|
3164
3274
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
|
3165
3275
|
}
|
|
3166
3276
|
|
|
3167
|
-
/*
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
display: inline-flex;
|
|
3277
|
+
/* Footer row on global skill cards: install button on the left, price on the
|
|
3278
|
+
right. margin-top:auto pins it to the bottom so cards in a row align their
|
|
3279
|
+
footers regardless of description length. Negative horizontal margins
|
|
3280
|
+
(matching the card's 14px padding) pull the top border out to the full
|
|
3281
|
+
card width; the content is re-padded horizontally to stay inset. */
|
|
3282
|
+
.skill-card__footer {
|
|
3283
|
+
display: flex;
|
|
3175
3284
|
align-items: center;
|
|
3176
|
-
justify-content:
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
color: #374151;
|
|
3184
|
-
cursor: pointer;
|
|
3185
|
-
transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
|
|
3186
|
-
}
|
|
3187
|
-
|
|
3188
|
-
.skill-card__install:hover:not(:disabled) {
|
|
3189
|
-
border-color: var(--kr-chatbot-primary);
|
|
3190
|
-
color: var(--kr-chatbot-primary);
|
|
3191
|
-
}
|
|
3192
|
-
|
|
3193
|
-
.skill-card__install:disabled {
|
|
3194
|
-
opacity: 0.5;
|
|
3195
|
-
cursor: default;
|
|
3196
|
-
}
|
|
3197
|
-
|
|
3198
|
-
/* Installed state: filled check. */
|
|
3199
|
-
.skill-card__install--installed {
|
|
3200
|
-
background: var(--kr-chatbot-primary);
|
|
3201
|
-
border-color: var(--kr-chatbot-primary);
|
|
3202
|
-
color: white;
|
|
3285
|
+
justify-content: space-between;
|
|
3286
|
+
gap: 8px;
|
|
3287
|
+
margin-top: 8px;
|
|
3288
|
+
margin-left: -14px;
|
|
3289
|
+
margin-right: -14px;
|
|
3290
|
+
padding: 14px 14px 0;
|
|
3291
|
+
border-top: 1px solid #e5e7eb;
|
|
3203
3292
|
}
|
|
3204
3293
|
|
|
3205
|
-
.skill-
|
|
3206
|
-
|
|
3207
|
-
|
|
3294
|
+
.skill-card__price {
|
|
3295
|
+
font-size: 13px;
|
|
3296
|
+
font-weight: 600;
|
|
3297
|
+
color: #000000;
|
|
3208
3298
|
}
|
|
3209
3299
|
|
|
3210
3300
|
.skill-card__name {
|
|
3211
3301
|
font-weight: 600;
|
|
3212
|
-
/* Leave room for the corner install button on global cards. */
|
|
3213
|
-
padding-right: 28px;
|
|
3214
3302
|
}
|
|
3215
3303
|
|
|
3216
3304
|
.skill-card__desc {
|
|
@@ -3399,10 +3487,13 @@ __decorate([
|
|
|
3399
3487
|
], KRChatbot.prototype, "_skillQuery", void 0);
|
|
3400
3488
|
__decorate([
|
|
3401
3489
|
state()
|
|
3402
|
-
], KRChatbot.prototype, "
|
|
3490
|
+
], KRChatbot.prototype, "_orgSkills", void 0);
|
|
3491
|
+
__decorate([
|
|
3492
|
+
state()
|
|
3493
|
+
], KRChatbot.prototype, "_globalSkills", void 0);
|
|
3403
3494
|
__decorate([
|
|
3404
3495
|
state()
|
|
3405
|
-
], KRChatbot.prototype, "
|
|
3496
|
+
], KRChatbot.prototype, "_invocableSkills", void 0);
|
|
3406
3497
|
__decorate([
|
|
3407
3498
|
state()
|
|
3408
3499
|
], KRChatbot.prototype, "_aiFrameworkConfig", void 0);
|