@kodaris/krubble-app-components 1.0.156 → 1.0.158
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 +53 -10
- package/dist/chatbot.d.ts.map +1 -1
- package/dist/chatbot.js +348 -47
- package/dist/chatbot.js.map +1 -1
- package/dist/krubble-app.bundled.js +348 -47
- package/dist/krubble-app.bundled.js.map +1 -1
- package/dist/krubble-app.bundled.min.js +148 -15
- package/dist/krubble-app.bundled.min.js.map +1 -1
- package/dist/krubble-app.umd.js +348 -47
- package/dist/krubble-app.umd.js.map +1 -1
- package/dist/krubble-app.umd.min.js +185 -52
- package/dist/krubble-app.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/chatbot.js
CHANGED
|
@@ -463,6 +463,14 @@ export class KRChatbot extends LitElement {
|
|
|
463
463
|
* while it is set and the request only fires once the user confirms.
|
|
464
464
|
*/
|
|
465
465
|
this._skillInstallConfirm = null;
|
|
466
|
+
/**
|
|
467
|
+
* The transcript offer (an offer_skill tool_result) with paid skills awaiting the user's
|
|
468
|
+
* install confirmation, else null. An offer IS that tool call: its result string is the offer
|
|
469
|
+
* JSON (`{skills, canInstall, note}`) and, once the user acts, its row gains
|
|
470
|
+
* `skillOfferOutcome` (`installed` or `declined`), which the server stores so a reload shows
|
|
471
|
+
* the same outcome.
|
|
472
|
+
*/
|
|
473
|
+
this._skillOfferConfirm = null;
|
|
466
474
|
/**
|
|
467
475
|
* Active tab in the browse dialog. `org` shows `_orgSkills` (this instance's
|
|
468
476
|
* skills); `kodaris` shows `_globalSkills` (the shared global catalog).
|
|
@@ -1461,9 +1469,11 @@ export class KRChatbot extends LitElement {
|
|
|
1461
1469
|
* Enable or disable a global skill on this instance via
|
|
1462
1470
|
* `/aiskills/global/{code}/enabled`, then reflect the server's result on the
|
|
1463
1471
|
* matching card. Ignores clicks while a request for the same code is pending.
|
|
1472
|
+
* Installing a billable skill opens a confirmation instead; see
|
|
1473
|
+
* `_handleSkillInstallConfirm` for the request that runs once the user accepts.
|
|
1464
1474
|
*/
|
|
1465
1475
|
_handleGlobalSkillEnable(skill, e) {
|
|
1466
|
-
// The card body
|
|
1476
|
+
// The card body opens the detail view; the install button must not also do that.
|
|
1467
1477
|
e.stopPropagation();
|
|
1468
1478
|
// The button is shown to everyone so the catalog reads the same for all users,
|
|
1469
1479
|
// but the enable endpoint requires administrator/superuser/skillEdit. Without
|
|
@@ -1479,46 +1489,18 @@ export class KRChatbot extends LitElement {
|
|
|
1479
1489
|
if (this._globalSkillPending.has(skill.code)) {
|
|
1480
1490
|
return;
|
|
1481
1491
|
}
|
|
1482
|
-
const btn = e.currentTarget;
|
|
1483
1492
|
// Installing a billable skill charges the account, so confirm before sending.
|
|
1484
1493
|
// Uninstalling is never billed and free installs are one click to undo.
|
|
1485
1494
|
if (!skill.enabled && skill.billable) {
|
|
1486
1495
|
this._skillInstallConfirm = skill;
|
|
1487
1496
|
return;
|
|
1488
1497
|
}
|
|
1489
|
-
this._enableGlobalSkill(skill, btn);
|
|
1490
|
-
}
|
|
1491
|
-
/** Cancel the billable install confirmation without sending anything. */
|
|
1492
|
-
_handleSkillInstallCancel() {
|
|
1493
|
-
this._skillInstallConfirm = null;
|
|
1494
|
-
}
|
|
1495
|
-
/**
|
|
1496
|
-
* The user accepted the charge: run the install with the dialog's own Install
|
|
1497
|
-
* button spinning, and close the dialog once the server confirms. On failure
|
|
1498
|
-
* the button shows the error and the dialog stays open so they can retry or cancel.
|
|
1499
|
-
*/
|
|
1500
|
-
_handleSkillInstallConfirm(e) {
|
|
1501
|
-
if (!this._skillInstallConfirm) {
|
|
1502
|
-
return;
|
|
1503
|
-
}
|
|
1504
|
-
this._enableGlobalSkill(this._skillInstallConfirm, e.currentTarget).then((ok) => {
|
|
1505
|
-
if (ok) {
|
|
1506
|
-
this._skillInstallConfirm = null;
|
|
1507
|
-
}
|
|
1508
|
-
});
|
|
1509
|
-
}
|
|
1510
|
-
/**
|
|
1511
|
-
* Send the enable/disable request for a global skill and reflect the server's
|
|
1512
|
-
* result on its card. `btn` is the button that triggered it (the card's
|
|
1513
|
-
* Install button, or the confirmation dialog's), whose spinner shows while the
|
|
1514
|
-
* request is in flight. Resolves true on success, false on failure.
|
|
1515
|
-
*/
|
|
1516
|
-
_enableGlobalSkill(skill, btn) {
|
|
1517
1498
|
// Drive the clicked button's own spinner (KRButton disables itself while
|
|
1518
1499
|
// loading, so a second click can't fire until the request settles).
|
|
1500
|
+
const btn = e.currentTarget;
|
|
1519
1501
|
this._globalSkillPending.add(skill.code);
|
|
1520
1502
|
btn?.showLoading();
|
|
1521
|
-
|
|
1503
|
+
KRHttp.fetch({
|
|
1522
1504
|
url: `/api/system/opensearch/aiskills/global/${encodeURIComponent(skill.code)}/enabled`,
|
|
1523
1505
|
method: 'POST',
|
|
1524
1506
|
body: { enabled: !skill.enabled },
|
|
@@ -1544,17 +1526,181 @@ export class KRChatbot extends LitElement {
|
|
|
1544
1526
|
type: 'success',
|
|
1545
1527
|
});
|
|
1546
1528
|
}
|
|
1547
|
-
return true;
|
|
1548
1529
|
})
|
|
1549
1530
|
.catch((error) => {
|
|
1550
1531
|
console.error('kr-chatbot: global skill enable failed', error);
|
|
1551
1532
|
btn?.showError('Error');
|
|
1552
|
-
return false;
|
|
1553
1533
|
})
|
|
1554
1534
|
.finally(() => {
|
|
1555
1535
|
this._globalSkillPending.delete(skill.code);
|
|
1556
1536
|
});
|
|
1557
1537
|
}
|
|
1538
|
+
/** Cancel the billable install confirmation without sending anything. */
|
|
1539
|
+
_handleSkillInstallCancel() {
|
|
1540
|
+
this._skillInstallConfirm = null;
|
|
1541
|
+
}
|
|
1542
|
+
/**
|
|
1543
|
+
* The user accepted the charge: run the install with the dialog's own Install
|
|
1544
|
+
* button spinning, and close the dialog once the server confirms. On failure
|
|
1545
|
+
* the button shows the error and the dialog stays open so they can retry or cancel.
|
|
1546
|
+
*/
|
|
1547
|
+
_handleSkillInstallConfirm(e) {
|
|
1548
|
+
if (!this._skillInstallConfirm) {
|
|
1549
|
+
return;
|
|
1550
|
+
}
|
|
1551
|
+
if (this._globalSkillPending.has(this._skillInstallConfirm.code)) {
|
|
1552
|
+
return;
|
|
1553
|
+
}
|
|
1554
|
+
const skill = this._skillInstallConfirm;
|
|
1555
|
+
const btn = e.currentTarget;
|
|
1556
|
+
this._globalSkillPending.add(skill.code);
|
|
1557
|
+
btn?.showLoading();
|
|
1558
|
+
KRHttp.fetch({
|
|
1559
|
+
url: `/api/system/opensearch/aiskills/global/${encodeURIComponent(skill.code)}/enabled`,
|
|
1560
|
+
method: 'POST',
|
|
1561
|
+
body: { enabled: true },
|
|
1562
|
+
})
|
|
1563
|
+
.then((r) => r.json())
|
|
1564
|
+
.then((res) => {
|
|
1565
|
+
// Reflect the server's returned flag on the card and close the confirmation.
|
|
1566
|
+
skill.enabled = res?.data?.enabled;
|
|
1567
|
+
btn?.reset();
|
|
1568
|
+
this._skillInstallConfirm = null;
|
|
1569
|
+
this.requestUpdate();
|
|
1570
|
+
KRSnackbar.show({
|
|
1571
|
+
title: 'Skill Installed',
|
|
1572
|
+
message: `${skill.name} is now available to use.`,
|
|
1573
|
+
type: 'success',
|
|
1574
|
+
});
|
|
1575
|
+
})
|
|
1576
|
+
.catch((error) => {
|
|
1577
|
+
console.error('kr-chatbot: global skill install failed', error);
|
|
1578
|
+
btn?.showError('Error');
|
|
1579
|
+
})
|
|
1580
|
+
.finally(() => {
|
|
1581
|
+
this._globalSkillPending.delete(skill.code);
|
|
1582
|
+
});
|
|
1583
|
+
}
|
|
1584
|
+
/**
|
|
1585
|
+
* Install on a transcript offer: install every skill the assistant offered, together. The
|
|
1586
|
+
* offer is all-or-nothing because the task needs all of them (one without the other would
|
|
1587
|
+
* not get it done). Same permission check and paid-skill confirmation as the Browse dialog's
|
|
1588
|
+
* Install button, applied to the set: without the role, say who to ask; with any paid skill
|
|
1589
|
+
* in the set, confirm the charges first (`_handleSkillOfferConfirm` runs the install once the
|
|
1590
|
+
* user accepts).
|
|
1591
|
+
*/
|
|
1592
|
+
_handleOfferedSkillsInstall(msg, e) {
|
|
1593
|
+
const offer = JSON.parse(msg.data.toolResultString);
|
|
1594
|
+
if (!offer.canInstall) {
|
|
1595
|
+
KRSnackbar.show({
|
|
1596
|
+
title: 'Permission Required',
|
|
1597
|
+
message: 'You do not have permission to install skills. Please contact your site administrator.',
|
|
1598
|
+
type: 'error',
|
|
1599
|
+
});
|
|
1600
|
+
return;
|
|
1601
|
+
}
|
|
1602
|
+
if (offer.skills.some((skill) => this._globalSkillPending.has(skill.code))) {
|
|
1603
|
+
return;
|
|
1604
|
+
}
|
|
1605
|
+
if (offer.skills.some((skill) => skill.billable)) {
|
|
1606
|
+
this._skillOfferConfirm = msg;
|
|
1607
|
+
return;
|
|
1608
|
+
}
|
|
1609
|
+
this._installOfferedSkills(msg, e.currentTarget);
|
|
1610
|
+
}
|
|
1611
|
+
/** Cancel the offer's paid-skill confirmation without installing anything. */
|
|
1612
|
+
_handleSkillOfferCancel() {
|
|
1613
|
+
this._skillOfferConfirm = null;
|
|
1614
|
+
}
|
|
1615
|
+
/** The user accepted the charges: install the offered set with the dialog's own button spinning. */
|
|
1616
|
+
_handleSkillOfferConfirm(e) {
|
|
1617
|
+
if (!this._skillOfferConfirm) {
|
|
1618
|
+
return;
|
|
1619
|
+
}
|
|
1620
|
+
this._installOfferedSkills(this._skillOfferConfirm, e.currentTarget);
|
|
1621
|
+
}
|
|
1622
|
+
/**
|
|
1623
|
+
* Install the offered skills one after another through the same enable request the Browse
|
|
1624
|
+
* dialog's card uses, driving the clicked button's spinner. A skill already on (say, installed
|
|
1625
|
+
* from the Browse dialog meanwhile) is a no-op for the server, so none is skipped. When every
|
|
1626
|
+
* one is on: record the outcome on the offer's tool_result data (so this render updates at
|
|
1627
|
+
* once) and on its row (so a reload shows the same thing; best effort, the transcript already
|
|
1628
|
+
* shows it), close the paid confirmation if it was open, and tell the assistant, as the user,
|
|
1629
|
+
* that the skills are installed so it re-runs list_skills and carries on with the original
|
|
1630
|
+
* request. A failure stops the sequence: the ones already on stay on, the button shows the
|
|
1631
|
+
* error, and nothing is sent, so the user can retry the offer.
|
|
1632
|
+
*/
|
|
1633
|
+
_installOfferedSkills(msg, btn) {
|
|
1634
|
+
const skills = JSON.parse(msg.data.toolResultString).skills;
|
|
1635
|
+
for (const skill of skills) {
|
|
1636
|
+
this._globalSkillPending.add(skill.code);
|
|
1637
|
+
}
|
|
1638
|
+
btn?.showLoading();
|
|
1639
|
+
let chain = Promise.resolve();
|
|
1640
|
+
for (const skill of skills) {
|
|
1641
|
+
chain = chain
|
|
1642
|
+
.then(() => KRHttp.fetch({
|
|
1643
|
+
url: `/api/system/opensearch/aiskills/global/${encodeURIComponent(skill.code)}/enabled`,
|
|
1644
|
+
method: 'POST',
|
|
1645
|
+
body: { enabled: true },
|
|
1646
|
+
}));
|
|
1647
|
+
}
|
|
1648
|
+
chain
|
|
1649
|
+
.then(() => {
|
|
1650
|
+
btn?.reset();
|
|
1651
|
+
this._skillOfferConfirm = null;
|
|
1652
|
+
msg.data.skillOfferOutcome = 'installed';
|
|
1653
|
+
this.requestUpdate();
|
|
1654
|
+
if (this.conversationId != null) {
|
|
1655
|
+
KRHttp.fetch({
|
|
1656
|
+
url: `/api/system/conversation/${this.conversationId}/skillOffer/${encodeURIComponent(msg.data.toolUseId)}`,
|
|
1657
|
+
method: 'POST',
|
|
1658
|
+
body: {
|
|
1659
|
+
outcome: 'installed',
|
|
1660
|
+
},
|
|
1661
|
+
}).catch((error) => {
|
|
1662
|
+
console.error('kr-chatbot: failed to record skill offer outcome', error);
|
|
1663
|
+
});
|
|
1664
|
+
}
|
|
1665
|
+
this._inputValue = `I installed ${skills.map((skill) => skill.name).join(' and ')}. Please continue.`;
|
|
1666
|
+
this._handleSubmit();
|
|
1667
|
+
})
|
|
1668
|
+
.catch((error) => {
|
|
1669
|
+
console.error('kr-chatbot: skill offer install failed', error);
|
|
1670
|
+
btn?.showError('Error');
|
|
1671
|
+
})
|
|
1672
|
+
.finally(() => {
|
|
1673
|
+
for (const skill of skills) {
|
|
1674
|
+
this._globalSkillPending.delete(skill.code);
|
|
1675
|
+
}
|
|
1676
|
+
});
|
|
1677
|
+
}
|
|
1678
|
+
/**
|
|
1679
|
+
* Not now on a transcript offer: record the decline (the box stays, showing Declined in
|
|
1680
|
+
* place of the buttons) and tell the assistant, as the user, that they declined, so it can
|
|
1681
|
+
* carry on without the skills instead of waiting for an install. The outcome is set on the
|
|
1682
|
+
* offer's tool_result data so this render updates at once, and written to that row on the
|
|
1683
|
+
* server so a reload shows the same thing. The write is best effort: the transcript already
|
|
1684
|
+
* shows the outcome, and the user message tells the assistant. The row is addressed by the
|
|
1685
|
+
* conversation and the tool call's own toolUseId, which every tool row already carries.
|
|
1686
|
+
*/
|
|
1687
|
+
_handleOfferedSkillsDecline(msg) {
|
|
1688
|
+
msg.data.skillOfferOutcome = 'declined';
|
|
1689
|
+
this.requestUpdate();
|
|
1690
|
+
if (this.conversationId != null) {
|
|
1691
|
+
KRHttp.fetch({
|
|
1692
|
+
url: `/api/system/conversation/${this.conversationId}/skillOffer/${encodeURIComponent(msg.data.toolUseId)}`,
|
|
1693
|
+
method: 'POST',
|
|
1694
|
+
body: {
|
|
1695
|
+
outcome: 'declined',
|
|
1696
|
+
},
|
|
1697
|
+
}).catch((error) => {
|
|
1698
|
+
console.error('kr-chatbot: failed to record skill offer outcome', error);
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1701
|
+
this._inputValue = `I don't want to install ${JSON.parse(msg.data.toolResultString).skills.map((skill) => skill.name).join(' and ')} right now.`;
|
|
1702
|
+
this._handleSubmit();
|
|
1703
|
+
}
|
|
1558
1704
|
/** The `+` button toggles the skill/attachment menu open (showing all skills). */
|
|
1559
1705
|
_handlePlusClick() {
|
|
1560
1706
|
if (this._skillMenuOpened) {
|
|
@@ -1744,9 +1890,10 @@ export class KRChatbot extends LitElement {
|
|
|
1744
1890
|
this._skillBrowseQuery = '';
|
|
1745
1891
|
this._skillBrowseOpened = true;
|
|
1746
1892
|
// Fill both tabs up front so switching between them is instant, not stale.
|
|
1747
|
-
// The Kodaris tab isn't rendered on the registry server
|
|
1893
|
+
// The Kodaris tab isn't rendered on the registry server (except a localhost dev box,
|
|
1894
|
+
// which is server and client at once), so skip its fetch there.
|
|
1748
1895
|
this._searchOrgSkills('');
|
|
1749
|
-
if (this._aiFrameworkConfig.registryServer !== true) {
|
|
1896
|
+
if (this._aiFrameworkConfig.registryServer !== true || KRHttp.getBaseUrl().includes('localhost')) {
|
|
1750
1897
|
this._searchGlobalSkills('');
|
|
1751
1898
|
}
|
|
1752
1899
|
}
|
|
@@ -1780,7 +1927,7 @@ export class KRChatbot extends LitElement {
|
|
|
1780
1927
|
this._skillBrowseQuery = e.target.value;
|
|
1781
1928
|
// Filter both catalogs so whichever tab the user switches to is already current.
|
|
1782
1929
|
this._searchOrgSkills(this._skillBrowseQuery);
|
|
1783
|
-
if (this._aiFrameworkConfig.registryServer !== true) {
|
|
1930
|
+
if (this._aiFrameworkConfig.registryServer !== true || KRHttp.getBaseUrl().includes('localhost')) {
|
|
1784
1931
|
this._searchGlobalSkills(this._skillBrowseQuery);
|
|
1785
1932
|
}
|
|
1786
1933
|
}
|
|
@@ -3291,7 +3438,9 @@ export class KRChatbot extends LitElement {
|
|
|
3291
3438
|
* The Kodaris tab is omitted on the registry server (kodaris.com): that instance
|
|
3292
3439
|
* IS the catalog source, so `globalSkillList` has no remote to pull and always
|
|
3293
3440
|
* returns `[]`. Its own published skills appear on the Your Org tab instead,
|
|
3294
|
-
* carrying a "Global" badge.
|
|
3441
|
+
* carrying a "Global" badge. A localhost backend is the exception: a dev box is
|
|
3442
|
+
* usually registry server and client at once (the self-loopback), and the server
|
|
3443
|
+
* flag alone would hide the catalog it pulls from itself.
|
|
3295
3444
|
*/
|
|
3296
3445
|
_renderSkillBrowse() {
|
|
3297
3446
|
return html `
|
|
@@ -3405,11 +3554,11 @@ export class KRChatbot extends LitElement {
|
|
|
3405
3554
|
<kr-tab id="org" label="Your Org">
|
|
3406
3555
|
${this._renderSkillGrid()}
|
|
3407
3556
|
</kr-tab>
|
|
3408
|
-
${this._aiFrameworkConfig.registryServer
|
|
3557
|
+
${this._aiFrameworkConfig.registryServer !== true || KRHttp.getBaseUrl().includes('localhost') ? html `
|
|
3409
3558
|
<kr-tab id="kodaris" label="Kodaris">
|
|
3410
3559
|
${this._renderSkillGrid(true)}
|
|
3411
3560
|
</kr-tab>
|
|
3412
|
-
`}
|
|
3561
|
+
` : nothing}
|
|
3413
3562
|
</kr-tab-group>
|
|
3414
3563
|
`}
|
|
3415
3564
|
</div>
|
|
@@ -4228,12 +4377,25 @@ export class KRChatbot extends LitElement {
|
|
|
4228
4377
|
// Tool visibility is user-controlled ("Show tools" in the settings
|
|
4229
4378
|
// panel). When off, drop the whole tool row so it doesn't leave an
|
|
4230
4379
|
// empty flex-gap slot in the transcript.
|
|
4231
|
-
if ((msg.type === 'tool_use' || msg.type === 'tool_result') && !this._showTools) {
|
|
4232
|
-
return nothing;
|
|
4233
|
-
}
|
|
4234
4380
|
// A tool_result renders nothing on its own — its tool_use line pulls
|
|
4235
4381
|
// it in (matched by data.toolUseId) and renders it under the ⎿ cliff.
|
|
4236
|
-
|
|
4382
|
+
// The exception is an offer_skill result: its result string is the
|
|
4383
|
+
// offer JSON ({skills, canInstall, note}) the model read too, and the
|
|
4384
|
+
// skills in it render as an Install box, even with tool rows hidden,
|
|
4385
|
+
// since installing is the user's action rather than tool activity.
|
|
4386
|
+
// Parsed here, where statements are allowed; an offer_skill error
|
|
4387
|
+
// result isn't JSON and renders like any other tool result.
|
|
4388
|
+
let offeredSkills = [];
|
|
4389
|
+
if (msg.type === 'tool_result' && msg.data?.toolName === 'offer_skill') {
|
|
4390
|
+
try {
|
|
4391
|
+
offeredSkills = JSON.parse(msg.data.toolResultString).skills || [];
|
|
4392
|
+
}
|
|
4393
|
+
catch { /* not an offer */ }
|
|
4394
|
+
}
|
|
4395
|
+
if ((msg.type === 'tool_use' || msg.type === 'tool_result') && !this._showTools && !offeredSkills.length) {
|
|
4396
|
+
return nothing;
|
|
4397
|
+
}
|
|
4398
|
+
if (msg.type === 'tool_result' && !offeredSkills.length) {
|
|
4237
4399
|
return nothing;
|
|
4238
4400
|
}
|
|
4239
4401
|
// A tool_use line (Claude-CLI style): header "› ToolName(input)" and,
|
|
@@ -4332,6 +4494,61 @@ export class KRChatbot extends LitElement {
|
|
|
4332
4494
|
` : nothing}
|
|
4333
4495
|
</div>
|
|
4334
4496
|
` : nothing}
|
|
4497
|
+
${offeredSkills.length ? html `
|
|
4498
|
+
<div
|
|
4499
|
+
class="confirmation confirmation--inline skill-offer"
|
|
4500
|
+
role="group"
|
|
4501
|
+
aria-label="Install skills"
|
|
4502
|
+
>
|
|
4503
|
+
<div class="confirmation__title">
|
|
4504
|
+
${offeredSkills.length > 1 ? 'Install These Skills?' : `Install "${offeredSkills[0].name}" Skill?`}
|
|
4505
|
+
</div>
|
|
4506
|
+
${offeredSkills.length > 1 ? html `
|
|
4507
|
+
<ol class="confirmation__list">
|
|
4508
|
+
${offeredSkills.map((skill) => html `
|
|
4509
|
+
<li class="confirmation__list-item">
|
|
4510
|
+
<span class="confirmation__list-name">${skill.name}</span>
|
|
4511
|
+
${skill.summary ? html `
|
|
4512
|
+
<span class="confirmation__list-desc">${skill.summary}</span>
|
|
4513
|
+
` : nothing}
|
|
4514
|
+
<span class="confirmation__list-desc">
|
|
4515
|
+
<strong>Price:</strong>
|
|
4516
|
+
${skill.priceLabel}
|
|
4517
|
+
</span>
|
|
4518
|
+
</li>
|
|
4519
|
+
`)}
|
|
4520
|
+
</ol>
|
|
4521
|
+
` : html `
|
|
4522
|
+
${offeredSkills[0].summary ? html `
|
|
4523
|
+
<p class="confirmation__message">${offeredSkills[0].summary}</p>
|
|
4524
|
+
` : nothing}
|
|
4525
|
+
<p class="confirmation__message">
|
|
4526
|
+
<strong>Price:</strong>
|
|
4527
|
+
${offeredSkills[0].priceLabel}
|
|
4528
|
+
</p>
|
|
4529
|
+
`}
|
|
4530
|
+
<div class="confirmation__actions">
|
|
4531
|
+
${msg.data.skillOfferOutcome === 'installed' ? html `
|
|
4532
|
+
<span class="skill-offer__installed">Installed</span>
|
|
4533
|
+
` : msg.data.skillOfferOutcome === 'declined' ? html `
|
|
4534
|
+
<span class="skill-offer__declined">Declined</span>
|
|
4535
|
+
` : html `
|
|
4536
|
+
<kr-button
|
|
4537
|
+
variant="flat"
|
|
4538
|
+
color="primary"
|
|
4539
|
+
size="small"
|
|
4540
|
+
@click=${(e) => this._handleOfferedSkillsInstall(msg, e)}
|
|
4541
|
+
>Install</kr-button>
|
|
4542
|
+
<kr-button
|
|
4543
|
+
variant="outline"
|
|
4544
|
+
color="secondary"
|
|
4545
|
+
size="small"
|
|
4546
|
+
@click=${() => this._handleOfferedSkillsDecline(msg)}
|
|
4547
|
+
>Not now</kr-button>
|
|
4548
|
+
`}
|
|
4549
|
+
</div>
|
|
4550
|
+
</div>
|
|
4551
|
+
` : nothing}
|
|
4335
4552
|
${msg.type === 'action_decision' ? html `
|
|
4336
4553
|
<div class=${classMap({
|
|
4337
4554
|
'decision': true,
|
|
@@ -4461,15 +4678,25 @@ export class KRChatbot extends LitElement {
|
|
|
4461
4678
|
</div>
|
|
4462
4679
|
`;
|
|
4463
4680
|
});
|
|
4464
|
-
if (group[0].type === 'user') {
|
|
4465
|
-
return items;
|
|
4466
|
-
}
|
|
4467
4681
|
// The inline confirmation is this turn's final step, so it renders
|
|
4468
4682
|
// INSIDE the agent-turn wrapper (not as a sibling) — it sits right
|
|
4469
4683
|
// after the last message and the runway falls below it naturally.
|
|
4470
4684
|
// Only on the last group, which is the current (paused) turn.
|
|
4471
4685
|
const isLastGroup = group === messageGroups[messageGroups.length - 1];
|
|
4472
4686
|
const showConfirmation = isLastGroup && this._pendingActions.length && this._inlineConfirm;
|
|
4687
|
+
if (group[0].type === 'user') {
|
|
4688
|
+
// The model can pause for confirmation before writing any text. The
|
|
4689
|
+
// user's message is then the last group and there is no agent turn to
|
|
4690
|
+
// hold the card, so give the card its own wrapper right after it.
|
|
4691
|
+
return html `
|
|
4692
|
+
${items}
|
|
4693
|
+
${showConfirmation ? html `
|
|
4694
|
+
<div class="agent-turn">
|
|
4695
|
+
${this._renderConfirmation()}
|
|
4696
|
+
</div>
|
|
4697
|
+
` : nothing}
|
|
4698
|
+
`;
|
|
4699
|
+
}
|
|
4473
4700
|
// Keep the "thinking" indicator visible while a tool is running or
|
|
4474
4701
|
// the model is between steps with no text yet. The trailing empty
|
|
4475
4702
|
// assistant bubble shows the dots itself; but once a tool line is
|
|
@@ -4744,6 +4971,37 @@ export class KRChatbot extends LitElement {
|
|
|
4744
4971
|
</kr-dialog-footer>
|
|
4745
4972
|
</kr-dialog>
|
|
4746
4973
|
` : nothing}
|
|
4974
|
+
${this._skillOfferConfirm ? html `
|
|
4975
|
+
<kr-dialog
|
|
4976
|
+
opened
|
|
4977
|
+
label="Install Paid Skills"
|
|
4978
|
+
width="480px"
|
|
4979
|
+
@close=${this._handleSkillOfferCancel}
|
|
4980
|
+
>
|
|
4981
|
+
<kr-dialog-content>
|
|
4982
|
+
<div class="skill-install-confirm">
|
|
4983
|
+
<p>These are paid skills. Installing them will charge your account:</p>
|
|
4984
|
+
<ul class="skill-install-confirm__list">
|
|
4985
|
+
${JSON.parse(this._skillOfferConfirm.data.toolResultString).skills.filter((skill) => skill.billable).map((skill) => html `
|
|
4986
|
+
<li>
|
|
4987
|
+
<strong>${skill.name}</strong>
|
|
4988
|
+
${skill.priceLabel}
|
|
4989
|
+
</li>
|
|
4990
|
+
`)}
|
|
4991
|
+
</ul>
|
|
4992
|
+
<p>Please confirm you would like to proceed.</p>
|
|
4993
|
+
</div>
|
|
4994
|
+
</kr-dialog-content>
|
|
4995
|
+
<kr-dialog-footer>
|
|
4996
|
+
<kr-button color="secondary" @click=${this._handleSkillOfferCancel}>Cancel</kr-button>
|
|
4997
|
+
<kr-button
|
|
4998
|
+
variant="flat"
|
|
4999
|
+
color="primary"
|
|
5000
|
+
@click=${this._handleSkillOfferConfirm}
|
|
5001
|
+
>Install</kr-button>
|
|
5002
|
+
</kr-dialog-footer>
|
|
5003
|
+
</kr-dialog>
|
|
5004
|
+
` : nothing}
|
|
4747
5005
|
${this._renderDrawer()}
|
|
4748
5006
|
</div>
|
|
4749
5007
|
`;
|
|
@@ -6625,7 +6883,7 @@ KRChatbot.styles = css `
|
|
|
6625
6883
|
align-items: center;
|
|
6626
6884
|
justify-content: space-between;
|
|
6627
6885
|
gap: 8px;
|
|
6628
|
-
margin-top:
|
|
6886
|
+
margin-top: auto;
|
|
6629
6887
|
margin-left: -14px;
|
|
6630
6888
|
margin-right: -14px;
|
|
6631
6889
|
padding: 14px 14px 0;
|
|
@@ -6638,6 +6896,41 @@ KRChatbot.styles = css `
|
|
|
6638
6896
|
color: #000000;
|
|
6639
6897
|
}
|
|
6640
6898
|
|
|
6899
|
+
/* The install offer in the transcript for the registry skill the assistant offered
|
|
6900
|
+
(offer_skill) because it isn't installed here. Styled as the inline run-tool
|
|
6901
|
+
confirmation (title, plain-language lines, button row) so asking the user to
|
|
6902
|
+
install reads the same as asking them to approve an action. */
|
|
6903
|
+
/* Boxed, unlike the inline run-tool confirmation: the same border, radius and
|
|
6904
|
+
background as the floating confirmation card so it reads as one of them, but
|
|
6905
|
+
flowing in the transcript. */
|
|
6906
|
+
.skill-offer {
|
|
6907
|
+
padding: 20px 24px;
|
|
6908
|
+
border: 1px solid #d8d8d8;
|
|
6909
|
+
border-radius: 8px;
|
|
6910
|
+
background: var(--kr-chatbot-bg);
|
|
6911
|
+
}
|
|
6912
|
+
|
|
6913
|
+
.skill-offer .confirmation__message + .confirmation__message {
|
|
6914
|
+
margin-top: 8px;
|
|
6915
|
+
}
|
|
6916
|
+
|
|
6917
|
+
/* The offer's recorded outcome, shown in place of the buttons. */
|
|
6918
|
+
.skill-offer__installed,
|
|
6919
|
+
.skill-offer__declined {
|
|
6920
|
+
font-size: 14px;
|
|
6921
|
+
font-weight: 600;
|
|
6922
|
+
}
|
|
6923
|
+
|
|
6924
|
+
.skill-offer__installed {
|
|
6925
|
+
/* Darker than the alert's success green (#16a34a) so a bold 14px label on white
|
|
6926
|
+
keeps text-level contrast. */
|
|
6927
|
+
color: #15803d;
|
|
6928
|
+
}
|
|
6929
|
+
|
|
6930
|
+
.skill-offer__declined {
|
|
6931
|
+
color: var(--kr-chatbot-text-secondary);
|
|
6932
|
+
}
|
|
6933
|
+
|
|
6641
6934
|
.skill-install-confirm {
|
|
6642
6935
|
display: flex;
|
|
6643
6936
|
flex-direction: column;
|
|
@@ -6650,6 +6943,11 @@ KRChatbot.styles = css `
|
|
|
6650
6943
|
margin: 0;
|
|
6651
6944
|
}
|
|
6652
6945
|
|
|
6946
|
+
.skill-install-confirm__list {
|
|
6947
|
+
margin: 0;
|
|
6948
|
+
padding-left: 20px;
|
|
6949
|
+
}
|
|
6950
|
+
|
|
6653
6951
|
.skill-card__name {
|
|
6654
6952
|
font-weight: 600;
|
|
6655
6953
|
}
|
|
@@ -7050,6 +7348,9 @@ __decorate([
|
|
|
7050
7348
|
__decorate([
|
|
7051
7349
|
state()
|
|
7052
7350
|
], KRChatbot.prototype, "_skillInstallConfirm", void 0);
|
|
7351
|
+
__decorate([
|
|
7352
|
+
state()
|
|
7353
|
+
], KRChatbot.prototype, "_skillOfferConfirm", void 0);
|
|
7053
7354
|
__decorate([
|
|
7054
7355
|
state()
|
|
7055
7356
|
], KRChatbot.prototype, "_skillBrowseSource", void 0);
|