agentfootprint 9.4.0 → 9.5.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.
Files changed (51) hide show
  1. package/AGENTS.md +2 -1
  2. package/dist/esm/memory/define.d.ts +2 -1
  3. package/dist/esm/memory/define.js +57 -8
  4. package/dist/esm/memory/define.js.map +1 -1
  5. package/dist/esm/memory/define.types.d.ts +30 -4
  6. package/dist/esm/memory/define.types.js +6 -0
  7. package/dist/esm/memory/define.types.js.map +1 -1
  8. package/dist/esm/memory/index.d.ts +1 -0
  9. package/dist/esm/memory/index.js +3 -0
  10. package/dist/esm/memory/index.js.map +1 -1
  11. package/dist/esm/memory/pipeline/default.d.ts +16 -0
  12. package/dist/esm/memory/pipeline/default.js +8 -1
  13. package/dist/esm/memory/pipeline/default.js.map +1 -1
  14. package/dist/esm/memory/stages/filterByDecay.d.ts +67 -0
  15. package/dist/esm/memory/stages/filterByDecay.js +44 -0
  16. package/dist/esm/memory/stages/filterByDecay.js.map +1 -0
  17. package/dist/esm/memory/stages/index.d.ts +2 -0
  18. package/dist/esm/memory/stages/index.js +1 -0
  19. package/dist/esm/memory/stages/index.js.map +1 -1
  20. package/dist/esm/memory/strategies.d.ts +133 -0
  21. package/dist/esm/memory/strategies.js +336 -0
  22. package/dist/esm/memory/strategies.js.map +1 -0
  23. package/dist/memory/define.js +57 -8
  24. package/dist/memory/define.js.map +1 -1
  25. package/dist/memory/define.types.js +6 -0
  26. package/dist/memory/define.types.js.map +1 -1
  27. package/dist/memory/index.js +6 -1
  28. package/dist/memory/index.js.map +1 -1
  29. package/dist/memory/pipeline/default.js +8 -1
  30. package/dist/memory/pipeline/default.js.map +1 -1
  31. package/dist/memory/stages/filterByDecay.js +48 -0
  32. package/dist/memory/stages/filterByDecay.js.map +1 -0
  33. package/dist/memory/stages/index.js +4 -1
  34. package/dist/memory/stages/index.js.map +1 -1
  35. package/dist/memory/strategies.js +343 -0
  36. package/dist/memory/strategies.js.map +1 -0
  37. package/dist/types/memory/define.d.ts +2 -1
  38. package/dist/types/memory/define.d.ts.map +1 -1
  39. package/dist/types/memory/define.types.d.ts +30 -4
  40. package/dist/types/memory/define.types.d.ts.map +1 -1
  41. package/dist/types/memory/index.d.ts +1 -0
  42. package/dist/types/memory/index.d.ts.map +1 -1
  43. package/dist/types/memory/pipeline/default.d.ts +16 -0
  44. package/dist/types/memory/pipeline/default.d.ts.map +1 -1
  45. package/dist/types/memory/stages/filterByDecay.d.ts +68 -0
  46. package/dist/types/memory/stages/filterByDecay.d.ts.map +1 -0
  47. package/dist/types/memory/stages/index.d.ts +2 -0
  48. package/dist/types/memory/stages/index.d.ts.map +1 -1
  49. package/dist/types/memory/strategies.d.ts +134 -0
  50. package/dist/types/memory/strategies.d.ts.map +1 -0
  51. package/package.json +1 -1
@@ -68,6 +68,12 @@ export type MemoryType = (typeof MEMORY_TYPES)[keyof typeof MEMORY_TYPES];
68
68
  * `CAUSAL` type accepts ONLY `TOP_K` — its snapshots are matched semantically
69
69
  * against the new query, never by recency, so `buildCausalPipeline` throws on
70
70
  * any other strategy kind. Mix and match the non-Causal types.
