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