dotmem 0.1.8 → 0.2.0

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.
@@ -3,11 +3,11 @@
3
3
  // Opt-in token-avoidance cache for LLM responses.
4
4
  ///
5
5
 
6
- export type LlmCacheScope = 'session' | 'persist'
6
+ type LlmCacheScope = 'session' | 'persist'
7
7
 
8
- export type LlmCacheMatchedBy = 'exact' | 'normalized' | 'embedding'
8
+ type LlmCacheMatchedBy = 'exact' | 'normalized' | 'embedding'
9
9
 
10
- export interface LlmCacheOptions<T = any> {
10
+ interface LlmCacheOptions<T = any> {
11
11
  key: {
12
12
  prompt: string
13
13
  model: string
@@ -27,7 +27,7 @@ export interface LlmCacheOptions<T = any> {
27
27
  estimateTokens?: (value: T) => number
28
28
  }
29
29
 
30
- export interface LlmCacheResult<T = any> {
30
+ interface LlmCacheResult<T = any> {
31
31
  value: T
32
32
  hit: boolean
33
33
  matchedBy?: LlmCacheMatchedBy
@@ -38,14 +38,14 @@ export interface LlmCacheResult<T = any> {
38
38
  provenance: 'CACHED' | 'FRESH'
39
39
  }
40
40
 
41
- export interface LlmCacheStats {
41
+ interface LlmCacheStats {
42
42
  hits: number
43
43
  misses: number
44
44
  savedTokens: number
45
45
  entries: number
46
46
  }
47
47
 
48
- export interface LlmCachePurgeSelector {
48
+ interface LlmCachePurgeSelector {
49
49
  key?: string
50
50
  model?: string
51
51
  olderThan?: string
package/types/logic.d.ts CHANGED
@@ -1,79 +1,60 @@
1
- import type {
2
- AcquiredClaim,
3
- AcquiredContext,
4
- ClaimProvenance,
5
- EpistemicType,
6
- EvidenceReference,
7
- JsonPrimitive,
8
- JsonValue
9
- } from './memory'
10
-
11
- export type LogicEpistemicType = EpistemicType
12
-
13
- export interface LogicExperienceInput {
14
- situation: JsonValue
15
- action: JsonValue
16
- outcome: JsonValue
17
- evidence: EvidenceReference[]
18
- }
19
-
20
- export interface LogicExperienceOptions extends LogicExperienceInput {
21
- id: string
22
- applicability: Record<string, JsonPrimitive>
23
- epistemicType?: LogicEpistemicType
24
- provenance?: ClaimProvenance
25
- acquiredAt?: string
26
- refines?: string | string[]
27
- supersedes?: string | string[]
28
- retracts?: string | string[]
29
- reason?: string
30
- }
31
-
32
- export interface LogicQuery {
33
- context: Record<string, JsonPrimitive>
34
- }
35
-
36
- export interface LogicMeasurement {
37
- total: number
38
- selected: number
39
- selectedIds: string[]
40
- knowledgeVersion: number
41
- temporalMutations: number
42
- }
43
-
44
- export interface LogicRule {
45
- id: string
46
- condition: JsonValue
47
- recommendation: JsonValue
48
- evidence: EvidenceReference[]
49
- confidence: number
50
- }
51
-
52
- export interface LogicStats {
53
- experiences: number
54
- version: number
55
- }
56
-
57
- export interface LogicEngineAPI {
58
- experience(opts: LogicExperienceOptions): Promise<void>
59
- precedents(query: LogicQuery): Promise<AcquiredClaim[]>
60
- context(query: LogicQuery): Promise<AcquiredContext>
61
- measure(query: LogicQuery): Promise<LogicMeasurement>
62
- learn(query: LogicQuery): Promise<LogicRule[]>
63
- clear(): Promise<void>
64
- stats(): Promise<LogicStats>
65
- }
66
-
67
- export declare class LogicEngine implements LogicEngineAPI {
68
- experience(opts: LogicExperienceOptions): Promise<void>
69
- precedents(query: LogicQuery): Promise<AcquiredClaim[]>
70
- context(query: LogicQuery): Promise<AcquiredContext>
71
- measure(query: LogicQuery): Promise<LogicMeasurement>
72
- learn(query: LogicQuery): Promise<LogicRule[]>
73
- clear(): Promise<void>
74
- stats(): Promise<LogicStats>
75
- configure(opts: { disabled?: boolean }): void
76
- }
77
-
78
- declare const logic: LogicEngine
79
- export default logic
1
+ type LogicEpistemicType = EpistemicType
2
+ interface LogicExperienceInput {
3
+ situation: JsonValue
4
+ action: JsonValue
5
+ outcome: JsonValue
6
+ evidence: EvidenceReference[]
7
+ }
8
+ interface LogicExperienceOptions extends LogicExperienceInput {
9
+ id: string
10
+ applicability: Record<string, JsonPrimitive>
11
+ epistemicType?: LogicEpistemicType
12
+ provenance?: ClaimProvenance
13
+ acquiredAt?: string
14
+ refines?: string | string[]
15
+ supersedes?: string | string[]
16
+ retracts?: string | string[]
17
+ reason?: string
18
+ }
19
+ interface LogicQuery {
20
+ context: Record<string, JsonPrimitive>
21
+ }
22
+ interface LogicMeasurement {
23
+ total: number
24
+ selected: number
25
+ selectedIds: string[]
26
+ knowledgeVersion: number
27
+ temporalMutations: number
28
+ }
29
+ interface LogicRule {
30
+ id: string
31
+ condition: JsonValue
32
+ recommendation: JsonValue
33
+ evidence: EvidenceReference[]
34
+ confidence: number
35
+ }
36
+ interface LogicStats {
37
+ experiences: number
38
+ version: number
39
+ }
40
+ interface LogicEngineAPI {
41
+ experience(opts: LogicExperienceOptions): Promise<void>
42
+ precedents(query: LogicQuery): Promise<AcquiredClaim[]>
43
+ context(query: LogicQuery): Promise<AcquiredContext>
44
+ measure(query: LogicQuery): Promise<LogicMeasurement>
45
+ learn(query: LogicQuery): Promise<LogicRule[]>
46
+ clear(): Promise<void>
47
+ stats(): Promise<LogicStats>
48
+ }
49
+ export declare class LogicEngine implements LogicEngineAPI {
50
+ experience(opts: LogicExperienceOptions): Promise<void>
51
+ precedents(query: LogicQuery): Promise<AcquiredClaim[]>
52
+ context(query: LogicQuery): Promise<AcquiredContext>
53
+ measure(query: LogicQuery): Promise<LogicMeasurement>
54
+ learn(query: LogicQuery): Promise<LogicRule[]>
55
+ clear(): Promise<void>
56
+ stats(): Promise<LogicStats>
57
+ configure(opts: { disabled?: boolean }): void
58
+ }
59
+ declare const logic: LogicEngine
60
+ export default logic