71
+ *
72
+ * These are BARE STRINGS, which is enough to write one and not enough to
73
+ * OFFER one. `listMemoryStrategies()` (./strategies.ts) is the same seven
74
+ * described — what each does, which TYPES accept it, and what the host must
75
+ * supply (`requirements`) — so a picker can grey out what this deployment
76
+ * cannot run instead of finding out from an exception.
71
77
  */
72
78
  export declare const MEMORY_STRATEGIES: {
73
79
  readonly WINDOW: "window";
@@ -236,14 +242,34 @@ export interface ExtractStrategy {
236
242
  readonly maxPerTurn?: number;
237
243
  }
238
244
  /**
239
- * Decay — score entries by `recency × accessCount`, drop below floor.
240
- * For long-running agents where unused memory should fade.
245
+ * Decay — let old memory fade. Each loaded entry is scored by AGE against
246
+ * `halfLifeMs` (`2^(-age / halfLife)`) and dropped below `minScore`, so a
247
+ * long-running agent stops rehearsing last month. Free: arithmetic on a
248
+ * timestamp, no LLM and no embedder. EPISODIC only.
249
+ *
250
+ * Wired in 9.5.0. Before that, this type existed, `MEMORY_STRATEGIES.DECAY`
251
+ * existed, and `defineMemory` threw "not yet wired" on it.
252
+ *
253
+ * AGE, not use. The underlying model (`computeDecayFactor`) also has an
254
+ * access term, and the read path passes a neutral `1` for it: `accessCount`
255
+ * is bumped by `store.get()`, and no shipped read path calls `get()` — they
256
+ * `list()` or `search()`. A knob for it here would be wired to a counter
257
+ * that never moves, so there isn't one. Nothing stored is mutated either:
258
+ * an entry that decays out of one turn is still in the store, and the next
259
+ * turn scores it again.
241
260
  */
242
261
  export interface DecayStrategy {
243
262
  readonly kind: typeof MEMORY_STRATEGIES.DECAY;
244
- /** Half-life in milliseconds for the recency component. */
263
+ /**
264
+ * How long before an untouched entry is worth half as much, in
265
+ * milliseconds. A day is `86_400_000`. Must be finite and non-negative —
266
+ * a negative half-life would score OLDER entries higher, so it is refused.
267
+ */
245
268
  readonly halfLifeMs: number;
246
- /** Drop entries scoring below this. Default 0.1. */
269
+ /**
270
+ * Drop entries scoring below this. Default 0.1 — roughly "older than
271
+ * three-and-a-bit half-lives". `0` keeps everything.
272
+ */
247
273
  readonly minScore?: number;
248
274
  }
249
275
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"define.types.d.ts","sourceRoot":"","sources":["../../../src/memory/define.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAI9D;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY;;;;;CAK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AAI,UAAU,CAE/D;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,kBAAkB,CAE/E;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,YAAY,CAEnE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,kBAAkB,CAE/E;AAID;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,oBAA8B,CAAC;AAEvE,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,6BAA6B,sBAAgC,CAAC;AAE3E,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE3D"}
@@ -18,4 +18,5 @@ export * from './wire/index.js';
18
18
  export * from './retrieval/index.js';
19
19
  export { MEMORY_TYPES, MEMORY_STRATEGIES, MEMORY_TIMING, SNAPSHOT_PROJECTIONS, MEMORY_INJECTION_KEY_PREFIX, RETRIEVAL_EVIDENCE_KEY_PREFIX, isMemoryType, isMemoryStrategyKind, isMemoryTiming, isSnapshotProjection, memoryInjectionKey, isMemoryInjectionKey, retrievalEvidenceKey, isRetrievalEvidenceKey, type MemoryType, type MemoryStrategyKind, type MemoryTiming, type SnapshotProjection, type Strategy, type MemoryWindowStrategy, type BudgetStrategy, type SummarizeStrategy, type TopKStrategy, type TopKShorthandStrategy, type TopKRetrievalStrategy, type MemoryFlavor, type ExtractStrategy, type DecayStrategy, type HybridStrategy, type MemoryDefinition, type DefineMemoryOptions, type DefineEpisodicOptions, type DefineSemanticOptions, type DefineNarrativeOptions, type DefineCausalOptions, type MemoryRedactionPolicy, } from './define.types.js';
20
20
  export { defineMemory } from './define.js';
21
+ export { listMemoryStrategies, memoryStrategyInfo, type MemoryStrategyInfo, type MemoryStrategyRequirement, } from './strategies.js';
21
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/memory/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AAGrC,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,2BAA2B,EAC3B,6BAA6B,EAC7B,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,QAAQ,EACb,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,GAC3B,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"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+ import { type FilterByDecayConfig } from '../stages/filterByDecay.js';
1
2
  import type { MemoryStore } from '../store/index.js';
2
3
  import type { MemoryPipeline } from './types.js';
3
4
  export interface DefaultPipelineConfig {
@@ -34,6 +35,21 @@ export interface DefaultPipelineConfig {
34
35
  * retention windows.
35
36
  */
36
37
  readonly writeTtlMs?: number;
38
+ /**
39
+ * Let old entries fade (9.5.0). When present, a `FilterByDecay` stage is
40
+ * composed between the load and the picker: every loaded entry is scored
41
+ * by AGE against `halfLifeMs` and dropped below `minScore`, so a
42
+ * long-running conversation stops rehearsing last month.
43
+ *
44
+ * Absent — the historical behaviour — means no decay stage is compiled at
45
+ * all, not a decay stage that keeps everything. What is not in the chart
46
+ * cannot cost anything or appear in the narrative.
47
+ *
48
+ * `defineMemory({ strategy: { kind: MEMORY_STRATEGIES.DECAY, halfLifeMs } })`
49
+ * is the door most consumers use; this is the same thing, spelled at the
50
+ * pipeline level so it composes with `loadCount` / the budget knobs.
51
+ */
52
+ readonly decay?: FilterByDecayConfig;
37
53
  /**
38
54
  * Override for the formatter's header text. Omit to use the default
39
55
  * "Relevant context from prior conversations..." phrasing.
@@ -1 +1 @@
1
- {"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../src/memory/pipeline/default.ts"],"names":[],"mappings":"AAwDA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,WAAW,qBAAqB;IACpC,qCAAqC;IACrC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAE5B,6EAA6E;IAC7E,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAE5B;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAEhC,kFAAkF;IAClF,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAEhC;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,E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,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;IAE7C;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAE7B;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAErC;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAE/B,gEAAgE;IAChE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,cAAc,CA2D7E"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * filterByDecay — read-side stage that lets old memory fade.
3
+ *
4
+ * Reads from scope: `loaded`
5
+ * Writes to scope: `loaded` (the survivors, order preserved)
6
+ *
7
+ * Where it sits:
8
+ *
9
+ * loadRecent → filterByDecay → pickByBudget → formatDefault
10
+ *
11
+ * BEFORE the picker on purpose. The picker spends a token budget on what it
12
+ * is given; deciding what has faded is not a budget question, and a stale
13
+ * entry that fits should still not be injected. Dropping first also means
14
+ * the budget is spent on entries that are still worth something.
15
+ *
16
+ * ## The score
17
+ *
18
+ * `computeDecayFactor` (memory/entry/decay.ts) is the model, unchanged:
19
+ *
20
+ * factor = 2^(-age / halfLife) · min(accessBoost^accessCount, 10)
21
+ *
22
+ * This stage passes `accessBoost: 1`, which makes the access term exactly
23
+ * `1` and the score purely age-based — and that is a truthful default rather
24
+ * than a timid one. `accessCount` is incremented by `store.get()`, and no
25
+ * shipped read path calls `get()`: they all `list()` or `search()`. So an
26
+ * access-weighted knob here would be a dial wired to a counter that never
27
+ * moves. When a read path starts bumping it, the term is already in the
28
+ * model and the knob can arrive with something real behind it.
29
+ *
30
+ * ## What is never dropped
31
+ *
32
+ * An entry whose `lastAccessedAt` is missing or not a finite number is KEPT.
33
+ * A store that does not date its entries has not told us they are old, and
34
+ * "I cannot date this" must not read as "this is ancient" — the arithmetic
35
+ * would produce `NaN`, and `NaN >= minScore` is false, which would silently
36
+ * drop every entry from such a store.
37
+ */
38
+ import type { TypedScope } from 'footprintjs';
39
+ import type { MemoryState } from './types.js';
40
+ export interface FilterByDecayConfig {
41
+ /**
42
+ * How long, in milliseconds, before an untouched entry is worth half as
43
+ * much. `0` means "anything not written this instant is gone".
44
+ */
45
+ readonly halfLifeMs: number;
46
+ /**
47
+ * Drop entries scoring below this. Default `0.1` — roughly "older than
48
+ * three-and-a-bit half-lives". `0` keeps everything, which is a coherent
49
+ * request (score, don't drop) and is honoured as written.
50
+ */
51
+ readonly minScore?: number;
52
+ /**
53
+ * Clock seam. Defaults to `Date.now`; tests pass a fixed clock so a decay
54
+ * assertion is arithmetic rather than a race.
55
+ */
56
+ readonly now?: () => number;
57
+ }
58
+ /** See {@link FilterByDecayConfig.minScore}. */
59
+ export declare const DEFAULT_DECAY_MIN_SCORE = 0.1;
60
+ /**
61
+ * Build a stage that drops faded entries from `scope.loaded`.
62
+ *
63
+ * Pure arithmetic over what is already in scope: no store call, no LLM, no
64
+ * embedding, and no mutation of anything stored — an entry that decays out
65
+ * of one turn is still in the store, and a later turn scores it again.
66
+ */
67
+ export declare function filterByDecay(config: FilterByDecayConfig): (scope: TypedScope<MemoryState>) => Promise<void>;
68
+ //# sourceMappingURL=filterByDecay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterByDecay.d.ts","sourceRoot":"","sources":["../../../../src/memory/stages/filterByDecay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAE3B;;;OAGG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CAC7B;AAED,gDAAgD;AAChD,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAQ3C;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,mBAAmB,WAQlC,WAAW,WAAW,CAAC,KAAG,QAAQ,IAAI,CAAC,CAoB7D"}
@@ -11,4 +11,6 @@ export { approximateTokenCounter, countMessageTokens } from './tokenize.js';
11
11
  export type { TokenCounter } from './tokenize.js';
12
12
  export { summarize } from './summarize.js';
13
13
  export type { SummarizeConfig } from './summarize.js';
14
+ export { filterByDecay, DEFAULT_DECAY_MIN_SCORE } from './filterByDecay.js';
15
+ export type { FilterByDecayConfig } from './filterByDecay.js';
14
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/memory/stages/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAC5E,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/memory/stages/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAC5E,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Named memory strategies — what each one does, which TYPES accept it, and
3
+ * what the host must supply before it can run.
4
+ *
5
+ * `MEMORY_STRATEGIES` is a const of seven bare strings. A string is enough to
6
+ * WRITE `strategy: { kind: … }` and not nearly enough to OFFER the choice: a
7
+ * host rendering a strategy picker off that const offers seven options, and
8
+ * learns which of them this deployment can actually run by calling
9
+ * `defineMemory` and reading the exception. That is a selector that discovers
10
+ * its own capabilities by failing.
11
+ *
12
+ * So each strategy declares itself, and `listMemoryStrategies()` enumerates
13
+ * the declarations. The shape mirrors the influence exemplar in this same
14
+ * package (`listInfluenceStrategies()` → `{ name, description, requirements,
15
+ * scorer }`), with two deliberate differences:
16
+ *
17
+ * • the id is `kind`, not `name` — it is the value the caller writes into
18
+ * `strategy.kind`, so a picker's option value IS the id;
19
+ * • there is no `scorer`, because a memory strategy is not a function the
20
+ * host calls; what it needs instead is `types` — the memory TYPES that
21
+ * accept it, which is the other half of "can I offer this?" (`decay` on a
22
+ * SEMANTIC store is refused however good the host's credentials are).
23
+ *
24
+ * `requirements` is what a host must SUPPLY (an embedder, an LLM, a store
25
+ * that can search). Empty means the strategy runs anywhere, at $0.
26
+ *
27
+ * Pattern: declared capability descriptors + the two guards that enforce
28
+ * them — SHAPE first (`assertStrategyShape`: is this even a
29
+ * strategy?), REQUIREMENTS after (`assertStrategyRequirements`: can
30
+ * this deployment run it?).
31
+ * Role: memory/ layer-1, beside the const it describes.
32
+ * Emits: N/A — build-time only.
33
+ *
34
+ * @see ./define.types.ts for `MEMORY_STRATEGIES` and the strategy union
35
+ * @see ../lib/influence-core/strategies.ts for the exemplar this follows
36
+ */
37
+ import { type DefineMemoryOptions, type MemoryStrategyKind, type MemoryType } from './define.types.js';
38
+ /**
39
+ * What a strategy needs the host to supply before it can run. A picker greys
40
+ * out (or refuses to offer) strategies whose requirements it cannot meet.
41
+ *
42
+ * Three well-known values ship; the type stays open so a consumer's own
43
+ * strategy descriptor can name something else:
44
+ *
45
+ * - `'embedder'` — an `Embedder` that turns text into a vector.
46
+ * - `'vector-store'` — a store that implements `search()`. Not the same
47
+ * requirement as an embedder: the embedder makes the
48
+ * query vector, the store is what ranks against it,
49
+ * and a deployment can easily have one without the
50
+ * other (`RedisStore` is a full memory store with no
51
+ * `search()` at all).
52
+ * - `'llm'` — a chat provider the strategy calls on the host's
53
+ * behalf.
54
+ */
55
+ export type MemoryStrategyRequirement = 'embedder' | 'vector-store' | 'llm' | (string & Record<never, never>);
56
+ /**
57
+ * A memory strategy, described: enough for a host to render it in a picker
58
+ * and know, before it offers the option, whether this deployment can run it.
59
+ */
60
+ export interface MemoryStrategyInfo {
61
+ /** The value written as `strategy.kind` — a member of `MEMORY_STRATEGIES`. */
62
+ readonly kind: MemoryStrategyKind;
63
+ /** One-or-two-sentence plain description, current-truth caveats included. */
64
+ readonly description: string;
65
+ /** What the host must supply. Empty = runs anywhere, no dependency, $0. */
66
+ readonly requirements: readonly MemoryStrategyRequirement[];
67
+ /** The memory TYPES that accept this strategy. Any other pair is refused. */
68
+ readonly types: readonly MemoryType[];
69
+ }
70
+ /**
71
+ * Every memory strategy, described — cheapest first, in the order the docs
72
+ * teach them. Frozen: a host renders its picker straight off this.
73
+ *
74
+ * @example Offer only what this deployment can actually run
75
+ * ```ts
76
+ * import { listMemoryStrategies } from 'agentfootprint/memory';
77
+ *
78
+ * const available = new Set(embedder ? ['embedder', 'vector-store'] : []);
79
+ * const offerable = listMemoryStrategies().filter(
80
+ * (s) => s.types.includes('episodic') && s.requirements.every((r) => available.has(r)),
81
+ * );
82
+ * // → window, budget, decay, hybrid — the four that cost nothing to run.
83
+ * ```
84
+ */
85
+ export declare function listMemoryStrategies(): readonly MemoryStrategyInfo[];
86
+ /**
87
+ * One strategy's description by `kind`, or `undefined` for a string that is
88
+ * not a strategy at all.
89
+ */
90
+ export declare function memoryStrategyInfo(kind: string): MemoryStrategyInfo | undefined;
91
+ /**
92
+ * Refuse a strategy whose SHAPE is wrong, before anything reads into it.
93
+ *
94
+ * WHY it runs FIRST, ahead of both the pipeline dispatch and the
95
+ * requirements walk: those two read FIELDS off the strategy
96
+ * (`strategies[0]`, `s.embedder`, `for (const sub of strategy.strategies)`),
97
+ * and a field read off a shape that never had it is a `TypeError` with the
98
+ * library's internals in the text — `Cannot read properties of undefined
99
+ * (reading '0')` for `{ kind: 'hybrid', size: 5 }`, which names neither the
100
+ * option the caller got wrong nor the one they meant. A caller cannot act on
101
+ * that. This guard turns every such read into a refusal that names the
102
+ * field, shows the line that would have worked, and points at the catalogue.
103
+ *
104
+ * It checks SHAPE only — is this an object, does it carry a `kind`, does a
105
+ * `hybrid` carry the array that makes it a hybrid. It deliberately does NOT
106
+ * judge whether the kind is real or legal for the type: the dispatch refuses
107
+ * those and names the alternative for that type, which is the better message.
108
+ *
109
+ * @param strategy the strategy exactly as the caller wrote it — `unknown`,
110
+ * because the whole point is that it may not be a `Strategy`.
111
+ * @param site the call to name in the message, e.g. `defineMemory[chat]`.
112
+ */
113
+ export declare function assertStrategyShape(strategy: unknown, site: string): void;
114
+ /**
115
+ * Refuse a config whose strategy declares a requirement the caller did not
116
+ * supply — by name, at BUILD, with the fix in the message.
117
+ *
118
+ * WHY it runs LAST, after the pipeline dispatch rather than before it: the
119
+ * dispatch's own refusals know more than this one does. `defineMemory`'s
120
+ * TOP_K arm knows about the `ranksBy: 'server-text'` exemption AND about the
121
+ * write half it takes away; the CAUSAL arm knows that exemption does not
122
+ * apply to it; the EXTRACT arm knows the `llm` matters only for
123
+ * `extractor: 'llm'`. Speaking first would replace those messages with a
124
+ * blunter one. This is the BACKSTOP: it says something only when nothing
125
+ * better already did, and its job is that no declared requirement can go
126
+ * unchecked — the failure it exists to prevent is a missing dependency
127
+ * surfacing as a `TypeError` from five frames inside a stage, halfway
128
+ * through a paid run.
129
+ *
130
+ * @param options the config as written by the caller.
131
+ * @param site the call to name in the message, e.g. `defineMemory[chat]`.
132
+ */
133
+ export declare function assertStrategyRequirements(options: DefineMemoryOptions, site: string): void;
134
+ //# sourceMappingURL=strategies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strategies.d.ts","sourceRoot":"","sources":["../../../src/memory/strategies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,UAAU,EAEhB,MAAM,mBAAmB,CAAC;AAI3B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,yBAAyB,GACjC,UAAU,GACV,cAAc,GACd,KAAK,GACL,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AAEpC;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC,6EAA6E;IAC7E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,2EAA2E;IAC3E,QAAQ,CAAC,YAAY,EAAE,SAAS,yBAAyB,EAAE,CAAC;IAC5D,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,CAAC;CACvC;AAsFD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,IAAI,SAAS,kBAAkB,EAAE,CAEpE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAE/E;AAuBD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAEzE;AA6ED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAE3F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentfootprint",
3
- "version": "9.4.0",
3
+ "version": "9.5.1",
4
4
  "description": "The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",