@tylertech/forge-ai 0.8.0 → 0.8.2
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/custom-elements.json +1574 -1507
- package/dist/ai-assistant-response/ai-assistant-response.d.ts +2 -2
- package/dist/ai-assistant-response/ai-assistant-response.mjs +6 -5
- package/dist/ai-assistant-response/ai-assistant-response.scss.mjs +1 -1
- package/dist/ai-chatbot/ai-chatbot.mjs +18 -4
- package/dist/ai-message-thread/ai-message-thread.d.ts +4 -4
- package/dist/ai-message-thread/ai-message-thread.mjs +4 -4
- package/dist/ai-message-thread/index.d.ts +1 -1
- package/dist/ai-response-message-toolbar/ai-response-message-toolbar.d.ts +41 -0
- package/dist/ai-response-message-toolbar/ai-response-message-toolbar.mjs +230 -0
- package/dist/{ai-actions-toolbar/ai-actions-toolbar.scss.mjs → ai-response-message-toolbar/ai-response-message-toolbar.scss.mjs} +1 -1
- package/dist/ai-response-message-toolbar/index.d.ts +1 -0
- package/dist/ai-response-message-toolbar/index.mjs +5 -0
- package/dist/ai-user-message/ai-user-message.mjs +13 -83
- package/dist/ai-user-message/ai-user-message.scss.mjs +1 -1
- package/dist/ai-user-message-toolbar/ai-user-message-toolbar.d.ts +28 -0
- package/dist/ai-user-message-toolbar/ai-user-message-toolbar.mjs +160 -0
- package/dist/ai-user-message-toolbar/ai-user-message-toolbar.scss.mjs +4 -0
- package/dist/ai-user-message-toolbar/index.d.ts +1 -0
- package/dist/ai-user-message-toolbar/index.mjs +5 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +6 -3
- package/package.json +1 -1
- package/dist/ai-actions-toolbar/ai-actions-toolbar.d.ts +0 -51
- package/dist/ai-actions-toolbar/ai-actions-toolbar.mjs +0 -211
- package/dist/ai-actions-toolbar/index.d.ts +0 -1
- package/dist/ai-actions-toolbar/index.mjs +0 -5
- package/dist/tools/ai-confirm-tool-call/ai-confirm-tool-call-definition.d.ts +0 -10
- package/dist/tools/ai-confirm-tool-call/ai-confirm-tool-call-definition.mjs +0 -20
- package/dist/tools/ai-confirm-tool-call/index.d.ts +0 -1
- package/dist/tools/ai-confirm-tool-call/index.mjs +0 -5
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { unsafeCSS, LitElement, html } from "lit";
|
|
2
|
-
import { property, state, query, customElement } from "lit/decorators.js";
|
|
3
|
-
import { when } from "lit/directives/when.js";
|
|
4
|
-
import "../core/tooltip/tooltip.mjs";
|
|
5
|
-
import "../core/popover/popover.mjs";
|
|
6
|
-
import styles from "./ai-actions-toolbar.scss.mjs";
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
10
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
11
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
12
|
-
if (decorator = decorators[i])
|
|
13
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
14
|
-
if (kind && result) __defProp(target, key, result);
|
|
15
|
-
return result;
|
|
16
|
-
};
|
|
17
|
-
const AiActionsToolbarComponentTagName = "forge-ai-actions-toolbar";
|
|
18
|
-
let AiActionsToolbarComponent = class extends LitElement {
|
|
19
|
-
constructor() {
|
|
20
|
-
super(...arguments);
|
|
21
|
-
this.enableReactions = false;
|
|
22
|
-
this._thumbsUpActive = false;
|
|
23
|
-
this._thumbsDownActive = false;
|
|
24
|
-
this._popoverOpen = false;
|
|
25
|
-
}
|
|
26
|
-
willUpdate(changedProperties) {
|
|
27
|
-
if (changedProperties.has("feedbackType") && this.feedbackType) {
|
|
28
|
-
this._thumbsUpActive = this.feedbackType === "positive";
|
|
29
|
-
this._thumbsDownActive = this.feedbackType === "negative";
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
_emitActionEvent(action) {
|
|
33
|
-
const event = new CustomEvent("forge-ai-actions-toolbar-action", {
|
|
34
|
-
detail: { action }
|
|
35
|
-
});
|
|
36
|
-
this.dispatchEvent(event);
|
|
37
|
-
}
|
|
38
|
-
_emitFeedbackEvent(action, feedback) {
|
|
39
|
-
const event = new CustomEvent("forge-ai-actions-toolbar-feedback", {
|
|
40
|
-
detail: { action, feedback }
|
|
41
|
-
});
|
|
42
|
-
this.dispatchEvent(event);
|
|
43
|
-
}
|
|
44
|
-
_handleThumbsUp() {
|
|
45
|
-
this._thumbsUpActive = true;
|
|
46
|
-
this._thumbsDownActive = false;
|
|
47
|
-
if (this._thumbsDownPopover) {
|
|
48
|
-
this._thumbsDownPopover.open = false;
|
|
49
|
-
}
|
|
50
|
-
this._emitFeedbackEvent("positive");
|
|
51
|
-
}
|
|
52
|
-
async _handleThumbsDown() {
|
|
53
|
-
if (this._thumbsDownPopover) {
|
|
54
|
-
const willOpen = !this._thumbsDownPopover.open;
|
|
55
|
-
if (willOpen) {
|
|
56
|
-
await this.updateComplete;
|
|
57
|
-
this._thumbsDownPopover.anchor = this._thumbsDownButton;
|
|
58
|
-
}
|
|
59
|
-
this._thumbsDownPopover.open = willOpen;
|
|
60
|
-
if (this._thumbsDownFeedbackTextarea && !willOpen) {
|
|
61
|
-
this._thumbsDownFeedbackTextarea.value = "";
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
this._thumbsUpActive = false;
|
|
65
|
-
}
|
|
66
|
-
_handleFeedbackSubmit() {
|
|
67
|
-
const feedbackText = this._thumbsDownFeedbackTextarea?.value || "";
|
|
68
|
-
this._emitFeedbackEvent("negative", feedbackText);
|
|
69
|
-
this._thumbsDownActive = true;
|
|
70
|
-
if (this._thumbsDownPopover) {
|
|
71
|
-
this._thumbsDownPopover.open = false;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
_handleFeedbackCancel() {
|
|
75
|
-
if (this._thumbsDownPopover) {
|
|
76
|
-
this._thumbsDownPopover.open = false;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
_handlePopoverToggle(evt) {
|
|
80
|
-
this._popoverOpen = evt.detail.open;
|
|
81
|
-
}
|
|
82
|
-
get _refreshButtonTemplate() {
|
|
83
|
-
return html`
|
|
84
|
-
<button
|
|
85
|
-
id="refresh-btn"
|
|
86
|
-
aria-label="Refresh"
|
|
87
|
-
class="forge-icon-button forge-icon-button--small"
|
|
88
|
-
@click=${() => this._emitActionEvent("refresh")}>
|
|
89
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
90
|
-
<path
|
|
91
|
-
d="M17.65 6.35A7.96 7.96 0 0 0 12 4a8 8 0 0 0-8 8 8 8 0 0 0 8 8c3.73 0 6.84-2.55 7.73-6h-2.08A5.99 5.99 0 0 1 12 18a6 6 0 0 1-6-6 6 6 0 0 1 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z" />
|
|
92
|
-
</svg>
|
|
93
|
-
</button>
|
|
94
|
-
<forge-ai-tooltip for="refresh-btn" placement="bottom">Resend</forge-ai-tooltip>
|
|
95
|
-
`;
|
|
96
|
-
}
|
|
97
|
-
get _copyButtonTemplate() {
|
|
98
|
-
return html`
|
|
99
|
-
<button
|
|
100
|
-
id="copy-btn"
|
|
101
|
-
aria-label="Copy content"
|
|
102
|
-
class="forge-icon-button forge-icon-button--small"
|
|
103
|
-
@click=${() => this._emitActionEvent("copy")}>
|
|
104
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
105
|
-
<path
|
|
106
|
-
d="M19 21H8V7h11m0-2H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2m-3-4H4a2 2 0 0 0-2 2v14h2V3h12z" />
|
|
107
|
-
</svg>
|
|
108
|
-
</button>
|
|
109
|
-
<forge-ai-tooltip for="copy-btn" placement="bottom">Copy</forge-ai-tooltip>
|
|
110
|
-
`;
|
|
111
|
-
}
|
|
112
|
-
get _thumbsUpButtonTemplate() {
|
|
113
|
-
return html`
|
|
114
|
-
<button
|
|
115
|
-
id="thumbs-up-btn"
|
|
116
|
-
aria-label="Good response"
|
|
117
|
-
class="forge-icon-button forge-icon-button--small ${this._thumbsUpActive ? "is-active-positive" : ""}"
|
|
118
|
-
@click=${this._handleThumbsUp}>
|
|
119
|
-
${this._thumbsUpActive ? html`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
120
|
-
<path
|
|
121
|
-
d="M23 10a2 2 0 0 0-2-2h-6.32l.96-4.57c.02-.1.03-.21.03-.32 0-.41-.17-.79-.44-1.06L14.17 1 7.59 7.58C7.22 7.95 7 8.45 7 9v10a2 2 0 0 0 2 2h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73zM1 21h4V9H1z" />
|
|
122
|
-
</svg>` : html`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
123
|
-
<path
|
|
124
|
-
d="M5 9v12H1V9zm4 12a2 2 0 0 1-2-2V9c0-.55.22-1.05.59-1.41L14.17 1l1.06 1.06c.27.27.44.64.44 1.05l-.03.32L14.69 8H21a2 2 0 0 1 2 2v2c0 .26-.05.5-.14.73l-3.02 7.05C19.54 20.5 18.83 21 18 21zm0-2h9.03L21 12v-2h-8.79l1.13-5.32L9 9.03z" />
|
|
125
|
-
</svg>`}
|
|
126
|
-
</button>
|
|
127
|
-
<forge-ai-tooltip for="thumbs-up-btn" placement="bottom">Good response</forge-ai-tooltip>
|
|
128
|
-
`;
|
|
129
|
-
}
|
|
130
|
-
get _thumbsDownButtonTemplate() {
|
|
131
|
-
return html`
|
|
132
|
-
<button
|
|
133
|
-
id="thumbs-down-btn"
|
|
134
|
-
aria-label="Bad response"
|
|
135
|
-
class="forge-icon-button forge-icon-button--small ${this._thumbsDownActive || this._popoverOpen ? "is-active-negative" : ""}"
|
|
136
|
-
@click=${this._handleThumbsDown}>
|
|
137
|
-
${this._thumbsDownActive || this._popoverOpen ? html`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
138
|
-
<path
|
|
139
|
-
d="M19 15h4V3h-4m-4 0H6c-.83 0-1.54.5-1.84 1.22l-3.02 7.05c-.09.23-.14.47-.14.73v2a2 2 0 0 0 2 2h6.31l-.95 4.57c-.02.1-.03.2-.03.31 0 .42.17.79.44 1.06L9.83 23l6.58-6.59c.37-.36.59-.86.59-1.41V5a2 2 0 0 0-2-2" />
|
|
140
|
-
</svg>` : html`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
141
|
-
<path
|
|
142
|
-
d="M19 15V3h4v12zM15 3a2 2 0 0 1 2 2v10c0 .55-.22 1.05-.59 1.41L9.83 23l-1.06-1.06c-.27-.27-.44-.64-.44-1.06l.03-.31.95-4.57H3a2 2 0 0 1-2-2v-2c0-.26.05-.5.14-.73l3.02-7.05C4.46 3.5 5.17 3 6 3zm0 2H5.97L3 12v2h8.78l-1.13 5.32L15 14.97z" />
|
|
143
|
-
</svg>`}
|
|
144
|
-
</button>
|
|
145
|
-
<forge-ai-tooltip for="thumbs-down-btn" placement="bottom">Bad response</forge-ai-tooltip>
|
|
146
|
-
<forge-ai-popover
|
|
147
|
-
.anchor=${this._thumbsDownButton ?? null}
|
|
148
|
-
placement="bottom"
|
|
149
|
-
.shift=${true}
|
|
150
|
-
flip
|
|
151
|
-
arrow
|
|
152
|
-
@forge-ai-popover-toggle=${this._handlePopoverToggle}>
|
|
153
|
-
${this._feedbackFormTemplate}
|
|
154
|
-
</forge-ai-popover>
|
|
155
|
-
`;
|
|
156
|
-
}
|
|
157
|
-
get _feedbackFormTemplate() {
|
|
158
|
-
return html`
|
|
159
|
-
<div class="popover-content">
|
|
160
|
-
<div class="popover-header">Leave feedback for this response</div>
|
|
161
|
-
<div class="forge-field">
|
|
162
|
-
<textarea placeholder="Enter your feedback..."></textarea>
|
|
163
|
-
</div>
|
|
164
|
-
<div class="popover-actions">
|
|
165
|
-
<button class="forge-button forge-button--outlined" @click=${this._handleFeedbackCancel}>Cancel</button>
|
|
166
|
-
<button class="forge-button forge-button--filled" @click=${this._handleFeedbackSubmit}>Submit</button>
|
|
167
|
-
</div>
|
|
168
|
-
</div>
|
|
169
|
-
`;
|
|
170
|
-
}
|
|
171
|
-
render() {
|
|
172
|
-
return html`
|
|
173
|
-
<div class="actions-toolbar">
|
|
174
|
-
${this._refreshButtonTemplate} ${this._copyButtonTemplate}
|
|
175
|
-
${when(this.enableReactions, () => html`${this._thumbsUpButtonTemplate} ${this._thumbsDownButtonTemplate}`)}
|
|
176
|
-
</div>
|
|
177
|
-
`;
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
AiActionsToolbarComponent.styles = unsafeCSS(styles);
|
|
181
|
-
__decorateClass([
|
|
182
|
-
property({ type: Boolean, attribute: "enable-reactions" })
|
|
183
|
-
], AiActionsToolbarComponent.prototype, "enableReactions", 2);
|
|
184
|
-
__decorateClass([
|
|
185
|
-
property({ attribute: "feedback-type" })
|
|
186
|
-
], AiActionsToolbarComponent.prototype, "feedbackType", 2);
|
|
187
|
-
__decorateClass([
|
|
188
|
-
state()
|
|
189
|
-
], AiActionsToolbarComponent.prototype, "_thumbsUpActive", 2);
|
|
190
|
-
__decorateClass([
|
|
191
|
-
state()
|
|
192
|
-
], AiActionsToolbarComponent.prototype, "_thumbsDownActive", 2);
|
|
193
|
-
__decorateClass([
|
|
194
|
-
state()
|
|
195
|
-
], AiActionsToolbarComponent.prototype, "_popoverOpen", 2);
|
|
196
|
-
__decorateClass([
|
|
197
|
-
query("#thumbs-down-btn")
|
|
198
|
-
], AiActionsToolbarComponent.prototype, "_thumbsDownButton", 2);
|
|
199
|
-
__decorateClass([
|
|
200
|
-
query("forge-ai-popover")
|
|
201
|
-
], AiActionsToolbarComponent.prototype, "_thumbsDownPopover", 2);
|
|
202
|
-
__decorateClass([
|
|
203
|
-
query("textarea")
|
|
204
|
-
], AiActionsToolbarComponent.prototype, "_thumbsDownFeedbackTextarea", 2);
|
|
205
|
-
AiActionsToolbarComponent = __decorateClass([
|
|
206
|
-
customElement(AiActionsToolbarComponentTagName)
|
|
207
|
-
], AiActionsToolbarComponent);
|
|
208
|
-
export {
|
|
209
|
-
AiActionsToolbarComponent,
|
|
210
|
-
AiActionsToolbarComponentTagName
|
|
211
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ai-actions-toolbar';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ToolDefinition } from '../../ai-chatbot';
|
|
2
|
-
export declare const CONFIRM_TOOL_CALL_NAME = "confirmToolCall";
|
|
3
|
-
export interface ConfirmActionToolArgs {
|
|
4
|
-
action: string;
|
|
5
|
-
}
|
|
6
|
-
export interface ConfirmActionToolResult {
|
|
7
|
-
status: 'confirmed' | 'denied';
|
|
8
|
-
action: string;
|
|
9
|
-
}
|
|
10
|
-
export declare const confirmActionTool: ToolDefinition<ConfirmActionToolArgs>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const CONFIRM_TOOL_CALL_NAME = "confirmToolCall";
|
|
2
|
-
const confirmActionTool = {
|
|
3
|
-
name: CONFIRM_TOOL_CALL_NAME,
|
|
4
|
-
displayName: "Confirm Action",
|
|
5
|
-
description: "Request user confirmation before executing a tool. The user will see a prompt with the action description and can confirm or deny. Use this tool before executing ANY other tools.",
|
|
6
|
-
parameters: {
|
|
7
|
-
type: "object",
|
|
8
|
-
properties: {
|
|
9
|
-
action: {
|
|
10
|
-
type: "string",
|
|
11
|
-
description: "A clear, user-friendly description of the action to be confirmed"
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
required: ["action"]
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
export {
|
|
18
|
-
CONFIRM_TOOL_CALL_NAME,
|
|
19
|
-
confirmActionTool
|
|
20
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ai-confirm-tool-call-definition';
|