agenr 2.0.1 → 3.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agenr",
3
- "version": "2.0.1",
3
+ "version": "3.0.0",
4
4
  "description": "Agent memory - local-first knowledge infrastructure for AI agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -15,8 +15,8 @@
15
15
  "dependencies": {
16
16
  "@clack/prompts": "^1.1.0",
17
17
  "@libsql/client": "^0.17.2",
18
- "@mariozechner/pi-agent-core": "^0.63.1",
19
- "@mariozechner/pi-ai": "^0.63.2",
18
+ "@earendil-works/pi-agent-core": "^0.78.0",
19
+ "@earendil-works/pi-ai": "^0.78.0",
20
20
  "@sinclair/typebox": "^0.34.0",
21
21
  "chalk": "^5.6.2",
22
22
  "commander": "^14.0.3",
@@ -26,6 +26,8 @@
26
26
  "devDependencies": {
27
27
  "@eslint/js": "^10.0.1",
28
28
  "@types/node": "^25.5.0",
29
+ "skeln": "file:../skeln",
30
+ "typebox": "^1.1.38",
29
31
  "eslint": "^10.1.0",
30
32
  "eslint-plugin-jsdoc": "^62.8.1",
31
33
  "globals": "^17.4.0",
@@ -42,12 +44,13 @@
42
44
  "scripts": {
43
45
  "build": "pnpm run build:root && pnpm run build:plugin",
44
46
  "build:root": "tsup",
45
- "build:plugin": "pnpm --filter @agenr/agenr-plugin build",
47
+ "build:plugin": "pnpm --filter @agenr/agenr-plugin build && pnpm --filter @agenr/skeln-plugin build",
46
48
  "build:debug": "pnpm run build:root:debug && pnpm run build:plugin:debug",
47
49
  "build:root:debug": "tsup --sourcemap",
48
- "build:plugin:debug": "pnpm --filter @agenr/agenr-plugin build:debug",
50
+ "build:plugin:debug": "pnpm --filter @agenr/agenr-plugin build:debug && pnpm --filter @agenr/skeln-plugin build:debug",
49
51
  "dev": "tsup --watch",
50
- "internal:recall-eval-server": "pnpm run build:root && node dist/internal-recall-eval-server.js",
52
+ "internal:eval-server": "pnpm run build:root && node dist/internal-eval-server.js",
53
+ "internal:recall-eval-server": "pnpm run internal:eval-server",
51
54
  "check": "pnpm format:check && pnpm lint && pnpm typecheck && pnpm test",
52
55
  "typecheck": "tsc --noEmit",
53
56
  "typecheck:tests": "tsc --noEmit -p tsconfig.tests.json",
@@ -1,256 +0,0 @@
1
- /**
2
- * Core domain types for agenr.
3
- * These types have zero infrastructure dependencies.
4
- */
5
- /** Ordered list of supported durable knowledge entry categories. */
6
- declare const ENTRY_TYPES: readonly ["fact", "decision", "preference", "lesson", "relationship", "milestone"];
7
- /**
8
- * Union of all supported knowledge entry categories.
9
- */
10
- type EntryType = (typeof ENTRY_TYPES)[number];
11
- /** Ordered list of supported recall durability levels. */
12
- declare const EXPIRY_LEVELS: readonly ["core", "permanent", "temporary"];
13
- /** Ordered list of supported claim-key lifecycle statuses. */
14
- declare const CLAIM_KEY_STATUSES: readonly ["trusted", "tentative", "unresolved"];
15
- /** Ordered list of supported claim-key provenance sources. */
16
- declare const CLAIM_KEY_SOURCES: readonly ["manual", "model", "json_retry", "deterministic_repair", "surgeon_metadata_rewrite", "surgeon_family_reuse", "surgeon_compaction"];
17
- /** Ordered list of supported claim-support provenance modes. */
18
- declare const CLAIM_SUPPORT_MODES: readonly ["explicit", "normalized", "inferred"];
19
-
20
- /**
21
- * Union of all supported recall durability levels.
22
- */
23
- type Expiry = (typeof EXPIRY_LEVELS)[number];
24
- /**
25
- * Union of all supported claim-key lifecycle statuses.
26
- */
27
- type ClaimKeyStatus = (typeof CLAIM_KEY_STATUSES)[number];
28
- /**
29
- * Union of all supported claim-key provenance sources.
30
- */
31
- type ClaimKeySource = (typeof CLAIM_KEY_SOURCES)[number];
32
- /**
33
- * Union of all supported claim-support provenance modes.
34
- */
35
- type ClaimSupportMode = (typeof CLAIM_SUPPORT_MODES)[number];
36
- /**
37
- * Explicit lifecycle and provenance metadata attached to a stored claim key.
38
- */
39
- interface ClaimKeyLifecycleMetadata {
40
- claim_key_raw?: string;
41
- claim_key_status?: ClaimKeyStatus;
42
- claim_key_source?: ClaimKeySource;
43
- claim_key_confidence?: number;
44
- claim_key_rationale?: string;
45
- claim_support_source_kind?: string;
46
- claim_support_locator?: string;
47
- claim_support_observed_at?: string;
48
- claim_support_mode?: ClaimSupportMode;
49
- }
50
- /**
51
- * Canonical stored knowledge record.
52
- */
53
- interface Entry extends ClaimKeyLifecycleMetadata {
54
- id: string;
55
- type: EntryType;
56
- subject: string;
57
- content: string;
58
- importance: number;
59
- expiry: Expiry;
60
- tags: string[];
61
- source_file?: string;
62
- source_context?: string;
63
- embedding?: number[];
64
- content_hash?: string;
65
- norm_content_hash?: string;
66
- quality_score: number;
67
- recall_count: number;
68
- last_recalled_at?: string;
69
- superseded_by?: string;
70
- valid_from?: string;
71
- valid_to?: string;
72
- claim_key?: string;
73
- supersession_kind?: string;
74
- supersession_reason?: string;
75
- cluster_id?: string;
76
- user_id?: string;
77
- project?: string;
78
- retired: boolean;
79
- retired_at?: string;
80
- retired_reason?: string;
81
- created_at: string;
82
- updated_at: string;
83
- }
84
- /**
85
- * Normalized transcript message emitted by transcript adapters.
86
- */
87
- interface TranscriptMessage {
88
- index: number;
89
- role: "user" | "assistant";
90
- text: string;
91
- timestamp?: string;
92
- }
93
- /**
94
- * Session-level metadata derived while parsing a transcript file.
95
- */
96
- interface SessionTranscriptMetadata {
97
- sessionId?: string;
98
- startedAt?: string;
99
- endedAt?: string;
100
- messageCount: number;
101
- transcriptHash: string;
102
- }
103
- /**
104
- * Parsed transcript metadata exposed to transcript consumers.
105
- */
106
- interface ParsedTranscriptMetadata extends SessionTranscriptMetadata {
107
- sessionLabel?: string;
108
- modelsUsed?: string[];
109
- /** Best-effort surface reconstructed from transcript content. */
110
- reconstructedSurface?: string | null;
111
- /** Provenance for the reconstructed surface value. */
112
- surfaceReconstructionSource?: "reconstructed" | "none";
113
- /** Stable source identity derived by the transcript adapter when available. */
114
- sourceIdentity?: string;
115
- /** Adapter-specific kind describing the stable source identity. */
116
- sourceIdentityKind?: string;
117
- /** Best-effort working-directory or workspace path for the session. */
118
- workingDirectory?: string;
119
- /** Explicit user identifier carried by the transcript source when available. */
120
- userId?: string;
121
- /** Explicit project identifier carried by the transcript source when available. */
122
- project?: string;
123
- }
124
- /**
125
- * Parsed transcript with normalized messages and source metadata.
126
- */
127
- interface ParsedTranscript {
128
- messages: TranscriptMessage[];
129
- metadata: ParsedTranscriptMetadata;
130
- warnings: string[];
131
- }
132
-
133
- /**
134
- * Internal ranking profiles that adjust recall scoring for specific query intents.
135
- */
136
- type RecallRankingProfile = "historical_state";
137
- /**
138
- * Input payload for historical-state predecessor expansion.
139
- *
140
- * The params object can grow over time with additional lineage signals such as
141
- * claim keys without changing the recall port signature.
142
- */
143
- interface HistoricalPredecessorLookupParams {
144
- activeEntryIds: string[];
145
- }
146
- /**
147
- * Input to the v1 recall pipeline.
148
- */
149
- interface RecallInput {
150
- text: string;
151
- limit?: number;
152
- threshold?: number;
153
- budget?: number;
154
- types?: EntryType[];
155
- tags?: string[];
156
- since?: string;
157
- until?: string;
158
- around?: string;
159
- aroundRadius?: number;
160
- asOf?: string;
161
- sessionKey?: string;
162
- rankingProfile?: RecallRankingProfile;
163
- }
164
- /**
165
- * A single scored recall result with signal breakdown metadata.
166
- */
167
- interface RecallOutput {
168
- entry: Entry;
169
- score: number;
170
- scores: {
171
- relevance: number;
172
- vector: number;
173
- lexical: number;
174
- recency: number;
175
- importance: number;
176
- historicalLineage: number;
177
- claimKeyTrustPenalty: number;
178
- claimKeyRedundancyPenalty: number;
179
- };
180
- }
181
- /**
182
- * Minimal entry fields needed during recall scoring before final hydration.
183
- */
184
- type RecallCandidateEntry = Pick<Entry, "id" | "subject" | "content" | "importance" | "expiry" | "created_at" | "embedding" | "superseded_by" | "claim_key" | "claim_key_status" | "claim_support_observed_at" | "valid_from" | "valid_to" | "retired">;
185
- /**
186
- * A candidate returned from vector search with ranking-time entry data.
187
- */
188
- interface VectorCandidate {
189
- entry: RecallCandidateEntry;
190
- vectorSim: number;
191
- }
192
- /**
193
- * A candidate returned from lexical FTS search with ranking-time entry data.
194
- *
195
- * BM25 rank is used for admission only and is not part of the final score.
196
- */
197
- interface FtsCandidate {
198
- entry: RecallCandidateEntry;
199
- rank: number;
200
- tier: "exact" | "all_tokens" | "any_tokens";
201
- }
202
- /**
203
- * Filters that the core recall pipeline can push down into adapter queries.
204
- */
205
- interface EntryFilters {
206
- types?: EntryType[];
207
- tags?: string[];
208
- since?: Date;
209
- until?: Date;
210
- }
211
-
212
- /**
213
- * Query-time retrieval contract used by the v1 recall pipeline.
214
- */
215
- interface RecallPorts {
216
- /** Compute a single embedding for a recall query string. */
217
- embed(text: string): Promise<number[]>;
218
- /** Search vector candidates with adapter-level filtering applied. */
219
- vectorSearch(params: {
220
- embedding: number[];
221
- limit: number;
222
- filters?: EntryFilters;
223
- }): Promise<VectorCandidate[]>;
224
- /** Search FTS candidates with adapter-level filtering applied. */
225
- ftsSearch(params: {
226
- text: string;
227
- limit: number;
228
- filters?: EntryFilters;
229
- }): Promise<FtsCandidate[]>;
230
- /**
231
- * Fetch inactive lineage-linked candidates for historical-state expansion.
232
- *
233
- * The adapter should keep this scoped to the provided active entry IDs and
234
- * only return historical candidates that are plausibly about the same slot.
235
- */
236
- fetchPredecessors?(params: HistoricalPredecessorLookupParams): Promise<RecallCandidateEntry[]>;
237
- /** Hydrate fully populated entries for the final ranked result set. */
238
- hydrateEntries(ids: string[]): Promise<Entry[]>;
239
- /** Persist recall events for the returned entry set. */
240
- recordRecallEvents(params: {
241
- entryIds: string[];
242
- query: string;
243
- sessionKey?: string;
244
- }): Promise<void>;
245
- }
246
- /**
247
- * Transcript source contract for parsing external session files into core types.
248
- */
249
- interface TranscriptPort {
250
- /** Parse a raw session file into a structured transcript. */
251
- parseFile(filePath: string, options?: {
252
- verbose?: boolean;
253
- }): Promise<ParsedTranscript>;
254
- }
255
-
256
- export type { Expiry as E, FtsCandidate as F, HistoricalPredecessorLookupParams as H, ParsedTranscript as P, RecallInput as R, TranscriptPort as T, VectorCandidate as V, EntryType as a, RecallPorts as b, RecallOutput as c, EntryFilters as d, RecallCandidateEntry as e, RecallRankingProfile as f };