@kodaris/krubble-app-components 1.0.77 → 1.0.78
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 +65 -8
- package/dist/chatbot.d.ts.map +1 -1
- package/dist/chatbot.js +247 -26
- package/dist/chatbot.js.map +1 -1
- package/dist/krubble-app.bundled.js +247 -26
- package/dist/krubble-app.bundled.js.map +1 -1
- package/dist/krubble-app.bundled.min.js +107 -36
- package/dist/krubble-app.bundled.min.js.map +1 -1
- package/dist/krubble-app.umd.js +247 -26
- package/dist/krubble-app.umd.js.map +1 -1
- package/dist/krubble-app.umd.min.js +92 -21
- package/dist/krubble-app.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/chatbot.d.ts
CHANGED
|
@@ -149,6 +149,13 @@ export interface KRChatbotSkill {
|
|
|
149
149
|
name: string;
|
|
150
150
|
/** Short description shown in the browse dialog cards. */
|
|
151
151
|
description?: string;
|
|
152
|
+
/**
|
|
153
|
+
* Whether this skill is installed (turned on) on this instance. Only set for
|
|
154
|
+
* shared Kodaris global skills (from `/aiskills/global/search`), where the
|
|
155
|
+
* `+` button toggles it via `/aiskills/global/{code}/enabled`. Undefined for
|
|
156
|
+
* this org's own skills.
|
|
157
|
+
*/
|
|
158
|
+
enabled?: boolean;
|
|
152
159
|
}
|
|
153
160
|
/**
|
|
154
161
|
* Callback function type for sending messages.
|
|
@@ -223,10 +230,18 @@ export declare class KRChatbot extends LitElement {
|
|
|
223
230
|
/** Monotonic id source for pending attachments. */
|
|
224
231
|
private _pendingSeq;
|
|
225
232
|
/**
|
|
226
|
-
* Request-id
|
|
227
|
-
* responses are dropped (mirrors the kr-combo-box `_requestId` pattern).
|
|
233
|
+
* Request-id guards for skill searches — bumped on each search so out-of-order
|
|
234
|
+
* responses are dropped (mirrors the kr-combo-box `_requestId` pattern). Org and
|
|
235
|
+
* global searches run concurrently into separate buffers, so each has its own.
|
|
228
236
|
*/
|
|
229
237
|
private _skillRequestId;
|
|
238
|
+
private _globalSkillRequestId;
|
|
239
|
+
/**
|
|
240
|
+
* Codes of global skills with an in-flight enable/disable request. The `+`
|
|
241
|
+
* button reads this to show a pending state and ignore repeat clicks. Mutated
|
|
242
|
+
* in place; call requestUpdate() after changing it to re-render.
|
|
243
|
+
*/
|
|
244
|
+
private _globalSkillPending;
|
|
230
245
|
/**
|
|
231
246
|
* Callback function for sending messages. Receives the user's message and
|
|
232
247
|
* current conversation history. Must return a Response with a streaming SSE body.
|
|
@@ -330,10 +345,24 @@ export declare class KRChatbot extends LitElement {
|
|
|
330
345
|
/** Current `/` query (text after the slash), sent to `_searchSkills`. */
|
|
331
346
|
private _skillQuery;
|
|
332
347
|
/**
|
|
333
|
-
* Latest skill search results
|
|
334
|
-
*
|
|
348
|
+
* Latest org skill search results (this instance's own skills). Backs the `/`
|
|
349
|
+
* menu and the browse dialog's "Your Org" tab.
|
|
335
350
|
*/
|
|
336
351
|
private _skillResults;
|
|
352
|
+
/**
|
|
353
|
+
* Latest shared-Kodaris (global) skill results, for the browse dialog's
|
|
354
|
+
* "Kodaris" tab. Kept separate from `_skillResults` so switching tabs shows
|
|
355
|
+
* fresh results immediately instead of the other tab's stale list — the browse
|
|
356
|
+
* search fills both buffers at once.
|
|
357
|
+
*/
|
|
358
|
+
private _globalSkillResults;
|
|
359
|
+
/**
|
|
360
|
+
* AI framework UI config flags fetched from `aiFrameworkConfig` on connect.
|
|
361
|
+
* `debugTelemetryEnabled` (same server-side gate as TOKEN_USAGE emission) turns
|
|
362
|
+
* on the debug drawer toggle and the `/test-warning` / `/test-limit` composer
|
|
363
|
+
* options — known up front, before any message.
|
|
364
|
+
*/
|
|
365
|
+
private _aiFrameworkConfig;
|
|
337
366
|
/** Highlighted item in the skill menu for keyboard navigation (-1 = none). */
|
|
338
367
|
private _skillHighlighted;
|
|
339
368
|
/** Index of the message whose copy button just flashed "Copied" (-1 = none). */
|
|
@@ -341,11 +370,11 @@ export declare class KRChatbot extends LitElement {
|
|
|
341
370
|
/** Whether the "Browse all skills" dialog is open. */
|
|
342
371
|
private _skillBrowseOpened;
|
|
343
372
|
/**
|
|
344
|
-
* Active tab in the browse dialog. `org`
|
|
345
|
-
*
|
|
373
|
+
* Active tab in the browse dialog. `org` shows `_skillResults` (this instance's
|
|
374
|
+
* skills); `kodaris` shows `_globalSkillResults` (the shared global catalog).
|
|
346
375
|
*/
|
|
347
376
|
private _skillBrowseSource;
|
|
348
|
-
/** Search text in the browse dialog,
|
|
377
|
+
/** Search text in the browse dialog, routed to the active tab's search. */
|
|
349
378
|
private _skillBrowseQuery;
|
|
350
379
|
private _panelEl;
|
|
351
380
|
private _messagesEl;
|
|
@@ -414,10 +443,27 @@ export declare class KRChatbot extends LitElement {
|
|
|
414
443
|
* so we lift each hit's `_source` (already in KRChatbotSkill shape) out.
|
|
415
444
|
*/
|
|
416
445
|
private _searchSkills;
|
|
446
|
+
/**
|
|
447
|
+
* Search the shared Kodaris global-skill registry into `_globalSkillResults`
|
|
448
|
+
* (the browse dialog's "Kodaris" tab). Unlike `/aiskills/search`,
|
|
449
|
+
* `/aiskills/global/search` returns a digested list
|
|
450
|
+
* (`data: [{ code, name, description, enabled }]`) already in `KRChatbotSkill`
|
|
451
|
+
* shape, so no `_source` lifting is needed. Only the browse dialog calls this
|
|
452
|
+
* (the `/` menu is org-only), so it isn't run per slash keystroke.
|
|
453
|
+
*/
|
|
454
|
+
private _searchGlobalSkills;
|
|
455
|
+
/**
|
|
456
|
+
* Enable or disable a global skill on this instance via
|
|
457
|
+
* `/aiskills/global/{code}/enabled`, then reflect the server's result on the
|
|
458
|
+
* matching card. Ignores clicks while a request for the same code is pending.
|
|
459
|
+
*/
|
|
460
|
+
private _handleGlobalSkillEnable;
|
|
417
461
|
/** The `+` button toggles the skill/attachment menu open (showing all skills). */
|
|
418
462
|
private _handlePlusClick;
|
|
419
463
|
/** Insert `/code ` into the composer and focus it, ready for the message. */
|
|
420
464
|
private _handleSkillSelect;
|
|
465
|
+
/** Activate a skill card via keyboard (Enter/Space), since it's a div role=button. */
|
|
466
|
+
private _handleSkillCardKeydown;
|
|
421
467
|
/** Copy a message's text to the clipboard and briefly flash "Copied". */
|
|
422
468
|
private _handleCopyMessage;
|
|
423
469
|
private _handleSkillBrowseOpen;
|
|
@@ -456,8 +502,19 @@ export declare class KRChatbot extends LitElement {
|
|
|
456
502
|
private _renderSkillMenu;
|
|
457
503
|
/** The "Browse all skills" dialog — a searchable grid of Org / Kodaris cards. */
|
|
458
504
|
private _renderSkillBrowse;
|
|
459
|
-
/**
|
|
505
|
+
/**
|
|
506
|
+
* The card grid of skill search results for the browse dialog. Clicking a card
|
|
507
|
+
* inserts `/code ` into the composer. In the shared-Kodaris (`global`) tab each
|
|
508
|
+
* card also gets a `+` install button that enables the skill on this instance
|
|
509
|
+
* (turning into a ✓ once installed).
|
|
510
|
+
*/
|
|
460
511
|
private _renderSkillGrid;
|
|
512
|
+
/**
|
|
513
|
+
* The install affordance on a global skill card: a `+` button that enables the
|
|
514
|
+
* skill on this instance, showing a ✓ once installed and a disabled state
|
|
515
|
+
* while the enable/disable request is in flight.
|
|
516
|
+
*/
|
|
517
|
+
private _renderSkillInstall;
|
|
461
518
|
/**
|
|
462
519
|
* Render a user message, highlighting a leading `/skill-code` token (like the
|
|
463
520
|
* 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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AAO,CAAC,gBAAgB;IA6BxB;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IA8B3B;;;;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;CA8ahB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,YAAY,EAAE,SAAS,CAAC;KACzB;CACF"}
|
package/dist/chatbot.js
CHANGED
|
@@ -81,10 +81,18 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
81
81
|
/** Monotonic id source for pending attachments. */
|
|
82
82
|
this._pendingSeq = 0;
|
|
83
83
|
/**
|
|
84
|
-
* Request-id
|
|
85
|
-
* responses are dropped (mirrors the kr-combo-box `_requestId` pattern).
|
|
84
|
+
* Request-id guards for skill searches — bumped on each search so out-of-order
|
|
85
|
+
* responses are dropped (mirrors the kr-combo-box `_requestId` pattern). Org and
|
|
86
|
+
* global searches run concurrently into separate buffers, so each has its own.
|
|
86
87
|
*/
|
|
87
88
|
this._skillRequestId = 0;
|
|
89
|
+
this._globalSkillRequestId = 0;
|
|
90
|
+
/**
|
|
91
|
+
* Codes of global skills with an in-flight enable/disable request. The `+`
|
|
92
|
+
* button reads this to show a pending state and ignore repeat clicks. Mutated
|
|
93
|
+
* in place; call requestUpdate() after changing it to re-render.
|
|
94
|
+
*/
|
|
95
|
+
this._globalSkillPending = new Set();
|
|
88
96
|
// --- @property (public API) ---
|
|
89
97
|
/**
|
|
90
98
|
* Callback function for sending messages. Receives the user's message and
|
|
@@ -190,10 +198,24 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
190
198
|
/** Current `/` query (text after the slash), sent to `_searchSkills`. */
|
|
191
199
|
this._skillQuery = '';
|
|
192
200
|
/**
|
|
193
|
-
* Latest skill search results
|
|
194
|
-
*
|
|
201
|
+
* Latest org skill search results (this instance's own skills). Backs the `/`
|
|
202
|
+
* menu and the browse dialog's "Your Org" tab.
|
|
195
203
|
*/
|
|
196
204
|
this._skillResults = [];
|
|
205
|
+
/**
|
|
206
|
+
* Latest shared-Kodaris (global) skill results, for the browse dialog's
|
|
207
|
+
* "Kodaris" tab. Kept separate from `_skillResults` so switching tabs shows
|
|
208
|
+
* fresh results immediately instead of the other tab's stale list — the browse
|
|
209
|
+
* search fills both buffers at once.
|
|
210
|
+
*/
|
|
211
|
+
this._globalSkillResults = [];
|
|
212
|
+
/**
|
|
213
|
+
* AI framework UI config flags fetched from `aiFrameworkConfig` on connect.
|
|
214
|
+
* `debugTelemetryEnabled` (same server-side gate as TOKEN_USAGE emission) turns
|
|
215
|
+
* on the debug drawer toggle and the `/test-warning` / `/test-limit` composer
|
|
216
|
+
* options — known up front, before any message.
|
|
217
|
+
*/
|
|
218
|
+
this._aiFrameworkConfig = {};
|
|
197
219
|
/** Highlighted item in the skill menu for keyboard navigation (-1 = none). */
|
|
198
220
|
this._skillHighlighted = 0;
|
|
199
221
|
/** Index of the message whose copy button just flashed "Copied" (-1 = none). */
|
|
@@ -201,11 +223,11 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
201
223
|
/** Whether the "Browse all skills" dialog is open. */
|
|
202
224
|
this._skillBrowseOpened = false;
|
|
203
225
|
/**
|
|
204
|
-
* Active tab in the browse dialog. `org`
|
|
205
|
-
*
|
|
226
|
+
* Active tab in the browse dialog. `org` shows `_skillResults` (this instance's
|
|
227
|
+
* skills); `kodaris` shows `_globalSkillResults` (the shared global catalog).
|
|
206
228
|
*/
|
|
207
229
|
this._skillBrowseSource = 'org';
|
|
208
|
-
/** Search text in the browse dialog,
|
|
230
|
+
/** Search text in the browse dialog, routed to the active tab's search. */
|
|
209
231
|
this._skillBrowseQuery = '';
|
|
210
232
|
this._handleMouseMove = (e) => {
|
|
211
233
|
if (this._isDragging) {
|
|
@@ -303,6 +325,17 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
303
325
|
this.messages = messages;
|
|
304
326
|
}
|
|
305
327
|
}).catch(() => { });
|
|
328
|
+
// Fetch the framework config on load (debugTelemetryEnabled, v2ChatEnabled,
|
|
329
|
+
// registryServer). debugTelemetryEnabled gates the debug affordances and is
|
|
330
|
+
// known before any message.
|
|
331
|
+
KRHttp.fetch({
|
|
332
|
+
url: '/api/system/integration/aws/bedrock/aiFrameworkConfig',
|
|
333
|
+
})
|
|
334
|
+
.then((r) => r.json())
|
|
335
|
+
.then((res) => {
|
|
336
|
+
this._aiFrameworkConfig = res?.data || {};
|
|
337
|
+
})
|
|
338
|
+
.catch(() => { });
|
|
306
339
|
// Inline mode fills its container and is always open — the floating widget's
|
|
307
340
|
// toggle/drag/resize state doesn't apply, but the composer message and debug
|
|
308
341
|
// drawer state (restored inside _restoreState) do.
|
|
@@ -667,17 +700,33 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
667
700
|
// specials so user input is treated literally, then wrap with `*...*`.
|
|
668
701
|
let must = { match_all: {} };
|
|
669
702
|
if (trimmed) {
|
|
670
|
-
const pattern = `*${trimmed.replace(/([*?\\])/g, '\\$1')}*`;
|
|
671
|
-
const value = {
|
|
672
|
-
value: pattern,
|
|
673
|
-
case_insensitive: true,
|
|
674
|
-
};
|
|
675
703
|
must = {
|
|
676
704
|
bool: {
|
|
677
705
|
should: [
|
|
678
|
-
{
|
|
679
|
-
|
|
680
|
-
|
|
706
|
+
{
|
|
707
|
+
wildcard: {
|
|
708
|
+
'name.raw': {
|
|
709
|
+
value: `*${trimmed.replace(/([*?\\])/g, '\\$1')}*`,
|
|
710
|
+
case_insensitive: true,
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
},
|
|
714
|
+
{
|
|
715
|
+
wildcard: {
|
|
716
|
+
'code.raw': {
|
|
717
|
+
value: `*${trimmed.replace(/([*?\\])/g, '\\$1')}*`,
|
|
718
|
+
case_insensitive: true,
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
},
|
|
722
|
+
{
|
|
723
|
+
wildcard: {
|
|
724
|
+
'description.raw': {
|
|
725
|
+
value: `*${trimmed.replace(/([*?\\])/g, '\\$1')}*`,
|
|
726
|
+
case_insensitive: true,
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
},
|
|
681
730
|
],
|
|
682
731
|
minimum_should_match: 1,
|
|
683
732
|
},
|
|
@@ -708,6 +757,66 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
708
757
|
console.error('kr-chatbot: skill search failed', error);
|
|
709
758
|
});
|
|
710
759
|
}
|
|
760
|
+
/**
|
|
761
|
+
* Search the shared Kodaris global-skill registry into `_globalSkillResults`
|
|
762
|
+
* (the browse dialog's "Kodaris" tab). Unlike `/aiskills/search`,
|
|
763
|
+
* `/aiskills/global/search` returns a digested list
|
|
764
|
+
* (`data: [{ code, name, description, enabled }]`) already in `KRChatbotSkill`
|
|
765
|
+
* shape, so no `_source` lifting is needed. Only the browse dialog calls this
|
|
766
|
+
* (the `/` menu is org-only), so it isn't run per slash keystroke.
|
|
767
|
+
*/
|
|
768
|
+
_searchGlobalSkills(query) {
|
|
769
|
+
this._globalSkillRequestId++;
|
|
770
|
+
const requestId = this._globalSkillRequestId;
|
|
771
|
+
KRHttp.fetch({
|
|
772
|
+
url: '/api/system/opensearch/aiskills/global/search',
|
|
773
|
+
method: 'POST',
|
|
774
|
+
body: { query: query.trim() },
|
|
775
|
+
})
|
|
776
|
+
.then((r) => r.json())
|
|
777
|
+
.then((res) => {
|
|
778
|
+
// Ignore a stale response superseded by a newer search.
|
|
779
|
+
if (requestId !== this._globalSkillRequestId) {
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
this._globalSkillResults = (res?.data || []);
|
|
783
|
+
})
|
|
784
|
+
.catch((error) => {
|
|
785
|
+
console.error('kr-chatbot: global skill search failed', error);
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* Enable or disable a global skill on this instance via
|
|
790
|
+
* `/aiskills/global/{code}/enabled`, then reflect the server's result on the
|
|
791
|
+
* matching card. Ignores clicks while a request for the same code is pending.
|
|
792
|
+
*/
|
|
793
|
+
_handleGlobalSkillEnable(skill, e) {
|
|
794
|
+
// The card body inserts the skill; the `+` button must not also do that.
|
|
795
|
+
e.stopPropagation();
|
|
796
|
+
if (this._globalSkillPending.has(skill.code)) {
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
this._globalSkillPending.add(skill.code);
|
|
800
|
+
this.requestUpdate();
|
|
801
|
+
KRHttp.fetch({
|
|
802
|
+
url: `/api/system/opensearch/aiskills/global/${encodeURIComponent(skill.code)}/enabled`,
|
|
803
|
+
method: 'POST',
|
|
804
|
+
body: { enabled: !skill.enabled },
|
|
805
|
+
})
|
|
806
|
+
.then((r) => r.json())
|
|
807
|
+
.then((res) => {
|
|
808
|
+
// Reflect the server's returned flag on the card.
|
|
809
|
+
skill.enabled = res?.data?.enabled;
|
|
810
|
+
this.requestUpdate();
|
|
811
|
+
})
|
|
812
|
+
.catch((error) => {
|
|
813
|
+
console.error('kr-chatbot: global skill enable failed', error);
|
|
814
|
+
})
|
|
815
|
+
.finally(() => {
|
|
816
|
+
this._globalSkillPending.delete(skill.code);
|
|
817
|
+
this.requestUpdate();
|
|
818
|
+
});
|
|
819
|
+
}
|
|
711
820
|
/** The `+` button toggles the skill/attachment menu open (showing all skills). */
|
|
712
821
|
_handlePlusClick() {
|
|
713
822
|
if (this._skillMenuOpened) {
|
|
@@ -727,6 +836,13 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
727
836
|
this._skillBrowseOpened = false;
|
|
728
837
|
this._inputEl?.focus();
|
|
729
838
|
}
|
|
839
|
+
/** Activate a skill card via keyboard (Enter/Space), since it's a div role=button. */
|
|
840
|
+
_handleSkillCardKeydown(e, skill) {
|
|
841
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
842
|
+
e.preventDefault();
|
|
843
|
+
this._handleSkillSelect(skill);
|
|
844
|
+
}
|
|
845
|
+
}
|
|
730
846
|
/** Copy a message's text to the clipboard and briefly flash "Copied". */
|
|
731
847
|
_handleCopyMessage(content, index) {
|
|
732
848
|
navigator.clipboard.writeText(content).then(() => {
|
|
@@ -742,16 +858,22 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
742
858
|
this._skillMenuOpened = false;
|
|
743
859
|
this._skillBrowseQuery = '';
|
|
744
860
|
this._skillBrowseOpened = true;
|
|
861
|
+
// Fill both tabs up front so switching between them is instant, not stale.
|
|
745
862
|
this._searchSkills('');
|
|
863
|
+
this._searchGlobalSkills('');
|
|
746
864
|
}
|
|
747
865
|
_handleSkillBrowseClose() {
|
|
748
866
|
this._skillBrowseOpened = false;
|
|
749
867
|
}
|
|
750
868
|
_handleSkillBrowseSearch(e) {
|
|
751
869
|
this._skillBrowseQuery = e.target.value;
|
|
870
|
+
// Filter both catalogs so whichever tab the user switches to is already current.
|
|
752
871
|
this._searchSkills(this._skillBrowseQuery);
|
|
872
|
+
this._searchGlobalSkills(this._skillBrowseQuery);
|
|
753
873
|
}
|
|
754
874
|
_handleSkillBrowseTabChange(e) {
|
|
875
|
+
// Both buffers are kept current by open/search, so switching just swaps which
|
|
876
|
+
// one is shown — no re-search needed.
|
|
755
877
|
this._skillBrowseSource = e.detail.activeTabId;
|
|
756
878
|
}
|
|
757
879
|
// --- Attachments ---
|
|
@@ -1248,37 +1370,81 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
1248
1370
|
${this._renderSkillGrid()}
|
|
1249
1371
|
</kr-tab>
|
|
1250
1372
|
<kr-tab id="kodaris" label="Kodaris">
|
|
1251
|
-
|
|
1252
|
-
Shared Kodaris skills are coming soon.
|
|
1253
|
-
</div>
|
|
1373
|
+
${this._renderSkillGrid(true)}
|
|
1254
1374
|
</kr-tab>
|
|
1255
1375
|
</kr-tab-group>
|
|
1256
1376
|
</div>
|
|
1257
1377
|
</kr-dialog>
|
|
1258
1378
|
`;
|
|
1259
1379
|
}
|
|
1260
|
-
/**
|
|
1261
|
-
|
|
1262
|
-
|
|
1380
|
+
/**
|
|
1381
|
+
* The card grid of skill search results for the browse dialog. Clicking a card
|
|
1382
|
+
* inserts `/code ` into the composer. In the shared-Kodaris (`global`) tab each
|
|
1383
|
+
* card also gets a `+` install button that enables the skill on this instance
|
|
1384
|
+
* (turning into a ✓ once installed).
|
|
1385
|
+
*/
|
|
1386
|
+
_renderSkillGrid(global = false) {
|
|
1387
|
+
let skills = this._skillResults;
|
|
1388
|
+
if (global) {
|
|
1389
|
+
skills = this._globalSkillResults;
|
|
1390
|
+
}
|
|
1263
1391
|
if (!skills.length) {
|
|
1264
1392
|
return nothing;
|
|
1265
1393
|
}
|
|
1266
1394
|
return html `
|
|
1267
1395
|
<div class="skill-browse__grid">
|
|
1268
1396
|
${skills.map((skill) => html `
|
|
1269
|
-
<
|
|
1397
|
+
<div
|
|
1270
1398
|
class="skill-card"
|
|
1399
|
+
role="button"
|
|
1400
|
+
tabindex="0"
|
|
1271
1401
|
@click=${() => this._handleSkillSelect(skill)}
|
|
1402
|
+
@keydown=${(e) => this._handleSkillCardKeydown(e, skill)}
|
|
1272
1403
|
>
|
|
1273
1404
|
<span class="skill-card__name">${skill.name}</span>
|
|
1274
1405
|
${skill.description ? html `
|
|
1275
1406
|
<span class="skill-card__desc">${skill.description}</span>
|
|
1276
1407
|
` : nothing}
|
|
1277
|
-
|
|
1408
|
+
${global ? this._renderSkillInstall(skill) : nothing}
|
|
1409
|
+
</div>
|
|
1278
1410
|
`)}
|
|
1279
1411
|
</div>
|
|
1280
1412
|
`;
|
|
1281
1413
|
}
|
|
1414
|
+
/**
|
|
1415
|
+
* The install affordance on a global skill card: a `+` button that enables the
|
|
1416
|
+
* skill on this instance, showing a ✓ once installed and a disabled state
|
|
1417
|
+
* while the enable/disable request is in flight.
|
|
1418
|
+
*/
|
|
1419
|
+
_renderSkillInstall(skill) {
|
|
1420
|
+
return html `
|
|
1421
|
+
<button
|
|
1422
|
+
class=${classMap({
|
|
1423
|
+
'skill-card__install': true,
|
|
1424
|
+
'skill-card__install--installed': !!skill.enabled,
|
|
1425
|
+
})}
|
|
1426
|
+
?disabled=${this._globalSkillPending.has(skill.code)}
|
|
1427
|
+
title=${!!skill.enabled ? 'Installed — click to remove' : 'Install this skill'}
|
|
1428
|
+
aria-label=${!!skill.enabled ? 'Remove skill' : 'Install skill'}
|
|
1429
|
+
@click=${(e) => this._handleGlobalSkillEnable(skill, e)}
|
|
1430
|
+
>
|
|
1431
|
+
<svg
|
|
1432
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1433
|
+
fill="none"
|
|
1434
|
+
viewBox="0 0 24 24"
|
|
1435
|
+
stroke-width="2"
|
|
1436
|
+
stroke="currentColor"
|
|
1437
|
+
class="skill-card__install-icon"
|
|
1438
|
+
>
|
|
1439
|
+
<path
|
|
1440
|
+
stroke-linecap="round"
|
|
1441
|
+
stroke-linejoin="round"
|
|
1442
|
+
d=${!!skill.enabled ? 'm4.5 12.75 6 6 9-13.5' : 'M12 4.5v15m7.5-7.5h-15'}
|
|
1443
|
+
/>
|
|
1444
|
+
</svg>
|
|
1445
|
+
</button>
|
|
1446
|
+
`;
|
|
1447
|
+
}
|
|
1282
1448
|
/**
|
|
1283
1449
|
* Render a user message, highlighting a leading `/skill-code` token (like the
|
|
1284
1450
|
* way Claude highlights slash commands). The composer only inserts valid skill
|
|
@@ -1444,6 +1610,9 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
1444
1610
|
`;
|
|
1445
1611
|
}
|
|
1446
1612
|
render() {
|
|
1613
|
+
// Debug affordances (drawer toggle, drawer, /test-* options) require the
|
|
1614
|
+
// inline variant AND the server-side debug flag from aiFrameworkConfig.
|
|
1615
|
+
const isDebugEnabled = this.variant === 'inline' && this._aiFrameworkConfig.debugTelemetryEnabled === true;
|
|
1447
1616
|
return html `
|
|
1448
1617
|
${(this.hideToggle || this.variant === 'inline') ? nothing : html `
|
|
1449
1618
|
<button
|
|
@@ -1474,7 +1643,7 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
1474
1643
|
'panel--opened': this.opened,
|
|
1475
1644
|
'panel--resizing-debug': this._isDebugResizing,
|
|
1476
1645
|
})}
|
|
1477
|
-
style=${styleMap(this.
|
|
1646
|
+
style=${styleMap(this._debugPanelOpen ? { paddingRight: `${this._debugDrawerWidth}px` } : {})}
|
|
1478
1647
|
@dragenter=${this._handleDragEnter}
|
|
1479
1648
|
@dragover=${this._handleDragOver}
|
|
1480
1649
|
@dragleave=${this._handleDragLeave}
|
|
@@ -1547,7 +1716,7 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
1547
1716
|
</div>
|
|
1548
1717
|
</div>
|
|
1549
1718
|
<div class="header-actions">
|
|
1550
|
-
${
|
|
1719
|
+
${isDebugEnabled ? html `
|
|
1551
1720
|
<button
|
|
1552
1721
|
class=${classMap({
|
|
1553
1722
|
'header-action': true,
|
|
@@ -1866,7 +2035,7 @@ let KRChatbot = class KRChatbot extends LitElement {
|
|
|
1866
2035
|
</div>
|
|
1867
2036
|
</div>
|
|
1868
2037
|
${this._skillBrowseOpened ? this._renderSkillBrowse() : nothing}
|
|
1869
|
-
${
|
|
2038
|
+
${isDebugEnabled ? this._renderDebugPanel() : nothing}
|
|
1870
2039
|
</div>
|
|
1871
2040
|
`;
|
|
1872
2041
|
}
|
|
@@ -2891,6 +3060,7 @@ KRChatbot.styles = css `
|
|
|
2891
3060
|
}
|
|
2892
3061
|
|
|
2893
3062
|
.skill-card {
|
|
3063
|
+
position: relative;
|
|
2894
3064
|
display: flex;
|
|
2895
3065
|
flex-direction: column;
|
|
2896
3066
|
gap: 6px;
|
|
@@ -2910,8 +3080,53 @@ KRChatbot.styles = css `
|
|
|
2910
3080
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
|
2911
3081
|
}
|
|
2912
3082
|
|
|
3083
|
+
/* Install button on global skill cards. Absolutely positioned in the corner
|
|
3084
|
+
so it sits above the card's own click target; leave room via the name's
|
|
3085
|
+
padding-right below. */
|
|
3086
|
+
.skill-card__install {
|
|
3087
|
+
position: absolute;
|
|
3088
|
+
top: 10px;
|
|
3089
|
+
right: 10px;
|
|
3090
|
+
display: inline-flex;
|
|
3091
|
+
align-items: center;
|
|
3092
|
+
justify-content: center;
|
|
3093
|
+
width: 24px;
|
|
3094
|
+
height: 24px;
|
|
3095
|
+
padding: 0;
|
|
3096
|
+
border: 1px solid #d1d5db;
|
|
3097
|
+
border-radius: 6px;
|
|
3098
|
+
background: white;
|
|
3099
|
+
color: #374151;
|
|
3100
|
+
cursor: pointer;
|
|
3101
|
+
transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
|
|
3102
|
+
}
|
|
3103
|
+
|
|
3104
|
+
.skill-card__install:hover:not(:disabled) {
|
|
3105
|
+
border-color: var(--kr-chatbot-primary);
|
|
3106
|
+
color: var(--kr-chatbot-primary);
|
|
3107
|
+
}
|
|
3108
|
+
|
|
3109
|
+
.skill-card__install:disabled {
|
|
3110
|
+
opacity: 0.5;
|
|
3111
|
+
cursor: default;
|
|
3112
|
+
}
|
|
3113
|
+
|
|
3114
|
+
/* Installed state: filled check. */
|
|
3115
|
+
.skill-card__install--installed {
|
|
3116
|
+
background: var(--kr-chatbot-primary);
|
|
3117
|
+
border-color: var(--kr-chatbot-primary);
|
|
3118
|
+
color: white;
|
|
3119
|
+
}
|
|
3120
|
+
|
|
3121
|
+
.skill-card__install-icon {
|
|
3122
|
+
width: 15px;
|
|
3123
|
+
height: 15px;
|
|
3124
|
+
}
|
|
3125
|
+
|
|
2913
3126
|
.skill-card__name {
|
|
2914
3127
|
font-weight: 600;
|
|
3128
|
+
/* Leave room for the corner install button on global cards. */
|
|
3129
|
+
padding-right: 28px;
|
|
2915
3130
|
}
|
|
2916
3131
|
|
|
2917
3132
|
.skill-card__desc {
|
|
@@ -3101,6 +3316,12 @@ __decorate([
|
|
|
3101
3316
|
__decorate([
|
|
3102
3317
|
state()
|
|
3103
3318
|
], KRChatbot.prototype, "_skillResults", void 0);
|
|
3319
|
+
__decorate([
|
|
3320
|
+
state()
|
|
3321
|
+
], KRChatbot.prototype, "_globalSkillResults", void 0);
|
|
3322
|
+
__decorate([
|
|
3323
|
+
state()
|
|
3324
|
+
], KRChatbot.prototype, "_aiFrameworkConfig", void 0);
|
|
3104
3325
|
__decorate([
|
|
3105
3326
|
state()
|
|
3106
3327
|
], KRChatbot.prototype, "_skillHighlighted", void 0);
|