dotmem 0.0.1 → 0.0.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/AGENTS.md +464 -0
- package/CHANGELOG.md +0 -0
- package/COPYRIGHT.md +4 -0
- package/DOTMEM.md +42 -0
- package/LICENSE.md +11 -0
- package/MEMORY.md +518 -0
- package/PACKAGE.md +59 -0
- package/README.md +347 -0
- package/SECURITY.md +524 -0
- package/agent.cjs +221 -0
- package/agent.js +218 -0
- package/bin/cli.cjs +35 -0
- package/bin/cli.js +28 -0
- package/bin/mcp.cjs +22 -0
- package/bin/mcp.js +16 -0
- package/cli.cjs +15482 -0
- package/cli.js +15350 -0
- package/global.cjs +7827 -0
- package/global.d.ts +14 -0
- package/global.js +7808 -0
- package/index.cjs +29855 -0
- package/index.d.ts +15 -0
- package/index.js +29617 -0
- package/llms.txt +295 -0
- package/mcp.cjs +45234 -0
- package/mcp.js +45207 -0
- package/package.json +73 -53
- package/types/agent.d.ts +87 -0
- package/types/assets.d.ts +4 -0
- package/types/bun-sqlite.d.ts +14 -0
- package/types/exports.d.ts +285 -0
- package/types/fflate-browser.d.ts +7 -0
- package/types/inspect.d.ts +14 -0
- package/types/llm-cache.d.ts +53 -0
- package/types/logic.d.ts +79 -0
- package/types/memory.d.ts +336 -0
- package/types/policy.d.ts +291 -0
- package/types/profile.d.ts +27 -0
- package/types/reattach.d.ts +0 -87
package/package.json
CHANGED
|
@@ -1,72 +1,92 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dotmem",
|
|
3
3
|
"codeName": "dotmem",
|
|
4
|
-
"version": "0.0.
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"main": "./index.
|
|
9
|
-
"module": "./index.
|
|
4
|
+
"version": "0.0.3",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"description": "The AI memory layer for agents and apps: acquired experience, discovery, context projection, continuity, and logic engine. Built on dotmem's state+store foundation.",
|
|
8
|
+
"main": "./index.cjs",
|
|
9
|
+
"module": "./index.js",
|
|
10
10
|
"types": "./index.d.ts",
|
|
11
|
-
"typings": "./index.d.ts",
|
|
12
11
|
"exports": {
|
|
13
12
|
".": {
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
13
|
+
"import": "./index.js",
|
|
14
|
+
"require": "./index.cjs",
|
|
15
|
+
"types": "./index.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"./global": {
|
|
18
|
+
"import": "./global.js",
|
|
19
|
+
"require": "./global.cjs",
|
|
20
|
+
"types": "./global.d.ts"
|
|
17
21
|
},
|
|
18
|
-
"./
|
|
22
|
+
"./agent": {
|
|
23
|
+
"import": "./agent.js",
|
|
24
|
+
"require": "./agent.cjs"
|
|
25
|
+
}
|
|
19
26
|
},
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
"copyright": "Dario Passariello",
|
|
28
|
+
"author": "Dario Passariello - <dariopassariello@gmail.com>",
|
|
29
|
+
"contributors": [
|
|
30
|
+
{
|
|
31
|
+
"name": "Dario Passariello",
|
|
32
|
+
"email": "dariopassarielloa@gmail.com"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "Valeria Cala Scaglitta",
|
|
36
|
+
"email": "valeriacalascaglitta@gmail.com"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"bin": {
|
|
40
|
+
"dotmem": "./bin/cli.js",
|
|
41
|
+
"dotmem-mcp": "./bin/mcp.js"
|
|
42
|
+
},
|
|
43
|
+
"workspaces": [
|
|
44
|
+
"tests"
|
|
33
45
|
],
|
|
34
46
|
"keywords": [
|
|
35
47
|
".mem",
|
|
48
|
+
"dotmem",
|
|
49
|
+
"ai-agent",
|
|
50
|
+
"agent-memory",
|
|
51
|
+
"acquired-experience",
|
|
36
52
|
"memory",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
53
|
+
"continuity",
|
|
54
|
+
"knowledge",
|
|
39
55
|
"mcp",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
56
|
+
"joytrend",
|
|
57
|
+
"joy",
|
|
58
|
+
"jo"
|
|
43
59
|
],
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"npm:publish": "npm run build && npm publish ./dist",
|
|
47
|
-
"": "-----------",
|
|
48
|
-
"lint": "cd tests && npm run lint",
|
|
49
|
-
"tsc": "cd tests && npm run tsc",
|
|
50
|
-
"test": "cd tests && npm run test",
|
|
51
|
-
"test:coverage": "cd tests && npm run test:coverage",
|
|
52
|
-
"pw": "cd tests && npm run pw",
|
|
53
|
-
"pw:browser": "cd tests && npm run pw"
|
|
60
|
+
"engines": {
|
|
61
|
+
"node": ">=18.0.0"
|
|
54
62
|
},
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
63
|
+
"files": [
|
|
64
|
+
"types/**/*",
|
|
65
|
+
"modules/**/*",
|
|
66
|
+
"template/**/*",
|
|
67
|
+
"index.d.ts",
|
|
68
|
+
"global.d.ts",
|
|
69
|
+
"**/*.js",
|
|
70
|
+
"**/*.cjs",
|
|
71
|
+
"**/*.md",
|
|
72
|
+
"**/*.txt"
|
|
73
|
+
],
|
|
74
|
+
"publishConfig": {
|
|
75
|
+
"access": "public"
|
|
58
76
|
},
|
|
59
|
-
"
|
|
60
|
-
"
|
|
77
|
+
"optionalDependencies": {
|
|
78
|
+
"@modelcontextprotocol/server": "^2.4.0",
|
|
79
|
+
"zod": "^4.6.7"
|
|
80
|
+
},
|
|
81
|
+
"overrides": {
|
|
82
|
+
"glob": "^14.0.2",
|
|
83
|
+
"minimatch": "^11.0.1"
|
|
84
|
+
},
|
|
85
|
+
"typings": "./index.d.ts",
|
|
86
|
+
"scripts": {
|
|
87
|
+
"prepack": "node -e \"['bin/cli.js','bin/cli.cjs','bin/mcp.js','bin/mcp.cjs'].forEach(f=>{try{require('fs').chmodSync(f,0o755)}catch{}})\""
|
|
61
88
|
},
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"react": "^19.3.1",
|
|
65
|
-
"react-dom": "^19.3.1",
|
|
66
|
-
"terser": "5.51.2",
|
|
67
|
-
"tslib": "^2.8.1",
|
|
68
|
-
"tsup": "^9.0.0",
|
|
69
|
-
"tsx": "4.23.15",
|
|
70
|
-
"typescript": "7.0.2"
|
|
89
|
+
"dependencies": {
|
|
90
|
+
"dotmem": ">=0.0.1"
|
|
71
91
|
}
|
|
72
92
|
}
|
package/types/agent.d.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOTMEM AGENT DECLARATIONS
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the agent-facing memory API exported from `dotmem/agent`.
|
|
5
|
+
* Every agent gets an isolated namespace: keys are stored as
|
|
6
|
+
* `agent:<agentId>:<key>` and entries are tagged with the agent id, so two
|
|
7
|
+
* agents never share private memory by accident.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type {
|
|
11
|
+
ContextEntry,
|
|
12
|
+
MemoryEntry,
|
|
13
|
+
MemoryScope,
|
|
14
|
+
MemoryStats,
|
|
15
|
+
MemoryType,
|
|
16
|
+
RecallOptions
|
|
17
|
+
} from './memory'
|
|
18
|
+
|
|
19
|
+
export interface AgentContextOptions {
|
|
20
|
+
tags?: string | string[]
|
|
21
|
+
types?: MemoryType | MemoryType[]
|
|
22
|
+
minConfidence?: number
|
|
23
|
+
maxEntries?: number
|
|
24
|
+
scopes?: MemoryScope[]
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface AgentRememberOptions {
|
|
28
|
+
type?: MemoryType
|
|
29
|
+
confidence?: number
|
|
30
|
+
scope?: MemoryScope
|
|
31
|
+
ttl?: number | null
|
|
32
|
+
tags?: string[]
|
|
33
|
+
source?: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface AgentReplayOptions {
|
|
37
|
+
from: number | string
|
|
38
|
+
to: number | string
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface AgentBranchState {
|
|
42
|
+
state: Record<string, unknown>
|
|
43
|
+
temporal: {
|
|
44
|
+
history: (path?: string) => MemoryEntry[]
|
|
45
|
+
at: (path: string, timestamp: string | number) => unknown
|
|
46
|
+
diff: (path: string, from: string | number, to: string | number) => MemoryEntry[]
|
|
47
|
+
replay: (opts?: { from?: string | number; to?: string | number }) => Record<string, unknown>
|
|
48
|
+
explain: (path: string) => unknown
|
|
49
|
+
branch: () => AgentBranchState
|
|
50
|
+
discard: () => void
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface AgentMemory {
|
|
55
|
+
/** Identifier of the agent owning this isolated namespace. */
|
|
56
|
+
readonly agentId: string
|
|
57
|
+
/** Store a memory entry, namespaced and tagged for this agent. */
|
|
58
|
+
remember: (key: string, value: unknown, options?: AgentRememberOptions) => Promise<void>
|
|
59
|
+
/** Read a memory entry by key. Expired, obsolete, and superseded entries are null. */
|
|
60
|
+
recall: (key: string, options?: RecallOptions) => Promise<MemoryEntry | null>
|
|
61
|
+
/** Ranked memories for this agent only. Additional tags use AND semantics. */
|
|
62
|
+
context: (options?: AgentContextOptions) => Promise<ContextEntry[]>
|
|
63
|
+
/** Mutation history, optionally for one path. */
|
|
64
|
+
history: (path?: string) => Promise<MemoryEntry[]>
|
|
65
|
+
/** Replay the state evolution over a temporal range. */
|
|
66
|
+
replay: (opts: AgentReplayOptions) => Promise<Record<string, unknown>>
|
|
67
|
+
/** Open an isolated temporal branch for experimentation. */
|
|
68
|
+
branch: () => Promise<AgentBranchState>
|
|
69
|
+
/** Memory usage statistics. */
|
|
70
|
+
stats: () => Promise<MemoryStats>
|
|
71
|
+
/** Update an existing memory entry. */
|
|
72
|
+
update: (key: string, value: unknown, options?: AgentRememberOptions) => Promise<void>
|
|
73
|
+
/** Delete a memory entry. */
|
|
74
|
+
forget: (key: string) => Promise<void>
|
|
75
|
+
/** Enable temporal and history tracking. */
|
|
76
|
+
enable: (bool?: boolean) => Promise<void>
|
|
77
|
+
/** Disable temporal tracking. */
|
|
78
|
+
disable: () => Promise<void>
|
|
79
|
+
/** Clear the temporal log and every memory of this agent. */
|
|
80
|
+
clear: () => Promise<void>
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Create an agent-specific memory instance with an isolated namespace. */
|
|
84
|
+
export declare function createAgentMemory(agentId: string): AgentMemory
|
|
85
|
+
|
|
86
|
+
/** Create an agent memory instance with the default agent id. */
|
|
87
|
+
export declare function createDefaultAgentMemory(): AgentMemory
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare module 'bun:sqlite' {
|
|
2
|
+
export class Database {
|
|
3
|
+
constructor(path: string)
|
|
4
|
+
run(sql: string, ...params: any[]): any
|
|
5
|
+
query(sql: string): { all(...params: any[]): any[]; get(...params: any[]): any }
|
|
6
|
+
close(): void
|
|
7
|
+
prepare(sql: string): { all(...params: any[]): any[]; get(...params: any[]): any }
|
|
8
|
+
}
|
|
9
|
+
export class Statement {
|
|
10
|
+
all(...params: any[]): any[]
|
|
11
|
+
get(...params: any[]): any
|
|
12
|
+
run(...params: any[]): any
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
export * from './memory'
|
|
2
|
+
export * from './agent'
|
|
3
|
+
export * from './logic'
|
|
4
|
+
export * from './policy'
|
|
5
|
+
export * from './profile'
|
|
6
|
+
export * from './llm-cache'
|
|
7
|
+
|
|
8
|
+
// ── Memory facade type ───────────────────────────────────────────────────
|
|
9
|
+
export interface MemoryFacade {
|
|
10
|
+
init(): Promise<void>
|
|
11
|
+
discover(situation: string | import('./memory').Situation, options?: import('./memory').DiscoveryOptions): Promise<import('./memory').DiscoveryResult>
|
|
12
|
+
context(options?: ContextQueryOptions): Promise<import('./memory').AcquiredContext>
|
|
13
|
+
project(discovery: import('./memory').DiscoveryResult, options?: import('./memory').ProjectionOptions): import('./memory').ContextProjection
|
|
14
|
+
acquire(opts: import('./memory').AcquireOptions): Promise<void>
|
|
15
|
+
acquireStaged(opts: import('./memory').AcquireOptions): Promise<void>
|
|
16
|
+
remember<T>(key: string, value: T, opts?: import('./memory').RememberOptions<T>): Promise<void>
|
|
17
|
+
recall<T = any>(query: string | number, opts?: import('./memory').RecallOptions): Promise<T | null>
|
|
18
|
+
update(key: string, value: any, opts?: Partial<import('./memory').RememberOptions>): Promise<void>
|
|
19
|
+
forget(key: string): Promise<void>
|
|
20
|
+
patch(key: string, patches: import('./memory').PatchOperation[]): Promise<void>
|
|
21
|
+
stats(): Promise<import('./memory').MemoryStats>
|
|
22
|
+
forgetExpired(): Promise<number>
|
|
23
|
+
clear(): Promise<void>
|
|
24
|
+
fingerprint(): Promise<string>
|
|
25
|
+
journal: MemoryJournal
|
|
26
|
+
profile: MemoryProfile
|
|
27
|
+
note: MemoryNotes
|
|
28
|
+
seed: MemorySeed
|
|
29
|
+
policy: MemoryPolicyAPI
|
|
30
|
+
brain: MemoryBrainAPI
|
|
31
|
+
configure(config: import('./memory').SyncConfig): void
|
|
32
|
+
configureSync(config: import('./memory').SyncConfig): void
|
|
33
|
+
resetBrainPathCache(): void
|
|
34
|
+
resetPolicyStoreCache(): void
|
|
35
|
+
_getEntry(key: string): Promise<import('./memory').MemoryEntry | null>
|
|
36
|
+
_loadAll(): Promise<import('./memory').MemoryEntry[]>
|
|
37
|
+
_save(entry: import('./memory').MemoryEntry): Promise<void>
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface LlmCacheAPI {
|
|
41
|
+
llm<T>(opts: import('./llm-cache').LlmCacheOptions<T>): Promise<import('./llm-cache').LlmCacheResult<T>>
|
|
42
|
+
llmStats(): import('./llm-cache').LlmCacheStats
|
|
43
|
+
llmPurge(selector: import('./llm-cache').LlmCachePurgeSelector): number
|
|
44
|
+
[key: string]: any
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
type Situation = string
|
|
48
|
+
|
|
49
|
+
export interface ContextQueryOptions {
|
|
50
|
+
tags?: string | string[]
|
|
51
|
+
types?: import('./memory').MemoryType | import('./memory').MemoryType[]
|
|
52
|
+
minConfidence?: number
|
|
53
|
+
maxEntries?: number
|
|
54
|
+
scopes?: import('./memory').MemoryScope[]
|
|
55
|
+
project?: boolean
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface MemoryJournal {
|
|
59
|
+
read: (opts?: { limit?: number }) => Promise<JournalEntry[]>
|
|
60
|
+
write: (entry: JournalEntry | JournalEntry[]) => Promise<void>
|
|
61
|
+
clear: () => Promise<void>
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface JournalEntry {
|
|
65
|
+
id: string
|
|
66
|
+
key: string
|
|
67
|
+
type: import('./memory').MemoryType
|
|
68
|
+
operation: string
|
|
69
|
+
hlc?: string
|
|
70
|
+
createdAt: number
|
|
71
|
+
payload?: unknown
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface MemoryProfile {
|
|
75
|
+
get(): import('./profile').DotMemProfile
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface MemoryNotes {
|
|
79
|
+
add(text: string, opts?: { id?: string; tags?: string[] }): Promise<void>
|
|
80
|
+
get(id: string): Promise<NoteContent | null>
|
|
81
|
+
list(): Promise<NoteEntry[]>
|
|
82
|
+
forget(id: string): Promise<void>
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface NoteContent {
|
|
86
|
+
id: string
|
|
87
|
+
title: string
|
|
88
|
+
content: string
|
|
89
|
+
tags: string[]
|
|
90
|
+
createdAt: number
|
|
91
|
+
sha256: string
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface NoteEntry {
|
|
95
|
+
id: string
|
|
96
|
+
title: string
|
|
97
|
+
size: number
|
|
98
|
+
sha256: string
|
|
99
|
+
origin: string
|
|
100
|
+
tag?: string
|
|
101
|
+
acquiredAt?: string
|
|
102
|
+
scope?: string
|
|
103
|
+
type?: import('./memory').MemoryType
|
|
104
|
+
version?: number
|
|
105
|
+
updatedAt?: number
|
|
106
|
+
previousId?: string | null
|
|
107
|
+
patches?: import('./memory').PatchOperation[]
|
|
108
|
+
hlc?: string
|
|
109
|
+
key?: string
|
|
110
|
+
value?: unknown
|
|
111
|
+
status?: string
|
|
112
|
+
createdAt?: number
|
|
113
|
+
lastConfirmedAt?: number
|
|
114
|
+
supersededId?: string | null
|
|
115
|
+
confidence?: number
|
|
116
|
+
source?: string
|
|
117
|
+
ttl?: number | null
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface MemorySeed {
|
|
121
|
+
id: string
|
|
122
|
+
title: string
|
|
123
|
+
content: string
|
|
124
|
+
origin: string
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// ── dotmem public runtime exports ────────────────────────────────────────
|
|
128
|
+
declare const memory: MemoryFacade
|
|
129
|
+
declare const logic: any
|
|
130
|
+
declare const continuity: any
|
|
131
|
+
declare const security: any
|
|
132
|
+
|
|
133
|
+
// ── User identity surface ────────────────────────────────────────────────
|
|
134
|
+
export interface UserIdentity {
|
|
135
|
+
id: string
|
|
136
|
+
name?: string
|
|
137
|
+
email?: string
|
|
138
|
+
}
|
|
139
|
+
declare function resolveUserIdentity(): UserIdentity | null
|
|
140
|
+
declare function setUserIdentity(id: string, identity: UserIdentity): void
|
|
141
|
+
declare function clearUserIdentity(): void
|
|
142
|
+
|
|
143
|
+
// ── User paths surface ───────────────────────────────────────────────────
|
|
144
|
+
declare function resolveUserDotMemPath(): string
|
|
145
|
+
declare function resolveUserProjectMemoryPath(projectId?: string): string
|
|
146
|
+
declare function resolveUserAnchor(): string
|
|
147
|
+
declare function resolveUserBrainPath(): string
|
|
148
|
+
declare function resolveUserContractPath(): string
|
|
149
|
+
declare function resolveUserAgentMemoryPath(): string
|
|
150
|
+
declare function resolveUserReadmePath(): string
|
|
151
|
+
declare function resolveUserExperiencePath(): string
|
|
152
|
+
|
|
153
|
+
// ── Storage location surface ─────────────────────────────────────────────
|
|
154
|
+
export interface DotMemStorageLocationError extends Error {
|
|
155
|
+
readonly storageRoot: string
|
|
156
|
+
readonly source: string
|
|
157
|
+
}
|
|
158
|
+
declare const DOTMEM_STORAGE_ROOT_ENV_VAR: string
|
|
159
|
+
declare const DOTMEM_USER_ANCHOR_DIR_NAME: string
|
|
160
|
+
declare const DOTMEM_STORAGE_LOCATOR_FILE_NAME: string
|
|
161
|
+
declare const DOTMEM_STORAGE_LOCATOR_VERSION: number
|
|
162
|
+
declare function resolveDotMemStorageRoot(): string
|
|
163
|
+
declare function describeDotMemStorage(): unknown
|
|
164
|
+
declare function readDotMemStorageLocator(): unknown
|
|
165
|
+
declare function relocateDotMemStorage(target: string): unknown
|
|
166
|
+
declare function restoreDefaultDotMemStorage(): unknown
|
|
167
|
+
|
|
168
|
+
// ── Project identity surface ─────────────────────────────────────────────
|
|
169
|
+
declare function resolveProjectIdentity(id?: string): Promise<string>
|
|
170
|
+
|
|
171
|
+
// ── Mem package inspection ──────────────────────────────────────────────
|
|
172
|
+
declare function inspectMem(mem: unknown, opts?: Record<string, unknown>): unknown
|
|
173
|
+
declare function signMemPackage(mem: unknown, key: unknown): unknown
|
|
174
|
+
export interface MemInspection {
|
|
175
|
+
status: 'inspected'
|
|
176
|
+
version: number
|
|
177
|
+
entries: unknown[]
|
|
178
|
+
}
|
|
179
|
+
export interface MemInspectionStatus {
|
|
180
|
+
valid: boolean
|
|
181
|
+
errors?: string[]
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// ── Profile ──────────────────────────────────────────────────────────────
|
|
185
|
+
export interface DotMemProfileDocument {
|
|
186
|
+
readonly name: string
|
|
187
|
+
readonly content: string
|
|
188
|
+
}
|
|
189
|
+
export interface DotMemProfile {
|
|
190
|
+
readonly format: 'dotmem.profile'
|
|
191
|
+
readonly version: 1
|
|
192
|
+
readonly id: 'joy'
|
|
193
|
+
readonly name: 'Joy'
|
|
194
|
+
readonly alternative: ['Jo']
|
|
195
|
+
readonly documents: ReadonlyArray<DotMemProfileDocument>
|
|
196
|
+
readonly type: 'ai-persona'
|
|
197
|
+
readonly role: string
|
|
198
|
+
readonly immutable: true
|
|
199
|
+
readonly description: string
|
|
200
|
+
}
|
|
201
|
+
declare const JO_PROFILE: Readonly<DotMemProfile>
|
|
202
|
+
|
|
203
|
+
// ── Mutation engine extras ──────────────────────────────────────────────
|
|
204
|
+
declare function currentTimestamp(): string
|
|
205
|
+
declare function activeTransactionId(): string | null
|
|
206
|
+
|
|
207
|
+
// ── Foundation re-exports (runtime values) from memorio ──────────────────
|
|
208
|
+
declare const state: any
|
|
209
|
+
declare const store: any
|
|
210
|
+
declare const session: any
|
|
211
|
+
declare const cache: LlmCacheAPI
|
|
212
|
+
declare const idb: any
|
|
213
|
+
declare const sqlite: any
|
|
214
|
+
declare const observer: any
|
|
215
|
+
declare const schema: any
|
|
216
|
+
declare function registerSchema(path: string, schema: any): void
|
|
217
|
+
declare function validate(path: string, value: any): { valid: boolean; errors?: string[] }
|
|
218
|
+
declare function unregisterSchema(path: string): boolean
|
|
219
|
+
declare function listSchemas(): string[]
|
|
220
|
+
declare const typed: <T extends Record<string, any>>() => T
|
|
221
|
+
declare const computed: any
|
|
222
|
+
declare const broadcast: any
|
|
223
|
+
declare const message: (...args: unknown[]) => void
|
|
224
|
+
declare const logger: any
|
|
225
|
+
declare const snapshot: () => Record<string, any>
|
|
226
|
+
declare function diff(snap: Record<string, any>): Array<{ path: string; oldValue: any; newValue: any }>
|
|
227
|
+
declare function undo(): any
|
|
228
|
+
declare function redo(): any
|
|
229
|
+
declare function canUndo(): boolean
|
|
230
|
+
declare function canRedo(): boolean
|
|
231
|
+
declare function rollback(snap: Record<string, any>): void
|
|
232
|
+
declare function trace(): any[]
|
|
233
|
+
declare function enableHistory(enabled?: boolean): void
|
|
234
|
+
declare function clearHistory(): void
|
|
235
|
+
declare function clearRedo(): void
|
|
236
|
+
declare function createMutation(path: string, operation: any, before: any, after: any, opts?: { context?: string; source?: string; transactionId?: string }): unknown
|
|
237
|
+
declare function recordMutation(mutation: unknown): void
|
|
238
|
+
declare function toPatch(mutation: unknown): unknown | null
|
|
239
|
+
declare function mutate(path: string, value: any, opts?: { source?: string; transactionId?: string }): unknown
|
|
240
|
+
declare function beginTransaction(source?: string, message?: string, metadata?: Record<string, any>): unknown
|
|
241
|
+
declare function commitTransaction(): unknown
|
|
242
|
+
declare function abortTransaction(): unknown
|
|
243
|
+
declare function currentTransaction(): unknown
|
|
244
|
+
declare function listTransactions(): unknown[]
|
|
245
|
+
declare const transaction: (source?: string, message?: string, metadata?: Record<string, any>) => unknown
|
|
246
|
+
declare function generateMutationId(): string
|
|
247
|
+
declare function generateTransactionId(): string
|
|
248
|
+
declare function generateCommitId(): string
|
|
249
|
+
declare function mutationToPatch(mutation: unknown): unknown | null
|
|
250
|
+
declare function diffToPatch(path: string, before: any, after: any): unknown | null
|
|
251
|
+
declare function canMerge(p1: unknown, p2: unknown): boolean
|
|
252
|
+
declare function mergePatches(p1: unknown, p2: unknown): unknown
|
|
253
|
+
declare function dispatch(event: string, payload?: unknown): Promise<void>
|
|
254
|
+
declare function isDotMemCodename(value: string): boolean
|
|
255
|
+
declare function codenameKeyFor(value: string): string | undefined
|
|
256
|
+
declare function renderCodenames(): string
|
|
257
|
+
declare const CODENAMES: Record<string, string>
|
|
258
|
+
declare const CODENAME_DETAILS: Record<string, unknown>
|
|
259
|
+
declare function propertyName(container: any, object: any): string | null
|
|
260
|
+
declare const internal: any
|
|
261
|
+
declare function setContext(id: string): void
|
|
262
|
+
declare function getContext(): string | null
|
|
263
|
+
declare const hlc: any
|
|
264
|
+
declare const fractional: any
|
|
265
|
+
declare const encryption: any
|
|
266
|
+
declare const securityEncryption: any
|
|
267
|
+
declare const devtools: any
|
|
268
|
+
declare function help(): void
|
|
269
|
+
declare const temporal: any
|
|
270
|
+
declare const events: Record<string, any>
|
|
271
|
+
declare const dotmem: any
|
|
272
|
+
declare const DEV: boolean
|
|
273
|
+
declare const PROD: boolean
|
|
274
|
+
declare function isBrowser(): boolean
|
|
275
|
+
declare function isNode(): boolean
|
|
276
|
+
declare function isDeno(): boolean
|
|
277
|
+
declare function isBun(): boolean
|
|
278
|
+
declare function isEdge(): boolean
|
|
279
|
+
declare function getCapabilities(): unknown
|
|
280
|
+
declare function createContext(name?: string, opts?: { encryptionKey?: any }): unknown
|
|
281
|
+
declare function listContexts(): unknown[]
|
|
282
|
+
declare function deleteContext(id: string): void
|
|
283
|
+
declare function isolate(name?: string, opts?: { encryptionKey?: any }): void
|
|
284
|
+
|
|
285
|
+
export default dotmem
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// DOTMEM INSPECT TYPES
|
|
2
|
+
/// Ambient declarations for the state introspection API.
|
|
3
|
+
|
|
4
|
+
///
|
|
5
|
+
// Schema report entry describing a single state path.
|
|
6
|
+
///
|
|
7
|
+
interface _stateSchemaEntry {
|
|
8
|
+
/** Dotted path relative to `state`. */
|
|
9
|
+
path: string
|
|
10
|
+
/** Runtime type: 'string', 'number', 'boolean', 'object', 'array', 'undefined'. */
|
|
11
|
+
type: string
|
|
12
|
+
/** Whether the path resolves to a defined value. */
|
|
13
|
+
defined: boolean
|
|
14
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
///
|
|
2
|
+
// LLM RESPONSE CACHE TYPES
|
|
3
|
+
// Opt-in token-avoidance cache for LLM responses.
|
|
4
|
+
///
|
|
5
|
+
|
|
6
|
+
export type LlmCacheScope = 'session' | 'persist'
|
|
7
|
+
|
|
8
|
+
export type LlmCacheMatchedBy = 'exact' | 'normalized' | 'embedding'
|
|
9
|
+
|
|
10
|
+
export interface LlmCacheOptions<T = any> {
|
|
11
|
+
key: {
|
|
12
|
+
prompt: string
|
|
13
|
+
model: string
|
|
14
|
+
params?: Record<string, unknown>
|
|
15
|
+
context?: string
|
|
16
|
+
}
|
|
17
|
+
compute: () => Promise<T>
|
|
18
|
+
ttl?: string | number
|
|
19
|
+
scope?: LlmCacheScope
|
|
20
|
+
cacheable?: boolean | ((value: T) => boolean)
|
|
21
|
+
deterministicOnly?: boolean
|
|
22
|
+
similarity?: {
|
|
23
|
+
mode: 'off' | 'normalized' | 'embedding'
|
|
24
|
+
threshold?: number
|
|
25
|
+
embed?: (text: string) => Promise<number[]>
|
|
26
|
+
}
|
|
27
|
+
estimateTokens?: (value: T) => number
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface LlmCacheResult<T = any> {
|
|
31
|
+
value: T
|
|
32
|
+
hit: boolean
|
|
33
|
+
matchedBy?: LlmCacheMatchedBy
|
|
34
|
+
score?: number
|
|
35
|
+
key: string
|
|
36
|
+
createdAt: number
|
|
37
|
+
savedTokens?: number
|
|
38
|
+
provenance: 'CACHED' | 'FRESH'
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface LlmCacheStats {
|
|
42
|
+
hits: number
|
|
43
|
+
misses: number
|
|
44
|
+
savedTokens: number
|
|
45
|
+
entries: number
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface LlmCachePurgeSelector {
|
|
49
|
+
key?: string
|
|
50
|
+
model?: string
|
|
51
|
+
olderThan?: string
|
|
52
|
+
all?: true
|
|
53
|
+
}
|