@blade-hq/agent-client 2608.0.0 → 2608.0.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/dist/index.js +23 -14
- package/dist/index.js.map +1 -1
- package/dist/shared/projection/helpers.d.ts +9 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -827,6 +827,24 @@ function sourceLoopFor(loopId, loopDescriptions) {
|
|
|
827
827
|
if (!description) return null;
|
|
828
828
|
return { loop_name: loopId, description };
|
|
829
829
|
}
|
|
830
|
+
function normalizePostChatFollowup(data, assistantEntryId) {
|
|
831
|
+
const raw = data.suggestions;
|
|
832
|
+
const suggestions = [];
|
|
833
|
+
if (Array.isArray(raw)) {
|
|
834
|
+
for (const value of raw) {
|
|
835
|
+
if (typeof value !== "string") continue;
|
|
836
|
+
const text = value.trim();
|
|
837
|
+
if (text && !suggestions.includes(text)) suggestions.push(text);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
const recaption = String(data.recaption ?? "");
|
|
841
|
+
if (suggestions.length === 0 && !recaption) return null;
|
|
842
|
+
return {
|
|
843
|
+
assistant_entry_id: assistantEntryId,
|
|
844
|
+
recaption,
|
|
845
|
+
suggestions: suggestions.slice(0, 3)
|
|
846
|
+
};
|
|
847
|
+
}
|
|
830
848
|
function normalizeChildPause(pausePayload) {
|
|
831
849
|
const rawPtd = pausePayload.pause_tool_data;
|
|
832
850
|
const pauseToolData = typeof rawPtd === "object" && rawPtd !== null ? { ...rawPtd } : { ...pausePayload };
|
|
@@ -1245,12 +1263,7 @@ var ClientProjectionBuilder = class {
|
|
|
1245
1263
|
if (!latest || latest.role !== "assistant" || latest.turn_id !== assistantEntryId) {
|
|
1246
1264
|
return null;
|
|
1247
1265
|
}
|
|
1248
|
-
const
|
|
1249
|
-
const postChatFollowup = Array.isArray(suggestions) && suggestions.length === 3 && suggestions.every((value) => typeof value === "string") ? {
|
|
1250
|
-
assistant_entry_id: assistantEntryId,
|
|
1251
|
-
recaption: String(payload.recaption ?? ""),
|
|
1252
|
-
suggestions
|
|
1253
|
-
} : null;
|
|
1266
|
+
const postChatFollowup = normalizePostChatFollowup(payload, assistantEntryId);
|
|
1254
1267
|
if (!postChatFollowup) return null;
|
|
1255
1268
|
const turn = {
|
|
1256
1269
|
...latest,
|
|
@@ -1626,13 +1639,9 @@ function projectHistory(entries) {
|
|
|
1626
1639
|
const id = String(entry.id ?? `history-${sequence + 1}`);
|
|
1627
1640
|
if (kind === "post_chat_followup" && isRecord3(entry.data)) {
|
|
1628
1641
|
const assistantEntryId = String(entry.data.assistant_entry_id ?? "");
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
latestRootMessage.post_chat_followup =
|
|
1632
|
-
assistant_entry_id: assistantEntryId,
|
|
1633
|
-
recaption: String(entry.data.recaption ?? ""),
|
|
1634
|
-
suggestions
|
|
1635
|
-
};
|
|
1642
|
+
if (latestRootMessage?.role === "assistant" && latestRootMessage.turn_id === assistantEntryId) {
|
|
1643
|
+
const followup = normalizePostChatFollowup(entry.data, assistantEntryId);
|
|
1644
|
+
if (followup) latestRootMessage.post_chat_followup = followup;
|
|
1636
1645
|
}
|
|
1637
1646
|
continue;
|
|
1638
1647
|
}
|
|
@@ -4213,7 +4222,7 @@ function resolveAuthToken(options) {
|
|
|
4213
4222
|
|
|
4214
4223
|
// src/version.ts
|
|
4215
4224
|
var SDK_NAME = "agent-client";
|
|
4216
|
-
var SDK_VERSION = true ? "2608.0.
|
|
4225
|
+
var SDK_VERSION = true ? "2608.0.1" : "1.1.1";
|
|
4217
4226
|
|
|
4218
4227
|
// src/socket.ts
|
|
4219
4228
|
function withSdkIdentity(auth) {
|