@artooi/ag-ui-web-component 0.25.0 → 0.25.1
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/CHANGELOG.md +19 -1
- package/README.md +4 -3
- package/dist/ag-ui-web-component.bundle.js +20 -25
- package/dist/ag-ui-web-component.bundle.js.map +3 -3
- package/dist/index.js +38 -10
- package/dist/index.js.map +2 -2
- package/dist/ui/checkpoint_menu.d.ts.map +1 -1
- package/dist/ui/styles.d.ts +1 -1
- package/dist/ui/styles.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ui/checkpoint_menu.ts +59 -9
- package/src/ui/styles.ts +0 -5
- package/src/version.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -1009,6 +1009,12 @@ function relativeTime(timestamp, now = Date.now(), strings = DEFAULT_UI_STRINGS)
|
|
|
1009
1009
|
}
|
|
1010
1010
|
|
|
1011
1011
|
// src/ui/checkpoint_menu.ts
|
|
1012
|
+
function previewOf(run) {
|
|
1013
|
+
return run.preview !== void 0 && run.preview !== null && run.preview !== "" ? run.preview : null;
|
|
1014
|
+
}
|
|
1015
|
+
function asShown(preview) {
|
|
1016
|
+
return preview.replace(/\s+/g, " ").trim();
|
|
1017
|
+
}
|
|
1012
1018
|
var CheckpointMenu = class {
|
|
1013
1019
|
/** The panel root. Append to the chat shell; hidden until opened. */
|
|
1014
1020
|
element;
|
|
@@ -1116,15 +1122,40 @@ var CheckpointMenu = class {
|
|
|
1116
1122
|
this.#list.append(empty);
|
|
1117
1123
|
return;
|
|
1118
1124
|
}
|
|
1125
|
+
const repeated = this.#repeatedPreviews();
|
|
1126
|
+
for (const run of this.#runs) {
|
|
1127
|
+
this.#list.append(this.#row(run, repeated));
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* The previews more than one row shows.
|
|
1132
|
+
*
|
|
1133
|
+
* A preview identifies a run only while it is that run's alone. A real index
|
|
1134
|
+
* answered with five runs opening on the same sentence, and those rows read
|
|
1135
|
+
* alike exactly as bare timestamps used to — so where the words repeat the
|
|
1136
|
+
* short id comes back, and where they do not the row is left as it is.
|
|
1137
|
+
*/
|
|
1138
|
+
#repeatedPreviews() {
|
|
1139
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1140
|
+
const repeated = /* @__PURE__ */ new Set();
|
|
1119
1141
|
for (const run of this.#runs) {
|
|
1120
|
-
|
|
1142
|
+
const preview = previewOf(run);
|
|
1143
|
+
if (preview === null) {
|
|
1144
|
+
continue;
|
|
1145
|
+
}
|
|
1146
|
+
const shown = asShown(preview);
|
|
1147
|
+
if (seen.has(shown)) {
|
|
1148
|
+
repeated.add(shown);
|
|
1149
|
+
}
|
|
1150
|
+
seen.add(shown);
|
|
1121
1151
|
}
|
|
1152
|
+
return repeated;
|
|
1122
1153
|
}
|
|
1123
|
-
#row(run) {
|
|
1154
|
+
#row(run, repeated) {
|
|
1124
1155
|
const row = document.createElement("div");
|
|
1125
1156
|
row.className = "checkpoint-row";
|
|
1126
1157
|
row.setAttribute("part", "checkpoint-row");
|
|
1127
|
-
const preview = run
|
|
1158
|
+
const preview = previewOf(run);
|
|
1128
1159
|
const time = run.started_at === null ? null : relativeTime(Date.parse(run.started_at), Date.now(), this.#strings);
|
|
1129
1160
|
const label = document.createElement("span");
|
|
1130
1161
|
label.className = "checkpoint-label";
|
|
@@ -1137,7 +1168,9 @@ var CheckpointMenu = class {
|
|
|
1137
1168
|
when.setAttribute("part", "checkpoint-time");
|
|
1138
1169
|
when.textContent = time;
|
|
1139
1170
|
row.append(when);
|
|
1140
|
-
}
|
|
1171
|
+
}
|
|
1172
|
+
const ambiguous = preview === null ? time !== null : repeated.has(asShown(preview));
|
|
1173
|
+
if (ambiguous && run.run_id !== "") {
|
|
1141
1174
|
const short = document.createElement("span");
|
|
1142
1175
|
short.className = "checkpoint-id";
|
|
1143
1176
|
short.setAttribute("part", "checkpoint-id");
|
|
@@ -6483,11 +6516,6 @@ var STYLES = `
|
|
|
6483
6516
|
opacity: 0.7;
|
|
6484
6517
|
}
|
|
6485
6518
|
|
|
6486
|
-
/* A row is a label and two buttons, and nothing about the row itself is
|
|
6487
|
-
pressable. It used to light up on hover, which is the affordance of something
|
|
6488
|
-
clickable and made the buttons look like decoration on a clickable strip. The
|
|
6489
|
-
resting surface groups the row instead, so hover can mean what it says: only
|
|
6490
|
-
the buttons respond to it. */
|
|
6491
6519
|
/* A row is a label and two buttons, and nothing about the row itself is
|
|
6492
6520
|
pressable. It used to light up on hover, which is the affordance of something
|
|
6493
6521
|
clickable and made the buttons look like decoration on a clickable strip. The
|
|
@@ -10583,7 +10611,7 @@ function setControlValue(el, value) {
|
|
|
10583
10611
|
}
|
|
10584
10612
|
|
|
10585
10613
|
// src/version.ts
|
|
10586
|
-
var VERSION = "0.25.
|
|
10614
|
+
var VERSION = "0.25.1";
|
|
10587
10615
|
export {
|
|
10588
10616
|
ATTACHMENT_EVENT,
|
|
10589
10617
|
AgUiChat,
|