@anuma/sdk 3.11.1 → 3.11.3
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/expo/{chunk-7CTI3XR6.mjs → chunk-7AW2VD5W.mjs} +284 -93
- package/dist/expo/index.cjs +333 -101
- package/dist/expo/index.d.mts +14 -1
- package/dist/expo/index.d.ts +14 -1
- package/dist/expo/index.mjs +46 -7
- package/dist/expo/{recall-IBGUFY4P.mjs → recall-JWQ4IJX6.mjs} +1 -1
- package/dist/react/{chunk-LAFUCS4U.mjs → chunk-L2QRTJII.mjs} +284 -93
- package/dist/react/index.cjs +333 -101
- package/dist/react/index.d.mts +14 -1
- package/dist/react/index.d.ts +14 -1
- package/dist/react/index.mjs +46 -7
- package/dist/react/{recall-Q5V5DN4L.mjs → recall-DOFCEH2I.mjs} +1 -1
- package/dist/server/{chunk-NCKDSZPQ.mjs → chunk-FZZCEZL2.mjs} +284 -93
- package/dist/server/index.cjs +332 -101
- package/dist/server/index.d.mts +14 -1
- package/dist/server/index.d.ts +14 -1
- package/dist/server/index.mjs +46 -7
- package/dist/server/{recall-AN7HBEFS.mjs → recall-QH3YX6T4.mjs} +1 -1
- package/dist/tools/index.cjs +14 -0
- package/dist/tools/index.mjs +14 -0
- package/package.json +1 -1
package/dist/react/index.d.mts
CHANGED
|
@@ -6545,7 +6545,20 @@ type RecallDegradation =
|
|
|
6545
6545
|
"rerank-unavailable"
|
|
6546
6546
|
/** `budget: 'high'` requested but no `decomposeOptions`, so query
|
|
6547
6547
|
* decomposition was skipped and the budget downgraded to mid. */
|
|
6548
|
-
| "decompose-unavailable"
|
|
6548
|
+
| "decompose-unavailable"
|
|
6549
|
+
/** There was no usable cosine lane, so results were ranked on BM25 (lexical)
|
|
6550
|
+
* alone: either the query embedding failed (or came back empty), or no
|
|
6551
|
+
* candidate had a vector to score against it because the row (re)embed failed.
|
|
6552
|
+
* Also set when the chunk lane — cosine-only, with no lexical equivalent — was
|
|
6553
|
+
* skipped for the same reason. The embeddings provider is a single upstream
|
|
6554
|
+
* with no fallback, so this is a whole-provider outage rather than a per-item
|
|
6555
|
+
* miss — expect a quality drop, not a total loss.
|
|
6556
|
+
*
|
|
6557
|
+
* NOT set for a partial failure that leaves cosine running (a sub-query embed
|
|
6558
|
+
* failing back to the single-query path, or a row batch failing while other
|
|
6559
|
+
* rows keep usable vectors) — those are logged, not reported, so this stays a
|
|
6560
|
+
* reliable outage signal rather than a general embedding-error counter. */
|
|
6561
|
+
| "embeddings-unavailable";
|
|
6549
6562
|
/**
|
|
6550
6563
|
* Per-call recall observability payload (see {@link RecallOptions.onDiagnostics}).
|
|
6551
6564
|
* All timings are wall-clock milliseconds. Lane counts are post-dedupe,
|
package/dist/react/index.d.ts
CHANGED
|
@@ -6545,7 +6545,20 @@ type RecallDegradation =
|
|
|
6545
6545
|
"rerank-unavailable"
|
|
6546
6546
|
/** `budget: 'high'` requested but no `decomposeOptions`, so query
|
|
6547
6547
|
* decomposition was skipped and the budget downgraded to mid. */
|
|
6548
|
-
| "decompose-unavailable"
|
|
6548
|
+
| "decompose-unavailable"
|
|
6549
|
+
/** There was no usable cosine lane, so results were ranked on BM25 (lexical)
|
|
6550
|
+
* alone: either the query embedding failed (or came back empty), or no
|
|
6551
|
+
* candidate had a vector to score against it because the row (re)embed failed.
|
|
6552
|
+
* Also set when the chunk lane — cosine-only, with no lexical equivalent — was
|
|
6553
|
+
* skipped for the same reason. The embeddings provider is a single upstream
|
|
6554
|
+
* with no fallback, so this is a whole-provider outage rather than a per-item
|
|
6555
|
+
* miss — expect a quality drop, not a total loss.
|
|
6556
|
+
*
|
|
6557
|
+
* NOT set for a partial failure that leaves cosine running (a sub-query embed
|
|
6558
|
+
* failing back to the single-query path, or a row batch failing while other
|
|
6559
|
+
* rows keep usable vectors) — those are logged, not reported, so this stays a
|
|
6560
|
+
* reliable outage signal rather than a general embedding-error counter. */
|
|
6561
|
+
| "embeddings-unavailable";
|
|
6549
6562
|
/**
|
|
6550
6563
|
* Per-call recall observability payload (see {@link RecallOptions.onDiagnostics}).
|
|
6551
6564
|
* All timings are wall-clock milliseconds. Lane counts are post-dedupe,
|
package/dist/react/index.mjs
CHANGED
|
@@ -5,11 +5,14 @@ import {
|
|
|
5
5
|
DEFAULT_MIN_CHUNK_SIZE,
|
|
6
6
|
DEFAULT_MIN_CONTENT_LENGTH,
|
|
7
7
|
DEFAULT_VAULT_CACHE_SIZE,
|
|
8
|
+
EMBEDDINGS_DEGRADED_EMPTY,
|
|
8
9
|
ENTITY_FANOUT,
|
|
9
10
|
ENTITY_KINDS,
|
|
10
11
|
LRUCache,
|
|
11
12
|
MAX_HOPS,
|
|
12
13
|
NODE_BUDGET,
|
|
14
|
+
RECALL_MAX_LIMIT,
|
|
15
|
+
RECALL_TOOL_NAME,
|
|
13
16
|
RerankerUnavailableError,
|
|
14
17
|
TOPICS_EXTRACTION_VERSION,
|
|
15
18
|
TREND_RECENT_WINDOW_DAYS,
|
|
@@ -156,7 +159,7 @@ import {
|
|
|
156
159
|
updateVaultMemoryOp,
|
|
157
160
|
useEncryption,
|
|
158
161
|
vaultMemoryToStored
|
|
159
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-L2QRTJII.mjs";
|
|
160
163
|
import {
|
|
161
164
|
PiiRedactor,
|
|
162
165
|
createStreamingDeAnonymizer,
|
|
@@ -946,6 +949,9 @@ var CompletionsStrategy = class {
|
|
|
946
949
|
}
|
|
947
950
|
}
|
|
948
951
|
}
|
|
952
|
+
if (choice.finish_reason) {
|
|
953
|
+
accumulator.finishReason = choice.finish_reason;
|
|
954
|
+
}
|
|
949
955
|
if (choice.finish_reason === "tool_calls" || choice.finish_reason === "stop") {
|
|
950
956
|
if (accumulator.toolCalls.size > 0) {
|
|
951
957
|
accumulator.content = mergeXaiInlineParameterTags(
|
|
@@ -1028,7 +1034,9 @@ var CompletionsStrategy = class {
|
|
|
1028
1034
|
content: finalContent,
|
|
1029
1035
|
...toolCalls && { tool_calls: toolCalls }
|
|
1030
1036
|
},
|
|
1031
|
-
|
|
1037
|
+
// Prefer what the provider actually said; fall back to the derived
|
|
1038
|
+
// value only when the stream carried no finish_reason at all.
|
|
1039
|
+
finish_reason: accumulator.finishReason ?? (toolCalls ? "tool_calls" : "stop")
|
|
1032
1040
|
}
|
|
1033
1041
|
],
|
|
1034
1042
|
...usage && { usage },
|
|
@@ -1699,7 +1707,7 @@ var ResponsesStrategy = class {
|
|
|
1699
1707
|
}
|
|
1700
1708
|
return result;
|
|
1701
1709
|
}
|
|
1702
|
-
if (typedChunk.type === "response.completed") {
|
|
1710
|
+
if (typedChunk.type === "response.completed" || typedChunk.type === "response.incomplete") {
|
|
1703
1711
|
if (typedChunk.response?.usage) {
|
|
1704
1712
|
const u = typedChunk.response.usage;
|
|
1705
1713
|
const promptTokens = u.input_tokens ?? u.prompt_tokens ?? 0;
|
|
@@ -1715,6 +1723,11 @@ var ResponsesStrategy = class {
|
|
|
1715
1723
|
...creditsExhausted !== void 0 && { credits_exhausted: creditsExhausted }
|
|
1716
1724
|
};
|
|
1717
1725
|
}
|
|
1726
|
+
const resp = typedChunk.response;
|
|
1727
|
+
const looksIncomplete = typedChunk.type === "response.incomplete" || resp?.status === "incomplete";
|
|
1728
|
+
if (looksIncomplete && resp?.incomplete_details?.reason === "max_output_tokens") {
|
|
1729
|
+
accumulator.finishReason = "length";
|
|
1730
|
+
}
|
|
1718
1731
|
if (typedChunk.response?.tools_checksum && !accumulator.toolsChecksum) {
|
|
1719
1732
|
accumulator.toolsChecksum = typedChunk.response.tools_checksum;
|
|
1720
1733
|
}
|
|
@@ -3251,7 +3264,17 @@ Executing tool: ${toolInfo}
|
|
|
3251
3264
|
flushDeAnon();
|
|
3252
3265
|
currentAccumulator.content += tip;
|
|
3253
3266
|
}
|
|
3267
|
+
const truncatedToNothing = (acc) => acc.finishReason === "length" && acc.toolCalls.size === 0 && acc.content.trim() === "";
|
|
3268
|
+
const TRUNCATION_ERROR = "Model response was truncated at the output-token limit before it produced any usable content or tool call. Retry with a higher `maxOutputTokens`, or prompt for fewer/smaller tool calls per turn.";
|
|
3254
3269
|
if (toolIteration > 0) {
|
|
3270
|
+
if (truncatedToNothing(currentAccumulator)) {
|
|
3271
|
+
await fireRunError({ error: TRUNCATION_ERROR, stage: "model" });
|
|
3272
|
+
return {
|
|
3273
|
+
data: buildResponseFinal(currentAccumulator),
|
|
3274
|
+
error: TRUNCATION_ERROR,
|
|
3275
|
+
toolsChecksum: currentAccumulator.toolsChecksum
|
|
3276
|
+
};
|
|
3277
|
+
}
|
|
3255
3278
|
const finalResponse = buildResponseFinal(currentAccumulator);
|
|
3256
3279
|
if (onFinish) onFinish(finalResponse);
|
|
3257
3280
|
await fireRunEnd({
|
|
@@ -3265,6 +3288,14 @@ Executing tool: ${toolInfo}
|
|
|
3265
3288
|
autoExecutedToolResults: accumulatedToolResults
|
|
3266
3289
|
};
|
|
3267
3290
|
}
|
|
3291
|
+
if (truncatedToNothing(accumulator)) {
|
|
3292
|
+
await fireRunError({ error: TRUNCATION_ERROR, stage: "model" });
|
|
3293
|
+
return {
|
|
3294
|
+
data: response,
|
|
3295
|
+
error: TRUNCATION_ERROR,
|
|
3296
|
+
toolsChecksum: accumulator.toolsChecksum
|
|
3297
|
+
};
|
|
3298
|
+
}
|
|
3268
3299
|
if (onFinish) onFinish(response);
|
|
3269
3300
|
await fireRunEnd({
|
|
3270
3301
|
finalContent: finalContentText(accumulator),
|
|
@@ -7213,6 +7244,11 @@ async function retain(content, ctx, options = {}) {
|
|
|
7213
7244
|
...options.folderId !== void 0 && { folderId: options.folderId }
|
|
7214
7245
|
}
|
|
7215
7246
|
);
|
|
7247
|
+
if (prepared.embeddingFailure || prepared.embeddingsUnavailable) {
|
|
7248
|
+
throw new Error(
|
|
7249
|
+
"retain: embeddings unavailable \u2014 refusing to auto-merge against an inert cosine lane, which would create a duplicate instead of merging into the existing memory. Retry when embeddings recover, or pass enableAutoMerge: false to force a create."
|
|
7250
|
+
);
|
|
7251
|
+
}
|
|
7216
7252
|
if (options.consolidateOptions) {
|
|
7217
7253
|
const outcome = await tryConsolidate(trimmed, ctx, options, prepared);
|
|
7218
7254
|
if (outcome) {
|
|
@@ -8445,10 +8481,6 @@ function rankProfileCandidates(inputs, now = Date.now(), options = {}) {
|
|
|
8445
8481
|
return ranked;
|
|
8446
8482
|
}
|
|
8447
8483
|
|
|
8448
|
-
// src/lib/memory/recallConstants.ts
|
|
8449
|
-
var RECALL_TOOL_NAME = "recall_memory";
|
|
8450
|
-
var RECALL_MAX_LIMIT = 50;
|
|
8451
|
-
|
|
8452
8484
|
// src/lib/memory/recallTool.ts
|
|
8453
8485
|
var DEFAULT_LIMIT = 8;
|
|
8454
8486
|
var DEFAULT_BUDGET = "low";
|
|
@@ -8599,7 +8631,11 @@ function createRecallTool(ctx, toolOptions, callbacks) {
|
|
|
8599
8631
|
conversationMemories += effectiveLimit;
|
|
8600
8632
|
let surfaced = 0;
|
|
8601
8633
|
try {
|
|
8634
|
+
let recallDegraded = [];
|
|
8602
8635
|
const recallOpts = {
|
|
8636
|
+
onDiagnostics: (d) => {
|
|
8637
|
+
recallDegraded = d.degraded;
|
|
8638
|
+
},
|
|
8603
8639
|
types: defaultTypes,
|
|
8604
8640
|
limit: effectiveLimit,
|
|
8605
8641
|
budget: defaultBudget,
|
|
@@ -8631,6 +8667,9 @@ function createRecallTool(ctx, toolOptions, callbacks) {
|
|
|
8631
8667
|
}
|
|
8632
8668
|
}
|
|
8633
8669
|
surfaced = result.memories.length;
|
|
8670
|
+
if (result.memories.length === 0 && recallDegraded.includes("embeddings-unavailable")) {
|
|
8671
|
+
return EMBEDDINGS_DEGRADED_EMPTY;
|
|
8672
|
+
}
|
|
8634
8673
|
const formatted = formatRecallResult(result.memories);
|
|
8635
8674
|
return truncatedByBudget && surfaced > 0 ? `${formatted}
|
|
8636
8675
|
|