@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
|
@@ -3184,6 +3184,14 @@ class KRChatbot extends i$3 {
|
|
|
3184
3184
|
* while it is set and the request only fires once the user confirms.
|
|
3185
3185
|
*/
|
|
3186
3186
|
this._skillInstallConfirm = null;
|
|
3187
|
+
/**
|
|
3188
|
+
* The transcript offer (an offer_skill tool_result) with paid skills awaiting the user's
|
|
3189
|
+
* install confirmation, else null. An offer IS that tool call: its result string is the offer
|
|
3190
|
+
* JSON (`{skills, canInstall, note}`) and, once the user acts, its row gains
|
|
3191
|
+
* `skillOfferOutcome` (`installed` or `declined`), which the server stores so a reload shows
|
|
3192
|
+
* the same outcome.
|
|
3193
|
+
*/
|
|
3194
|
+
this._skillOfferConfirm = null;
|
|
3187
3195
|
/**
|
|
3188
3196
|
* Active tab in the browse dialog. `org` shows `_orgSkills` (this instance's
|
|
3189
3197
|
* skills); `kodaris` shows `_globalSkills` (the shared global catalog).
|
|
@@ -4182,9 +4190,11 @@ class KRChatbot extends i$3 {
|
|
|
4182
4190
|
* Enable or disable a global skill on this instance via
|
|
4183
4191
|
* `/aiskills/global/{code}/enabled`, then reflect the server's result on the
|
|
4184
4192
|
* matching card. Ignores clicks while a request for the same code is pending.
|
|
4193
|
+
* Installing a billable skill opens a confirmation instead; see
|
|
4194
|
+
* `_handleSkillInstallConfirm` for the request that runs once the user accepts.
|
|
4185
4195
|
*/
|
|
4186
4196
|
_handleGlobalSkillEnable(skill, e) {
|
|
4187
|
-
// The card body
|
|
4197
|
+
// The card body opens the detail view; the install button must not also do that.
|
|
4188
4198
|
e.stopPropagation();
|
|
4189
4199
|
// The button is shown to everyone so the catalog reads the same for all users,
|
|
4190
4200
|
// but the enable endpoint requires administrator/superuser/skillEdit. Without
|
|
@@ -4200,46 +4210,18 @@ class KRChatbot extends i$3 {
|
|
|
4200
4210
|
if (this._globalSkillPending.has(skill.code)) {
|
|
4201
4211
|
return;
|
|
4202
4212
|
}
|
|
4203
|
-
const btn = e.currentTarget;
|
|
4204
4213
|
// Installing a billable skill charges the account, so confirm before sending.
|
|
4205
4214
|
// Uninstalling is never billed and free installs are one click to undo.
|
|
4206
4215
|
if (!skill.enabled && skill.billable) {
|
|
4207
4216
|
this._skillInstallConfirm = skill;
|
|
4208
4217
|
return;
|
|
4209
4218
|
}
|
|
4210
|
-
this._enableGlobalSkill(skill, btn);
|
|
4211
|
-
}
|
|
4212
|
-
/** Cancel the billable install confirmation without sending anything. */
|
|
4213
|
-
_handleSkillInstallCancel() {
|
|
4214
|
-
this._skillInstallConfirm = null;
|
|
4215
|
-
}
|
|
4216
|
-
/**
|
|
4217
|
-
* The user accepted the charge: run the install with the dialog's own Install
|
|
4218
|
-
* button spinning, and close the dialog once the server confirms. On failure
|
|
4219
|
-
* the button shows the error and the dialog stays open so they can retry or cancel.
|
|
4220
|
-
*/
|
|
4221
|
-
_handleSkillInstallConfirm(e) {
|
|
4222
|
-
if (!this._skillInstallConfirm) {
|
|
4223
|
-
return;
|
|
4224
|
-
}
|
|
4225
|
-
this._enableGlobalSkill(this._skillInstallConfirm, e.currentTarget).then((ok) => {
|
|
4226
|
-
if (ok) {
|
|
4227
|
-
this._skillInstallConfirm = null;
|
|
4228
|
-
}
|
|
4229
|
-
});
|
|
4230
|
-
}
|
|
4231
|
-
/**
|
|
4232
|
-
* Send the enable/disable request for a global skill and reflect the server's
|
|
4233
|
-
* result on its card. `btn` is the button that triggered it (the card's
|
|
4234
|
-
* Install button, or the confirmation dialog's), whose spinner shows while the
|
|
4235
|
-
* request is in flight. Resolves true on success, false on failure.
|
|
4236
|
-
*/
|
|
4237
|
-
_enableGlobalSkill(skill, btn) {
|
|
4238
4219
|
// Drive the clicked button's own spinner (KRButton disables itself while
|
|
4239
4220
|
// loading, so a second click can't fire until the request settles).
|
|
4221
|
+
const btn = e.currentTarget;
|
|
4240
4222
|
this._globalSkillPending.add(skill.code);
|
|
4241
4223
|
btn?.showLoading();
|
|
4242
|
-
|
|
4224
|
+
KRHttp.fetch({
|
|
4243
4225
|
url: `/api/system/opensearch/aiskills/global/${encodeURIComponent(skill.code)}/enabled`,
|
|
4244
4226
|
method: 'POST',
|
|
4245
4227
|
body: { enabled: !skill.enabled },
|
|
@@ -4265,17 +4247,181 @@ class KRChatbot extends i$3 {
|
|
|
4265
4247
|
type: 'success',
|
|
4266
4248
|
});
|
|
4267
4249
|
}
|
|
4268
|
-
return true;
|
|
4269
4250
|
})
|
|
4270
4251
|
.catch((error) => {
|
|
4271
4252
|
console.error('kr-chatbot: global skill enable failed', error);
|
|
4272
4253
|
btn?.showError('Error');
|
|
4273
|
-
return false;
|
|
4274
4254
|
})
|
|
4275
4255
|
.finally(() => {
|
|
4276
4256
|
this._globalSkillPending.delete(skill.code);
|
|
4277
4257
|
});
|
|
4278
4258
|
}
|
|
4259
|
+
/** Cancel the billable install confirmation without sending anything. */
|
|
4260
|
+
_handleSkillInstallCancel() {
|
|
4261
|
+
this._skillInstallConfirm = null;
|
|
4262
|
+
}
|
|
4263
|
+
/**
|
|
4264
|
+
* The user accepted the charge: run the install with the dialog's own Install
|
|
4265
|
+
* button spinning, and close the dialog once the server confirms. On failure
|
|
4266
|
+
* the button shows the error and the dialog stays open so they can retry or cancel.
|
|
4267
|
+
*/
|
|
4268
|
+
_handleSkillInstallConfirm(e) {
|
|
4269
|
+
if (!this._skillInstallConfirm) {
|
|
4270
|
+
return;
|
|
4271
|
+
}
|
|
4272
|
+
if (this._globalSkillPending.has(this._skillInstallConfirm.code)) {
|
|
4273
|
+
return;
|
|
4274
|
+
}
|
|
4275
|
+
const skill = this._skillInstallConfirm;
|
|
4276
|
+
const btn = e.currentTarget;
|
|
4277
|
+
this._globalSkillPending.add(skill.code);
|
|
4278
|
+
btn?.showLoading();
|
|
4279
|
+
KRHttp.fetch({
|
|
4280
|
+
url: `/api/system/opensearch/aiskills/global/${encodeURIComponent(skill.code)}/enabled`,
|
|
4281
|
+
method: 'POST',
|
|
4282
|
+
body: { enabled: true },
|
|
4283
|
+
})
|
|
4284
|
+
.then((r) => r.json())
|
|
4285
|
+
.then((res) => {
|
|
4286
|
+
// Reflect the server's returned flag on the card and close the confirmation.
|
|
4287
|
+
skill.enabled = res?.data?.enabled;
|
|
4288
|
+
btn?.reset();
|
|
4289
|
+
this._skillInstallConfirm = null;
|
|
4290
|
+
this.requestUpdate();
|
|
4291
|
+
KRSnackbar.show({
|
|
4292
|
+
title: 'Skill Installed',
|
|
4293
|
+
message: `${skill.name} is now available to use.`,
|
|
4294
|
+
type: 'success',
|
|
4295
|
+
});
|
|
4296
|
+
})
|
|
4297
|
+
.catch((error) => {
|
|
4298
|
+
console.error('kr-chatbot: global skill install failed', error);
|
|
4299
|
+
btn?.showError('Error');
|
|
4300
|
+
})
|
|
4301
|
+
.finally(() => {
|
|
4302
|
+
this._globalSkillPending.delete(skill.code);
|
|
4303
|
+
});
|
|
4304
|
+
}
|
|
4305
|
+
/**
|
|
4306
|
+
* Install on a transcript offer: install every skill the assistant offered, together. The
|
|
4307
|
+
* offer is all-or-nothing because the task needs all of them (one without the other would
|
|
4308
|
+
* not get it done). Same permission check and paid-skill confirmation as the Browse dialog's
|
|
4309
|
+
* Install button, applied to the set: without the role, say who to ask; with any paid skill
|
|
4310
|
+
* in the set, confirm the charges first (`_handleSkillOfferConfirm` runs the install once the
|
|
4311
|
+
* user accepts).
|
|
4312
|
+
*/
|
|
4313
|
+
_handleOfferedSkillsInstall(msg, e) {
|
|
4314
|
+
const offer = JSON.parse(msg.data.toolResultString);
|
|
4315
|
+
if (!offer.canInstall) {
|
|
4316
|
+
KRSnackbar.show({
|
|
4317
|
+
title: 'Permission Required',
|
|
4318
|
+
message: 'You do not have permission to install skills. Please contact your site administrator.',
|
|
4319
|
+
type: 'error',
|
|
4320
|
+
});
|
|
4321
|
+
return;
|
|
4322
|
+
}
|
|
4323
|
+
if (offer.skills.some((skill) => this._globalSkillPending.has(skill.code))) {
|
|
4324
|
+
return;
|
|
4325
|
+
}
|
|
4326
|
+
if (offer.skills.some((skill) => skill.billable)) {
|
|
4327
|
+
this._skillOfferConfirm = msg;
|
|
4328
|
+
return;
|
|
4329
|
+
}
|
|
4330
|
+
this._installOfferedSkills(msg, e.currentTarget);
|
|
4331
|
+
}
|
|
4332
|
+
/** Cancel the offer's paid-skill confirmation without installing anything. */
|
|
4333
|
+
_handleSkillOfferCancel() {
|
|
4334
|
+
this._skillOfferConfirm = null;
|
|
4335
|
+
}
|
|
4336
|
+
/** The user accepted the charges: install the offered set with the dialog's own button spinning. */
|
|
4337
|
+
_handleSkillOfferConfirm(e) {
|
|
4338
|
+
if (!this._skillOfferConfirm) {
|
|
4339
|
+
return;
|
|
4340
|
+
}
|
|
4341
|
+
this._installOfferedSkills(this._skillOfferConfirm, e.currentTarget);
|
|
4342
|
+
}
|
|
4343
|
+
/**
|
|
4344
|
+
* Install the offered skills one after another through the same enable request the Browse
|
|
4345
|
+
* dialog's card uses, driving the clicked button's spinner. A skill already on (say, installed
|
|
4346
|
+
* from the Browse dialog meanwhile) is a no-op for the server, so none is skipped. When every
|
|
4347
|
+
* one is on: record the outcome on the offer's tool_result data (so this render updates at
|
|
4348
|
+
* once) and on its row (so a reload shows the same thing; best effort, the transcript already
|
|
4349
|
+
* shows it), close the paid confirmation if it was open, and tell the assistant, as the user,
|
|
4350
|
+
* that the skills are installed so it re-runs list_skills and carries on with the original
|
|
4351
|
+
* request. A failure stops the sequence: the ones already on stay on, the button shows the
|
|
4352
|
+
* error, and nothing is sent, so the user can retry the offer.
|
|
4353
|
+
*/
|
|
4354
|
+
_installOfferedSkills(msg, btn) {
|
|
4355
|
+
const skills = JSON.parse(msg.data.toolResultString).skills;
|
|
4356
|
+
for (const skill of skills) {
|
|
4357
|
+
this._globalSkillPending.add(skill.code);
|
|
4358
|
+
}
|
|
4359
|
+
btn?.showLoading();
|
|
4360
|
+
let chain = Promise.resolve();
|
|
4361
|
+
for (const skill of skills) {
|
|
4362
|
+
chain = chain
|
|
4363
|
+
.then(() => KRHttp.fetch({
|
|
4364
|
+
url: `/api/system/opensearch/aiskills/global/${encodeURIComponent(skill.code)}/enabled`,
|
|
4365
|
+
method: 'POST',
|
|
4366
|
+
body: { enabled: true },
|
|
4367
|
+
}));
|
|
4368
|
+
}
|
|
4369
|
+
chain
|
|
4370
|
+
.then(() => {
|
|
4371
|
+
btn?.reset();
|
|
4372
|
+
this._skillOfferConfirm = null;
|
|
4373
|
+
msg.data.skillOfferOutcome = 'installed';
|
|
4374
|
+
this.requestUpdate();
|
|
4375
|
+
if (this.conversationId != null) {
|
|
4376
|
+
KRHttp.fetch({
|
|
4377
|
+
url: `/api/system/conversation/${this.conversationId}/skillOffer/${encodeURIComponent(msg.data.toolUseId)}`,
|
|
4378
|
+
method: 'POST',
|
|
4379
|
+
body: {
|
|
4380
|
+
outcome: 'installed',
|
|
4381
|
+
},
|
|
4382
|
+
}).catch((error) => {
|
|
4383
|
+
console.error('kr-chatbot: failed to record skill offer outcome', error);
|
|
4384
|
+
});
|
|
4385
|
+
}
|
|
4386
|
+
this._inputValue = `I installed ${skills.map((skill) => skill.name).join(' and ')}. Please continue.`;
|
|
4387
|
+
this._handleSubmit();
|
|
4388
|
+
})
|
|
4389
|
+
.catch((error) => {
|
|
4390
|
+
console.error('kr-chatbot: skill offer install failed', error);
|
|
4391
|
+
btn?.showError('Error');
|
|
4392
|
+
})
|
|
4393
|
+
.finally(() => {
|
|
4394
|
+
for (const skill of skills) {
|
|
4395
|
+
this._globalSkillPending.delete(skill.code);
|
|
4396
|
+
}
|
|
4397
|
+
});
|
|
4398
|
+
}
|
|
4399
|
+
/**
|
|
4400
|
+
* Not now on a transcript offer: record the decline (the box stays, showing Declined in
|
|
4401
|
+
* place of the buttons) and tell the assistant, as the user, that they declined, so it can
|
|
4402
|
+
* carry on without the skills instead of waiting for an install. The outcome is set on the
|
|
4403
|
+
* offer's tool_result data so this render updates at once, and written to that row on the
|
|
4404
|
+
* server so a reload shows the same thing. The write is best effort: the transcript already
|
|
4405
|
+
* shows the outcome, and the user message tells the assistant. The row is addressed by the
|
|
4406
|
+
* conversation and the tool call's own toolUseId, which every tool row already carries.
|
|
4407
|
+
*/
|
|
4408
|
+
_handleOfferedSkillsDecline(msg) {
|
|
4409
|
+
msg.data.skillOfferOutcome = 'declined';
|
|
4410
|
+
this.requestUpdate();
|
|
4411
|
+
if (this.conversationId != null) {
|
|
4412
|
+
KRHttp.fetch({
|
|
4413
|
+
url: `/api/system/conversation/${this.conversationId}/skillOffer/${encodeURIComponent(msg.data.toolUseId)}`,
|
|
4414
|
+
method: 'POST',
|
|
4415
|
+
body: {
|
|
4416
|
+
outcome: 'declined',
|
|
4417
|
+
},
|
|
4418
|
+
}).catch((error) => {
|
|
4419
|
+
console.error('kr-chatbot: failed to record skill offer outcome', error);
|
|
4420
|
+
});
|
|
4421
|
+
}
|
|
4422
|
+
this._inputValue = `I don't want to install ${JSON.parse(msg.data.toolResultString).skills.map((skill) => skill.name).join(' and ')} right now.`;
|
|
4423
|
+
this._handleSubmit();
|
|
4424
|
+
}
|
|
4279
4425
|
/** The `+` button toggles the skill/attachment menu open (showing all skills). */
|
|
4280
4426
|
_handlePlusClick() {
|
|
4281
4427
|
if (this._skillMenuOpened) {
|
|
@@ -4465,9 +4611,10 @@ class KRChatbot extends i$3 {
|
|
|
4465
4611
|
this._skillBrowseQuery = '';
|
|
4466
4612
|
this._skillBrowseOpened = true;
|
|
4467
4613
|
// Fill both tabs up front so switching between them is instant, not stale.
|
|
4468
|
-
// The Kodaris tab isn't rendered on the registry server
|
|
4614
|
+
// The Kodaris tab isn't rendered on the registry server (except a localhost dev box,
|
|
4615
|
+
// which is server and client at once), so skip its fetch there.
|
|
4469
4616
|
this._searchOrgSkills('');
|
|
4470
|
-
if (this._aiFrameworkConfig.registryServer !== true) {
|
|
4617
|
+
if (this._aiFrameworkConfig.registryServer !== true || KRHttp.getBaseUrl().includes('localhost')) {
|
|
4471
4618
|
this._searchGlobalSkills('');
|
|
4472
4619
|
}
|
|
4473
4620
|
}
|
|
@@ -4501,7 +4648,7 @@ class KRChatbot extends i$3 {
|
|
|
4501
4648
|
this._skillBrowseQuery = e.target.value;
|
|
4502
4649
|
// Filter both catalogs so whichever tab the user switches to is already current.
|
|
4503
4650
|
this._searchOrgSkills(this._skillBrowseQuery);
|
|
4504
|
-
if (this._aiFrameworkConfig.registryServer !== true) {
|
|
4651
|
+
if (this._aiFrameworkConfig.registryServer !== true || KRHttp.getBaseUrl().includes('localhost')) {
|
|
4505
4652
|
this._searchGlobalSkills(this._skillBrowseQuery);
|
|
4506
4653
|
}
|
|
4507
4654
|
}
|
|
@@ -6010,7 +6157,9 @@ class KRChatbot extends i$3 {
|
|
|
6010
6157
|
* The Kodaris tab is omitted on the registry server (kodaris.com): that instance
|
|
6011
6158
|
* IS the catalog source, so `globalSkillList` has no remote to pull and always
|
|
6012
6159
|
* returns `[]`. Its own published skills appear on the Your Org tab instead,
|
|
6013
|
-
* carrying a "Global" badge.
|
|
6160
|
+
* carrying a "Global" badge. A localhost backend is the exception: a dev box is
|
|
6161
|
+
* usually registry server and client at once (the self-loopback), and the server
|
|
6162
|
+
* flag alone would hide the catalog it pulls from itself.
|
|
6014
6163
|
*/
|
|
6015
6164
|
_renderSkillBrowse() {
|
|
6016
6165
|
return b `
|
|
@@ -6124,11 +6273,11 @@ class KRChatbot extends i$3 {
|
|
|
6124
6273
|
<kr-tab id="org" label="Your Org">
|
|
6125
6274
|
${this._renderSkillGrid()}
|
|
6126
6275
|
</kr-tab>
|
|
6127
|
-
${this._aiFrameworkConfig.registryServer
|
|
6276
|
+
${this._aiFrameworkConfig.registryServer !== true || KRHttp.getBaseUrl().includes('localhost') ? b `
|
|
6128
6277
|
<kr-tab id="kodaris" label="Kodaris">
|
|
6129
6278
|
${this._renderSkillGrid(true)}
|
|
6130
6279
|
</kr-tab>
|
|
6131
|
-
`}
|
|
6280
|
+
` : A}
|
|
6132
6281
|
</kr-tab-group>
|
|
6133
6282
|
`}
|
|
6134
6283
|
</div>
|
|
@@ -6947,12 +7096,25 @@ class KRChatbot extends i$3 {
|
|
|
6947
7096
|
// Tool visibility is user-controlled ("Show tools" in the settings
|
|
6948
7097
|
// panel). When off, drop the whole tool row so it doesn't leave an
|
|
6949
7098
|
// empty flex-gap slot in the transcript.
|
|
6950
|
-
if ((msg.type === 'tool_use' || msg.type === 'tool_result') && !this._showTools) {
|
|
6951
|
-
return A;
|
|
6952
|
-
}
|
|
6953
7099
|
// A tool_result renders nothing on its own — its tool_use line pulls
|
|
6954
7100
|
// it in (matched by data.toolUseId) and renders it under the ⎿ cliff.
|
|
6955
|
-
|
|
7101
|
+
// The exception is an offer_skill result: its result string is the
|
|
7102
|
+
// offer JSON ({skills, canInstall, note}) the model read too, and the
|
|
7103
|
+
// skills in it render as an Install box, even with tool rows hidden,
|
|
7104
|
+
// since installing is the user's action rather than tool activity.
|
|
7105
|
+
// Parsed here, where statements are allowed; an offer_skill error
|
|
7106
|
+
// result isn't JSON and renders like any other tool result.
|
|
7107
|
+
let offeredSkills = [];
|
|
7108
|
+
if (msg.type === 'tool_result' && msg.data?.toolName === 'offer_skill') {
|
|
7109
|
+
try {
|
|
7110
|
+
offeredSkills = JSON.parse(msg.data.toolResultString).skills || [];
|
|
7111
|
+
}
|
|
7112
|
+
catch { /* not an offer */ }
|
|
7113
|
+
}
|
|
7114
|
+
if ((msg.type === 'tool_use' || msg.type === 'tool_result') && !this._showTools && !offeredSkills.length) {
|
|
7115
|
+
return A;
|
|
7116
|
+
}
|
|
7117
|
+
if (msg.type === 'tool_result' && !offeredSkills.length) {
|
|
6956
7118
|
return A;
|
|
6957
7119
|
}
|
|
6958
7120
|
// A tool_use line (Claude-CLI style): header "› ToolName(input)" and,
|
|
@@ -7051,6 +7213,61 @@ class KRChatbot extends i$3 {
|
|
|
7051
7213
|
` : A}
|
|
7052
7214
|
</div>
|
|
7053
7215
|
` : A}
|
|
7216
|
+
${offeredSkills.length ? b `
|
|
7217
|
+
<div
|
|
7218
|
+
class="confirmation confirmation--inline skill-offer"
|
|
7219
|
+
role="group"
|
|
7220
|
+
aria-label="Install skills"
|
|
7221
|
+
>
|
|
7222
|
+
<div class="confirmation__title">
|
|
7223
|
+
${offeredSkills.length > 1 ? 'Install These Skills?' : `Install "${offeredSkills[0].name}" Skill?`}
|
|
7224
|
+
</div>
|
|
7225
|
+
${offeredSkills.length > 1 ? b `
|
|
7226
|
+
<ol class="confirmation__list">
|
|
7227
|
+
${offeredSkills.map((skill) => b `
|
|
7228
|
+
<li class="confirmation__list-item">
|
|
7229
|
+
<span class="confirmation__list-name">${skill.name}</span>
|
|
7230
|
+
${skill.summary ? b `
|
|
7231
|
+
<span class="confirmation__list-desc">${skill.summary}</span>
|
|
7232
|
+
` : A}
|
|
7233
|
+
<span class="confirmation__list-desc">
|
|
7234
|
+
<strong>Price:</strong>
|
|
7235
|
+
${skill.priceLabel}
|
|
7236
|
+
</span>
|
|
7237
|
+
</li>
|
|
7238
|
+
`)}
|
|
7239
|
+
</ol>
|
|
7240
|
+
` : b `
|
|
7241
|
+
${offeredSkills[0].summary ? b `
|
|
7242
|
+
<p class="confirmation__message">${offeredSkills[0].summary}</p>
|
|
7243
|
+
` : A}
|
|
7244
|
+
<p class="confirmation__message">
|
|
7245
|
+
<strong>Price:</strong>
|
|
7246
|
+
${offeredSkills[0].priceLabel}
|
|
7247
|
+
</p>
|
|
7248
|
+
`}
|
|
7249
|
+
<div class="confirmation__actions">
|
|
7250
|
+
${msg.data.skillOfferOutcome === 'installed' ? b `
|
|
7251
|
+
<span class="skill-offer__installed">Installed</span>
|
|
7252
|
+
` : msg.data.skillOfferOutcome === 'declined' ? b `
|
|
7253
|
+
<span class="skill-offer__declined">Declined</span>
|
|
7254
|
+
` : b `
|
|
7255
|
+
<kr-button
|
|
7256
|
+
variant="flat"
|
|
7257
|
+
color="primary"
|
|
7258
|
+
size="small"
|
|
7259
|
+
@click=${(e) => this._handleOfferedSkillsInstall(msg, e)}
|
|
7260
|
+
>Install</kr-button>
|
|
7261
|
+
<kr-button
|
|
7262
|
+
variant="outline"
|
|
7263
|
+
color="secondary"
|
|
7264
|
+
size="small"
|
|
7265
|
+
@click=${() => this._handleOfferedSkillsDecline(msg)}
|
|
7266
|
+
>Not now</kr-button>
|
|
7267
|
+
`}
|
|
7268
|
+
</div>
|
|
7269
|
+
</div>
|
|
7270
|
+
` : A}
|
|
7054
7271
|
${msg.type === 'action_decision' ? b `
|
|
7055
7272
|
<div class=${e({
|
|
7056
7273
|
'decision': true,
|
|
@@ -7180,15 +7397,25 @@ class KRChatbot extends i$3 {
|
|
|
7180
7397
|
</div>
|
|
7181
7398
|
`;
|
|
7182
7399
|
});
|
|
7183
|
-
if (group[0].type === 'user') {
|
|
7184
|
-
return items;
|
|
7185
|
-
}
|
|
7186
7400
|
// The inline confirmation is this turn's final step, so it renders
|
|
7187
7401
|
// INSIDE the agent-turn wrapper (not as a sibling) — it sits right
|
|
7188
7402
|
// after the last message and the runway falls below it naturally.
|
|
7189
7403
|
// Only on the last group, which is the current (paused) turn.
|
|
7190
7404
|
const isLastGroup = group === messageGroups[messageGroups.length - 1];
|
|
7191
7405
|
const showConfirmation = isLastGroup && this._pendingActions.length && this._inlineConfirm;
|
|
7406
|
+
if (group[0].type === 'user') {
|
|
7407
|
+
// The model can pause for confirmation before writing any text. The
|
|
7408
|
+
// user's message is then the last group and there is no agent turn to
|
|
7409
|
+
// hold the card, so give the card its own wrapper right after it.
|
|
7410
|
+
return b `
|
|
7411
|
+
${items}
|
|
7412
|
+
${showConfirmation ? b `
|
|
7413
|
+
<div class="agent-turn">
|
|
7414
|
+
${this._renderConfirmation()}
|
|
7415
|
+
</div>
|
|
7416
|
+
` : A}
|
|
7417
|
+
`;
|
|
7418
|
+
}
|
|
7192
7419
|
// Keep the "thinking" indicator visible while a tool is running or
|
|
7193
7420
|
// the model is between steps with no text yet. The trailing empty
|
|
7194
7421
|
// assistant bubble shows the dots itself; but once a tool line is
|
|
@@ -7463,6 +7690,37 @@ class KRChatbot extends i$3 {
|
|
|
7463
7690
|
</kr-dialog-footer>
|
|
7464
7691
|
</kr-dialog>
|
|
7465
7692
|
` : A}
|
|
7693
|
+
${this._skillOfferConfirm ? b `
|
|
7694
|
+
<kr-dialog
|
|
7695
|
+
opened
|
|
7696
|
+
label="Install Paid Skills"
|
|
7697
|
+
width="480px"
|
|
7698
|
+
@close=${this._handleSkillOfferCancel}
|
|
7699
|
+
>
|
|
7700
|
+
<kr-dialog-content>
|
|
7701
|
+
<div class="skill-install-confirm">
|
|
7702
|
+
<p>These are paid skills. Installing them will charge your account:</p>
|
|
7703
|
+
<ul class="skill-install-confirm__list">
|
|
7704
|
+
${JSON.parse(this._skillOfferConfirm.data.toolResultString).skills.filter((skill) => skill.billable).map((skill) => b `
|
|
7705
|
+
<li>
|
|
7706
|
+
<strong>${skill.name}</strong>
|
|
7707
|
+
${skill.priceLabel}
|
|
7708
|
+
</li>
|
|
7709
|
+
`)}
|
|
7710
|
+
</ul>
|
|
7711
|
+
<p>Please confirm you would like to proceed.</p>
|
|
7712
|
+
</div>
|
|
7713
|
+
</kr-dialog-content>
|
|
7714
|
+
<kr-dialog-footer>
|
|
7715
|
+
<kr-button color="secondary" @click=${this._handleSkillOfferCancel}>Cancel</kr-button>
|
|
7716
|
+
<kr-button
|
|
7717
|
+
variant="flat"
|
|
7718
|
+
color="primary"
|
|
7719
|
+
@click=${this._handleSkillOfferConfirm}
|
|
7720
|
+
>Install</kr-button>
|
|
7721
|
+
</kr-dialog-footer>
|
|
7722
|
+
</kr-dialog>
|
|
7723
|
+
` : A}
|
|
7466
7724
|
${this._renderDrawer()}
|
|
7467
7725
|
</div>
|
|
7468
7726
|
`;
|
|
@@ -9344,7 +9602,7 @@ KRChatbot.styles = i$6 `
|
|
|
9344
9602
|
align-items: center;
|
|
9345
9603
|
justify-content: space-between;
|
|
9346
9604
|
gap: 8px;
|
|
9347
|
-
margin-top:
|
|
9605
|
+
margin-top: auto;
|
|
9348
9606
|
margin-left: -14px;
|
|
9349
9607
|
margin-right: -14px;
|
|
9350
9608
|
padding: 14px 14px 0;
|
|
@@ -9357,6 +9615,41 @@ KRChatbot.styles = i$6 `
|
|
|
9357
9615
|
color: #000000;
|
|
9358
9616
|
}
|
|
9359
9617
|
|
|
9618
|
+
/* The install offer in the transcript for the registry skill the assistant offered
|
|
9619
|
+
(offer_skill) because it isn't installed here. Styled as the inline run-tool
|
|
9620
|
+
confirmation (title, plain-language lines, button row) so asking the user to
|
|
9621
|
+
install reads the same as asking them to approve an action. */
|
|
9622
|
+
/* Boxed, unlike the inline run-tool confirmation: the same border, radius and
|
|
9623
|
+
background as the floating confirmation card so it reads as one of them, but
|
|
9624
|
+
flowing in the transcript. */
|
|
9625
|
+
.skill-offer {
|
|
9626
|
+
padding: 20px 24px;
|
|
9627
|
+
border: 1px solid #d8d8d8;
|
|
9628
|
+
border-radius: 8px;
|
|
9629
|
+
background: var(--kr-chatbot-bg);
|
|
9630
|
+
}
|
|
9631
|
+
|
|
9632
|
+
.skill-offer .confirmation__message + .confirmation__message {
|
|
9633
|
+
margin-top: 8px;
|
|
9634
|
+
}
|
|
9635
|
+
|
|
9636
|
+
/* The offer's recorded outcome, shown in place of the buttons. */
|
|
9637
|
+
.skill-offer__installed,
|
|
9638
|
+
.skill-offer__declined {
|
|
9639
|
+
font-size: 14px;
|
|
9640
|
+
font-weight: 600;
|
|
9641
|
+
}
|
|
9642
|
+
|
|
9643
|
+
.skill-offer__installed {
|
|
9644
|
+
/* Darker than the alert's success green (#16a34a) so a bold 14px label on white
|
|
9645
|
+
keeps text-level contrast. */
|
|
9646
|
+
color: #15803d;
|
|
9647
|
+
}
|
|
9648
|
+
|
|
9649
|
+
.skill-offer__declined {
|
|
9650
|
+
color: var(--kr-chatbot-text-secondary);
|
|
9651
|
+
}
|
|
9652
|
+
|
|
9360
9653
|
.skill-install-confirm {
|
|
9361
9654
|
display: flex;
|
|
9362
9655
|
flex-direction: column;
|
|
@@ -9369,6 +9662,11 @@ KRChatbot.styles = i$6 `
|
|
|
9369
9662
|
margin: 0;
|
|
9370
9663
|
}
|
|
9371
9664
|
|
|
9665
|
+
.skill-install-confirm__list {
|
|
9666
|
+
margin: 0;
|
|
9667
|
+
padding-left: 20px;
|
|
9668
|
+
}
|
|
9669
|
+
|
|
9372
9670
|
.skill-card__name {
|
|
9373
9671
|
font-weight: 600;
|
|
9374
9672
|
}
|
|
@@ -9769,6 +10067,9 @@ __decorate$5([
|
|
|
9769
10067
|
__decorate$5([
|
|
9770
10068
|
r()
|
|
9771
10069
|
], KRChatbot.prototype, "_skillInstallConfirm", void 0);
|
|
10070
|
+
__decorate$5([
|
|
10071
|
+
r()
|
|
10072
|
+
], KRChatbot.prototype, "_skillOfferConfirm", void 0);
|
|
9772
10073
|
__decorate$5([
|
|
9773
10074
|
r()
|
|
9774
10075
|
], KRChatbot.prototype, "_skillBrowseSource", void 0);
|