@anuma/sdk 3.8.2 → 3.8.4
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-IFZZQPRO.mjs → chunk-42Y42CAZ.mjs} +60 -40
- package/dist/expo/index.cjs +223 -43
- package/dist/expo/index.d.mts +1 -1
- package/dist/expo/index.d.ts +1 -1
- package/dist/expo/index.mjs +165 -5
- package/dist/expo/{recall-MUFOZB6P.mjs → recall-JFZ3Z6EX.mjs} +1 -1
- package/dist/react/{chunk-35BHTCK4.mjs → chunk-NLVSQAYH.mjs} +60 -40
- package/dist/react/index.cjs +223 -43
- package/dist/react/index.d.mts +9 -4
- package/dist/react/index.d.ts +9 -4
- package/dist/react/index.mjs +165 -5
- package/dist/react/{recall-JUERXQA7.mjs → recall-BCEH7U2Z.mjs} +1 -1
- package/dist/server/{chunk-GKN5NJKZ.mjs → chunk-FS56IDOW.mjs} +60 -40
- package/dist/server/index.cjs +223 -43
- package/dist/server/index.d.mts +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.mjs +165 -5
- package/dist/server/{recall-XZ6WLFPJ.mjs → recall-VDMDNQNB.mjs} +1 -1
- package/package.json +1 -1
package/dist/server/index.mjs
CHANGED
|
@@ -125,7 +125,7 @@ import {
|
|
|
125
125
|
updateVaultMemoryOp,
|
|
126
126
|
upsertMessageOp,
|
|
127
127
|
vaultMemoryToStored
|
|
128
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-FS56IDOW.mjs";
|
|
129
129
|
import {
|
|
130
130
|
createStreamingDeAnonymizer,
|
|
131
131
|
resolvePiiRedactor
|
|
@@ -4831,6 +4831,162 @@ function createMemoryVaultTool(vaultCtx, options, embeddingOptions, cache) {
|
|
|
4831
4831
|
// src/lib/memory/autoExtract.ts
|
|
4832
4832
|
var import_watermelondb20 = __toESM(require_watermelondb());
|
|
4833
4833
|
|
|
4834
|
+
// src/lib/memory/entitySalience.ts
|
|
4835
|
+
var GENERIC_ENTITY_NAMES = /* @__PURE__ */ new Set([
|
|
4836
|
+
// Relative and absolute time
|
|
4837
|
+
"today",
|
|
4838
|
+
"tomorrow",
|
|
4839
|
+
"yesterday",
|
|
4840
|
+
"tonight",
|
|
4841
|
+
"morning",
|
|
4842
|
+
"afternoon",
|
|
4843
|
+
"evening",
|
|
4844
|
+
"night",
|
|
4845
|
+
"day",
|
|
4846
|
+
"date",
|
|
4847
|
+
"time",
|
|
4848
|
+
"week",
|
|
4849
|
+
"weekend",
|
|
4850
|
+
"weekday",
|
|
4851
|
+
"month",
|
|
4852
|
+
"year",
|
|
4853
|
+
"monday",
|
|
4854
|
+
"tuesday",
|
|
4855
|
+
"wednesday",
|
|
4856
|
+
"thursday",
|
|
4857
|
+
"friday",
|
|
4858
|
+
"saturday",
|
|
4859
|
+
"sunday",
|
|
4860
|
+
"january",
|
|
4861
|
+
"february",
|
|
4862
|
+
"march",
|
|
4863
|
+
"april",
|
|
4864
|
+
"may",
|
|
4865
|
+
"june",
|
|
4866
|
+
"july",
|
|
4867
|
+
"august",
|
|
4868
|
+
"september",
|
|
4869
|
+
"october",
|
|
4870
|
+
"november",
|
|
4871
|
+
"december",
|
|
4872
|
+
// Generic containers and venues — the named ones ("Blue Bottle on Valencia",
|
|
4873
|
+
// "Stanford") are unaffected because they are not bare tokens.
|
|
4874
|
+
"home",
|
|
4875
|
+
"house",
|
|
4876
|
+
"apartment",
|
|
4877
|
+
"room",
|
|
4878
|
+
"office",
|
|
4879
|
+
"work",
|
|
4880
|
+
"workplace",
|
|
4881
|
+
"school",
|
|
4882
|
+
"gym",
|
|
4883
|
+
"store",
|
|
4884
|
+
"shop",
|
|
4885
|
+
"hospital",
|
|
4886
|
+
"airport",
|
|
4887
|
+
"hotel",
|
|
4888
|
+
"city",
|
|
4889
|
+
"town",
|
|
4890
|
+
"country",
|
|
4891
|
+
"place",
|
|
4892
|
+
// Generic calendar entries — "Chicago Marathon" survives, "meeting" doesn't.
|
|
4893
|
+
"meeting",
|
|
4894
|
+
"call",
|
|
4895
|
+
"appointment",
|
|
4896
|
+
"reminder",
|
|
4897
|
+
"event",
|
|
4898
|
+
"birthday",
|
|
4899
|
+
"breakfast",
|
|
4900
|
+
"lunch",
|
|
4901
|
+
"dinner",
|
|
4902
|
+
"brunch",
|
|
4903
|
+
"vacation",
|
|
4904
|
+
"holiday",
|
|
4905
|
+
"trip",
|
|
4906
|
+
// Plurals are listed explicitly rather than stemmed: naive `s`-stripping
|
|
4907
|
+
// would fold real titles into generics ("The Times" → "time"). Only plurals
|
|
4908
|
+
// that are junk as topics in their own right belong here — note the absence
|
|
4909
|
+
// of "times", "places", and anything else that reads as a name.
|
|
4910
|
+
"days",
|
|
4911
|
+
"weeks",
|
|
4912
|
+
"weekends",
|
|
4913
|
+
"months",
|
|
4914
|
+
"years",
|
|
4915
|
+
"rooms",
|
|
4916
|
+
"offices",
|
|
4917
|
+
"houses",
|
|
4918
|
+
"apartments",
|
|
4919
|
+
"stores",
|
|
4920
|
+
"shops",
|
|
4921
|
+
"hotels",
|
|
4922
|
+
"meetings",
|
|
4923
|
+
"calls",
|
|
4924
|
+
"appointments",
|
|
4925
|
+
"reminders",
|
|
4926
|
+
"events",
|
|
4927
|
+
"birthdays",
|
|
4928
|
+
"trips",
|
|
4929
|
+
"vacations",
|
|
4930
|
+
"holidays",
|
|
4931
|
+
// Meta / filler the models occasionally echo back as an entity
|
|
4932
|
+
"user",
|
|
4933
|
+
"assistant",
|
|
4934
|
+
"memory",
|
|
4935
|
+
"memories",
|
|
4936
|
+
"note",
|
|
4937
|
+
"notes",
|
|
4938
|
+
"thing",
|
|
4939
|
+
"things",
|
|
4940
|
+
"stuff",
|
|
4941
|
+
"something",
|
|
4942
|
+
"someone",
|
|
4943
|
+
"anything",
|
|
4944
|
+
"everything",
|
|
4945
|
+
"none",
|
|
4946
|
+
"other",
|
|
4947
|
+
"misc",
|
|
4948
|
+
"general",
|
|
4949
|
+
"unknown"
|
|
4950
|
+
]);
|
|
4951
|
+
function isGenericEntityName(name) {
|
|
4952
|
+
const tokens = name.toLowerCase().split(/[^\p{L}\p{N}]+/u).filter((token) => token.length > 0);
|
|
4953
|
+
if (tokens.length === 0) return true;
|
|
4954
|
+
const distinctive = tokens.filter(
|
|
4955
|
+
(token) => !GENERIC_ENTITY_NAMES.has(token) && !ARTICLES.has(token) && !WEAK_MODIFIERS.has(token)
|
|
4956
|
+
);
|
|
4957
|
+
if (distinctive.length > 0) return false;
|
|
4958
|
+
const generic = tokens.filter((token) => GENERIC_ENTITY_NAMES.has(token));
|
|
4959
|
+
if (generic.length === 0) return true;
|
|
4960
|
+
const titleShaped = generic.length === 1 && tokens.some((token) => ARTICLES.has(token)) && !tokens.some((token) => WEAK_MODIFIERS.has(token));
|
|
4961
|
+
return !titleShaped;
|
|
4962
|
+
}
|
|
4963
|
+
var ARTICLES = /* @__PURE__ */ new Set(["the", "a", "an"]);
|
|
4964
|
+
var WEAK_MODIFIERS = /* @__PURE__ */ new Set([
|
|
4965
|
+
"my",
|
|
4966
|
+
"our",
|
|
4967
|
+
"their",
|
|
4968
|
+
"his",
|
|
4969
|
+
"her",
|
|
4970
|
+
"its",
|
|
4971
|
+
"this",
|
|
4972
|
+
"that",
|
|
4973
|
+
"next",
|
|
4974
|
+
"last",
|
|
4975
|
+
"upcoming",
|
|
4976
|
+
"every",
|
|
4977
|
+
"at",
|
|
4978
|
+
"in",
|
|
4979
|
+
"on",
|
|
4980
|
+
"of",
|
|
4981
|
+
"for",
|
|
4982
|
+
"with",
|
|
4983
|
+
"from",
|
|
4984
|
+
"to",
|
|
4985
|
+
"by",
|
|
4986
|
+
"and",
|
|
4987
|
+
"or"
|
|
4988
|
+
]);
|
|
4989
|
+
|
|
4834
4990
|
// src/lib/memory/injectionClassifier.ts
|
|
4835
4991
|
var DEFAULT_MODEL = "inclusionai/ling-2.6-flash";
|
|
4836
4992
|
var DEFAULT_ATTEMPTS = 2;
|
|
@@ -5759,13 +5915,13 @@ function parseEntities(raw) {
|
|
|
5759
5915
|
for (const e of raw) {
|
|
5760
5916
|
if (typeof e === "string") {
|
|
5761
5917
|
const name2 = e.trim();
|
|
5762
|
-
if (name2.length > 0) out.push({ name: name2 });
|
|
5918
|
+
if (name2.length > 0 && !isGenericEntityName(name2)) out.push({ name: name2 });
|
|
5763
5919
|
continue;
|
|
5764
5920
|
}
|
|
5765
5921
|
if (typeof e !== "object" || e === null) continue;
|
|
5766
5922
|
const obj = e;
|
|
5767
5923
|
const name = typeof obj.name === "string" ? obj.name.trim() : "";
|
|
5768
|
-
if (name.length === 0) continue;
|
|
5924
|
+
if (name.length === 0 || isGenericEntityName(name)) continue;
|
|
5769
5925
|
const kind = typeof obj.kind === "string" && ENTITY_KINDS.includes(obj.kind) ? obj.kind : void 0;
|
|
5770
5926
|
out.push(kind !== void 0 ? { name, kind } : { name });
|
|
5771
5927
|
}
|
|
@@ -7068,7 +7224,11 @@ var SYSTEM_PROMPT4 = `You assign topics to saved memories for a personal memory
|
|
|
7068
7224
|
|
|
7069
7225
|
Each memory is a short statement about the user. For each memory, list the NAMED entities it mentions \u2014 these become the memory's topics, used to connect related memories in a knowledge graph.
|
|
7070
7226
|
|
|
7071
|
-
Include only NAMED entities, skip generic/common nouns.
|
|
7227
|
+
Include only NAMED entities, skip generic/common nouns. A topic must identify a specific thing the user could recognize by name; if it would be equally true of thousands of unrelated memories, leave it out:
|
|
7228
|
+
- SKIP bare generic nouns even when the memory capitalizes them or a calendar entry is titled that way \u2014 "Home", "Work", "Meeting", "Lunch", "Birthday", "Appointment", "Trip", "Today", "Friday", "March" are NOT topics.
|
|
7229
|
+
- KEEP the specific thing instead, when the memory names one: "Blue Bottle on Valencia" over "cafe", "Chicago Marathon" over "event", "Hollowpoint Labs" over "work".
|
|
7230
|
+
- Prefer 0 entities over a weak one. A memory whose only candidate is a generic noun has NO entities.
|
|
7231
|
+
${ENTITY_KIND_GUIDELINES}
|
|
7072
7232
|
|
|
7073
7233
|
Each memory below is written as "<id>: <text>". Output strict JSON: {"memories": [{"id": string, "entities": [{"name": string, "kind": string}]}]}
|
|
7074
7234
|
- exactly one element per input memory; copy its id EXACTLY as written (the token before the first ": "), with no brackets, quotes, or extra characters
|
|
@@ -7080,7 +7240,7 @@ async function extractEntitiesForMemories(memories, options) {
|
|
|
7080
7240
|
const redactor = resolvePiiRedactor(options.piiRedaction);
|
|
7081
7241
|
const vocabulary = (options.existingEntityNames ?? []).filter((n) => n.trim().length > 0).slice(0, MAX_VOCABULARY_NAMES).map((n) => redactor ? redactor.redactText(n).text : n);
|
|
7082
7242
|
const vocabularyNote = vocabulary.length > 0 ? `The user's existing topics: ${vocabulary.join(", ")}.
|
|
7083
|
-
When a memory refers to one of these, reuse the EXACT existing name (same spelling and
|
|
7243
|
+
When a memory refers to one of these, reuse the EXACT existing name (same spelling, casing, spacing and punctuation) instead of a variant \u2014 if "Foo.ai" is listed, never emit "Foo ai" or "Foo AI", and if "Jane Roe" is listed, emit that rather than a bare "Jane".
|
|
7084
7244
|
|
|
7085
7245
|
` : "";
|
|
7086
7246
|
for (let i = 0; i < memories.length; i += TOPIC_EXTRACTION_BATCH_SIZE) {
|