@elizaos/plugin-memory 1.1.0 → 1.1.2
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 +230 -330
- package/dist/actions/remember.d.ts +11 -0
- package/dist/browser/index.browser.js +205 -348
- package/dist/browser/index.browser.js.map +13 -23
- package/dist/cjs/index.node.cjs +936 -2193
- package/dist/cjs/index.node.js.map +13 -23
- package/dist/evaluators/long-term-extraction.d.ts +8 -0
- package/dist/evaluators/summarization.d.ts +25 -6
- package/dist/index.d.ts +32 -152
- package/dist/node/index.node.js +944 -2210
- package/dist/node/index.node.js.map +13 -23
- package/dist/providers/context-summary.d.ts +12 -0
- package/dist/providers/long-term-memory.d.ts +11 -18
- package/dist/schemas/index.d.ts +6 -16
- package/dist/schemas/long-term-memories.d.ts +70 -308
- package/dist/schemas/memory-access-logs.d.ts +154 -0
- package/dist/schemas/session-summaries.d.ts +283 -0
- package/dist/services/memory-service.d.ts +51 -95
- package/dist/types/index.d.ts +53 -298
- package/package.json +2 -84
- package/dist/evaluators/consolidation.d.ts +0 -19
- package/dist/prompts/consolidation.d.ts +0 -35
- package/dist/prompts/summarization.d.ts +0 -25
- package/dist/providers/action-results.d.ts +0 -2
- package/dist/providers/recent-conversation-summary.d.ts +0 -2
- package/dist/repositories/conversation-summary.d.ts +0 -33
- package/dist/repositories/index.d.ts +0 -17
- package/dist/repositories/long-term-memory.d.ts +0 -53
- package/dist/schemas/conversation-summaries.d.ts +0 -494
- package/dist/utils/db-mapping.d.ts +0 -20
- package/dist/utils/decay-scoring.d.ts +0 -41
- package/dist/utils/embedding.d.ts +0 -21
- package/dist/utils/formatting.d.ts +0 -17
- package/dist/utils/index.d.ts +0 -17
- package/dist/utils/search-merging.d.ts +0 -18
- package/dist/utils/token-counter.d.ts +0 -53
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Token Counter Utility
|
|
3
|
-
*
|
|
4
|
-
* Research: Section 5.1.3 "Token Budget Enforcement"
|
|
5
|
-
*
|
|
6
|
-
* This utility provides token counting for memory content to enforce
|
|
7
|
-
* token budgets during retrieval. Uses a simplified estimation based on
|
|
8
|
-
* GPT tokenization rules (1 token ≈ 4 characters for English text).
|
|
9
|
-
*
|
|
10
|
-
* For more precise counting, this can be replaced with a full tokenizer
|
|
11
|
-
* library (e.g., tiktoken), but the estimation is sufficient for budget
|
|
12
|
-
* enforcement in most cases.
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* Estimate token count for a given text
|
|
16
|
-
*
|
|
17
|
-
* This is a simplified heuristic that works well for most content:
|
|
18
|
-
* - 1 token ≈ 4 characters for English text
|
|
19
|
-
* - Punctuation and whitespace are included
|
|
20
|
-
* - Non-English text may have different ratios
|
|
21
|
-
*
|
|
22
|
-
* @param text - The text to count tokens for
|
|
23
|
-
* @returns Estimated token count
|
|
24
|
-
*/
|
|
25
|
-
export declare function estimateTokenCount(text: string): number;
|
|
26
|
-
/**
|
|
27
|
-
* Calculate token count for multiple text segments
|
|
28
|
-
*
|
|
29
|
-
* @param texts - Array of text strings
|
|
30
|
-
* @returns Total estimated token count
|
|
31
|
-
*/
|
|
32
|
-
export declare function estimateTokenCountForArray(texts: string[]): number;
|
|
33
|
-
/**
|
|
34
|
-
* Trim an array of items to fit within a token budget
|
|
35
|
-
*
|
|
36
|
-
* This function takes an array of items with text content and trims it
|
|
37
|
-
* to fit within the specified token budget. Items are assumed to be
|
|
38
|
-
* already sorted by priority/score (highest first).
|
|
39
|
-
*
|
|
40
|
-
* @param items - Array of items (with getText function)
|
|
41
|
-
* @param budget - Maximum token budget
|
|
42
|
-
* @param getText - Function to extract text from an item
|
|
43
|
-
* @param includeOverhead - Additional tokens per item (formatting overhead)
|
|
44
|
-
* @returns Trimmed array of items that fit within budget
|
|
45
|
-
*/
|
|
46
|
-
export declare function trimToTokenBudget<T>(items: T[], budget: number, getText: (item: T) => string, includeOverhead?: number): T[];
|
|
47
|
-
/**
|
|
48
|
-
* Format token count for human-readable display
|
|
49
|
-
*
|
|
50
|
-
* @param count - Token count
|
|
51
|
-
* @returns Formatted string (e.g., "1.2K tokens")
|
|
52
|
-
*/
|
|
53
|
-
export declare function formatTokenCount(count: number): string;
|