@superatomai/sdk-node 0.0.84-dsp → 0.0.85-dsp
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/README.md +942 -942
- package/dist/index.d.mts +800 -118
- package/dist/index.d.ts +800 -118
- package/dist/index.js +9 -7
- package/dist/index.mjs +9 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19725,6 +19725,7 @@ function promptContextFrom(raw) {
|
|
|
19725
19725
|
if (source.filters && typeof source.filters === "object" && !Array.isArray(source.filters)) {
|
|
19726
19726
|
context.filters = source.filters;
|
|
19727
19727
|
}
|
|
19728
|
+
if (source.follow === true) context.follow = true;
|
|
19728
19729
|
return Object.keys(context).length ? context : void 0;
|
|
19729
19730
|
}
|
|
19730
19731
|
var inFlightAborts = /* @__PURE__ */ new Map();
|
|
@@ -19907,7 +19908,7 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
|
|
|
19907
19908
|
};
|
|
19908
19909
|
let userResponse;
|
|
19909
19910
|
try {
|
|
19910
|
-
const replayed = answerProvider && !attachments ? (await replayExactMatch({ prompt, collections, userId, threadId, streamCallback, method: "custom-exact-match", startTime: Date.now() }))?.response : void 0;
|
|
19911
|
+
const replayed = answerProvider && !attachments && !payload.context?.follow ? (await replayExactMatch({ prompt, collections, userId, threadId, streamCallback, method: "custom-exact-match", startTime: Date.now() }))?.response : void 0;
|
|
19911
19912
|
userResponse = replayed ? replayed : answerProvider ? await answerProvider({
|
|
19912
19913
|
prompt,
|
|
19913
19914
|
components,
|
|
@@ -19952,6 +19953,7 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
|
|
|
19952
19953
|
if (Array.isArray(narration) && narration.length) uiBlock.setNarration(narration);
|
|
19953
19954
|
uiBlock.setDurationMs(Date.now() - requestStartTime);
|
|
19954
19955
|
const uiBlockId = existingUiBlockId;
|
|
19956
|
+
const recordable = !!userId && !userResponse?.data?.followed;
|
|
19955
19957
|
const wasAborted = abortController.signal.aborted || !userResponse.success && Array.isArray(userResponse.errors) && userResponse.errors.includes("aborted");
|
|
19956
19958
|
if (wasAborted) {
|
|
19957
19959
|
thread.removeUIBlock(uiBlockId);
|
|
@@ -19961,7 +19963,7 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
|
|
|
19961
19963
|
}
|
|
19962
19964
|
let savedConversationId2;
|
|
19963
19965
|
let savedResponse2;
|
|
19964
|
-
if (
|
|
19966
|
+
if (recordable) {
|
|
19965
19967
|
const saveResult = await saveConversation({
|
|
19966
19968
|
userId,
|
|
19967
19969
|
userPrompt: prompt,
|
|
@@ -19980,7 +19982,7 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
|
|
|
19980
19982
|
savedResponse2 = saveResult.response;
|
|
19981
19983
|
}
|
|
19982
19984
|
}
|
|
19983
|
-
if (
|
|
19985
|
+
if (recordable) {
|
|
19984
19986
|
const latencyMs = Date.now() - requestStartTime;
|
|
19985
19987
|
const turn = reported(userResponse);
|
|
19986
19988
|
const model = turn.model || mainAgentModel || "unknown";
|
|
@@ -20030,7 +20032,7 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
|
|
|
20030
20032
|
}
|
|
20031
20033
|
let savedConversationId2;
|
|
20032
20034
|
let savedResponse2;
|
|
20033
|
-
if (
|
|
20035
|
+
if (recordable) {
|
|
20034
20036
|
const saveResult = await saveConversation({
|
|
20035
20037
|
userId,
|
|
20036
20038
|
userPrompt: prompt,
|
|
@@ -20052,7 +20054,7 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
|
|
|
20052
20054
|
savedResponse2 = saveResult.response;
|
|
20053
20055
|
}
|
|
20054
20056
|
}
|
|
20055
|
-
if (
|
|
20057
|
+
if (recordable) {
|
|
20056
20058
|
const latencyMs = Date.now() - requestStartTime;
|
|
20057
20059
|
const turn = reported(userResponse);
|
|
20058
20060
|
const model = turn.model || mainAgentModel || "unknown";
|
|
@@ -20117,7 +20119,7 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
|
|
|
20117
20119
|
logger.info(`Completed UIBlock: ${uiBlockId} in Thread: ${threadId}`);
|
|
20118
20120
|
let savedConversationId;
|
|
20119
20121
|
let savedResponse;
|
|
20120
|
-
if (
|
|
20122
|
+
if (recordable) {
|
|
20121
20123
|
const responseMethod = userResponse.data?.method || "";
|
|
20122
20124
|
const semanticSimilarity = userResponse.data?.semanticSimilarity || 0;
|
|
20123
20125
|
const isExactMatch = responseMethod.includes("semantic-match") && semanticSimilarity >= 0.99;
|
|
@@ -20156,7 +20158,7 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
|
|
|
20156
20158
|
}
|
|
20157
20159
|
}
|
|
20158
20160
|
llmUsageLogger.logSessionSummary(prompt?.substring(0, 50));
|
|
20159
|
-
if (
|
|
20161
|
+
if (recordable) {
|
|
20160
20162
|
const latencyMs = Date.now() - requestStartTime;
|
|
20161
20163
|
const turn = reported(userResponse);
|
|
20162
20164
|
const model = turn.model || mainAgentModel || "unknown";
|
package/dist/index.mjs
CHANGED
|
@@ -19613,6 +19613,7 @@ function promptContextFrom(raw) {
|
|
|
19613
19613
|
if (source.filters && typeof source.filters === "object" && !Array.isArray(source.filters)) {
|
|
19614
19614
|
context.filters = source.filters;
|
|
19615
19615
|
}
|
|
19616
|
+
if (source.follow === true) context.follow = true;
|
|
19616
19617
|
return Object.keys(context).length ? context : void 0;
|
|
19617
19618
|
}
|
|
19618
19619
|
var inFlightAborts = /* @__PURE__ */ new Map();
|
|
@@ -19795,7 +19796,7 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
|
|
|
19795
19796
|
};
|
|
19796
19797
|
let userResponse;
|
|
19797
19798
|
try {
|
|
19798
|
-
const replayed = answerProvider && !attachments ? (await replayExactMatch({ prompt, collections, userId, threadId, streamCallback, method: "custom-exact-match", startTime: Date.now() }))?.response : void 0;
|
|
19799
|
+
const replayed = answerProvider && !attachments && !payload.context?.follow ? (await replayExactMatch({ prompt, collections, userId, threadId, streamCallback, method: "custom-exact-match", startTime: Date.now() }))?.response : void 0;
|
|
19799
19800
|
userResponse = replayed ? replayed : answerProvider ? await answerProvider({
|
|
19800
19801
|
prompt,
|
|
19801
19802
|
components,
|
|
@@ -19840,6 +19841,7 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
|
|
|
19840
19841
|
if (Array.isArray(narration) && narration.length) uiBlock.setNarration(narration);
|
|
19841
19842
|
uiBlock.setDurationMs(Date.now() - requestStartTime);
|
|
19842
19843
|
const uiBlockId = existingUiBlockId;
|
|
19844
|
+
const recordable = !!userId && !userResponse?.data?.followed;
|
|
19843
19845
|
const wasAborted = abortController.signal.aborted || !userResponse.success && Array.isArray(userResponse.errors) && userResponse.errors.includes("aborted");
|
|
19844
19846
|
if (wasAborted) {
|
|
19845
19847
|
thread.removeUIBlock(uiBlockId);
|
|
@@ -19849,7 +19851,7 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
|
|
|
19849
19851
|
}
|
|
19850
19852
|
let savedConversationId2;
|
|
19851
19853
|
let savedResponse2;
|
|
19852
|
-
if (
|
|
19854
|
+
if (recordable) {
|
|
19853
19855
|
const saveResult = await saveConversation({
|
|
19854
19856
|
userId,
|
|
19855
19857
|
userPrompt: prompt,
|
|
@@ -19868,7 +19870,7 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
|
|
|
19868
19870
|
savedResponse2 = saveResult.response;
|
|
19869
19871
|
}
|
|
19870
19872
|
}
|
|
19871
|
-
if (
|
|
19873
|
+
if (recordable) {
|
|
19872
19874
|
const latencyMs = Date.now() - requestStartTime;
|
|
19873
19875
|
const turn = reported(userResponse);
|
|
19874
19876
|
const model = turn.model || mainAgentModel || "unknown";
|
|
@@ -19918,7 +19920,7 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
|
|
|
19918
19920
|
}
|
|
19919
19921
|
let savedConversationId2;
|
|
19920
19922
|
let savedResponse2;
|
|
19921
|
-
if (
|
|
19923
|
+
if (recordable) {
|
|
19922
19924
|
const saveResult = await saveConversation({
|
|
19923
19925
|
userId,
|
|
19924
19926
|
userPrompt: prompt,
|
|
@@ -19940,7 +19942,7 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
|
|
|
19940
19942
|
savedResponse2 = saveResult.response;
|
|
19941
19943
|
}
|
|
19942
19944
|
}
|
|
19943
|
-
if (
|
|
19945
|
+
if (recordable) {
|
|
19944
19946
|
const latencyMs = Date.now() - requestStartTime;
|
|
19945
19947
|
const turn = reported(userResponse);
|
|
19946
19948
|
const model = turn.model || mainAgentModel || "unknown";
|
|
@@ -20005,7 +20007,7 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
|
|
|
20005
20007
|
logger.info(`Completed UIBlock: ${uiBlockId} in Thread: ${threadId}`);
|
|
20006
20008
|
let savedConversationId;
|
|
20007
20009
|
let savedResponse;
|
|
20008
|
-
if (
|
|
20010
|
+
if (recordable) {
|
|
20009
20011
|
const responseMethod = userResponse.data?.method || "";
|
|
20010
20012
|
const semanticSimilarity = userResponse.data?.semanticSimilarity || 0;
|
|
20011
20013
|
const isExactMatch = responseMethod.includes("semantic-match") && semanticSimilarity >= 0.99;
|
|
@@ -20044,7 +20046,7 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
|
|
|
20044
20046
|
}
|
|
20045
20047
|
}
|
|
20046
20048
|
llmUsageLogger.logSessionSummary(prompt?.substring(0, 50));
|
|
20047
|
-
if (
|
|
20049
|
+
if (recordable) {
|
|
20048
20050
|
const latencyMs = Date.now() - requestStartTime;
|
|
20049
20051
|
const turn = reported(userResponse);
|
|
20050
20052
|
const model = turn.model || mainAgentModel || "unknown";
|