@agfpd/iapeer-memory-core 0.1.5 → 0.1.7
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 +1 -1
- package/src/config.ts +15 -2
- package/src/frontmatter-fill.ts +1 -1
- package/src/index.ts +6 -1
- package/src/indexer.ts +7 -7
- package/src/mcp-tools.ts +2 -2
- package/src/search.ts +1 -1
- package/src/taxonomy.ts +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agfpd/iapeer-memory-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "iapeer-memory core — host-neutral TypeScript memory primitive: vault schema/taxonomy config, search engine, memoryd, context renderer, role contracts. Consumed by the @agfpd/iapeer-memory facade; version kept in lockstep by its release flow (docs/10-distribution.md).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/src/config.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* iapeer-memory core runtime config.
|
|
3
3
|
*
|
|
4
|
-
* Re-built from the
|
|
4
|
+
* Re-built from the reference implementation's `config.ts` for the iapeer-memory
|
|
5
5
|
* namespace: `IAPEER_MEMORY_*` env vars, taxonomy-driven defaults (ADR-002 —
|
|
6
6
|
* the locale preset supplies folder names instead of hard-coded constants)
|
|
7
7
|
* and the `~/.iapeer/{cache,…}/iapeer-memory/` path namespace.
|
|
@@ -89,7 +89,7 @@ export type CoreConfig = {
|
|
|
89
89
|
* to BM25. Adding the exact endpoint host to NO_PROXY is idempotent and
|
|
90
90
|
* monotonic — it only bypasses the explicitly configured host.
|
|
91
91
|
*/
|
|
92
|
-
function ensureEndpointNotProxied(endpoint: string): void {
|
|
92
|
+
export function ensureEndpointNotProxied(endpoint: string): void {
|
|
93
93
|
let host: string;
|
|
94
94
|
try {
|
|
95
95
|
host = new URL(endpoint).hostname;
|
|
@@ -106,6 +106,19 @@ function ensureEndpointNotProxied(endpoint: string): void {
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Loopback NEVER goes through a proxy — fleet-class defect (B-приёмка
|
|
111
|
+
* 10.06, boris): every peer's shell carries HTTP(S)_PROXY (VPN tinyproxy),
|
|
112
|
+
* Bun's fetch honours it for 127.0.0.1 too → the status probe of the LIVE
|
|
113
|
+
* memoryd port detoured to the proxy and lied «nothing listening» (proven:
|
|
114
|
+
* lsof caught tinyproxy SYN_SENT to 8766; `env -u HTTP_PROXY` → truthful).
|
|
115
|
+
* Call before ANY loopback fetch from CLI paths that run in agent shells.
|
|
116
|
+
*/
|
|
117
|
+
export function ensureLoopbackNotProxied(): void {
|
|
118
|
+
ensureEndpointNotProxied("http://127.0.0.1/");
|
|
119
|
+
ensureEndpointNotProxied("http://localhost/");
|
|
120
|
+
}
|
|
121
|
+
|
|
109
122
|
function envString(name: string, fallback = ""): string {
|
|
110
123
|
const value = process.env[name];
|
|
111
124
|
return typeof value === "string" && value.length > 0 ? value : fallback;
|
package/src/frontmatter-fill.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* - **curator-set instead of hard-coded `index`** (ADR-006): `needs_review`
|
|
10
10
|
* is NOT stamped when the writing agent belongs to the configured curator
|
|
11
|
-
* set (`index`, `
|
|
11
|
+
* set (`index`, `scriber`, `dreamweaver` by default) — curators'
|
|
12
12
|
* edits are sanctioned curation, not author edits awaiting review.
|
|
13
13
|
* - **taxonomy-driven zone routing** (ADR-002/011): folder names, the
|
|
14
14
|
* agent-memory type token and emitted status tokens come from the locale
|
package/src/index.ts
CHANGED
|
@@ -8,7 +8,12 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
// config
|
|
11
|
-
export {
|
|
11
|
+
export {
|
|
12
|
+
configFromEnv,
|
|
13
|
+
ensureEndpointNotProxied,
|
|
14
|
+
ensureLoopbackNotProxied,
|
|
15
|
+
type CoreConfig,
|
|
16
|
+
} from "./config.js";
|
|
12
17
|
|
|
13
18
|
// taxonomy (ADR-002/011)
|
|
14
19
|
export {
|
package/src/indexer.ts
CHANGED
|
@@ -31,7 +31,7 @@ export async function indexAll(params: {
|
|
|
31
31
|
|
|
32
32
|
const deleted = deleteMissingDocuments(db, seenPaths);
|
|
33
33
|
if (deleted > 0) {
|
|
34
|
-
logger.info(`
|
|
34
|
+
logger.info(`iapeer-memory: removed ${deleted} stale documents from index`);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
// Resolve wikilinks: map note titles to actual file paths
|
|
@@ -193,7 +193,7 @@ async function embedMissingChunks(params: {
|
|
|
193
193
|
|
|
194
194
|
if (!result.vectors) {
|
|
195
195
|
logger.warn(
|
|
196
|
-
`
|
|
196
|
+
`iapeer-memory: embedding endpoint unavailable (${result.status}), skipping embedding`,
|
|
197
197
|
);
|
|
198
198
|
break;
|
|
199
199
|
}
|
|
@@ -208,7 +208,7 @@ async function embedMissingChunks(params: {
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
if (total > 0) {
|
|
211
|
-
logger.info(`
|
|
211
|
+
logger.info(`iapeer-memory: embedded ${total} chunks`);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
|
|
@@ -227,11 +227,11 @@ async function scanRoot(params: ScanRootParams): Promise<void> {
|
|
|
227
227
|
try {
|
|
228
228
|
const stat = await fs.stat(basePath);
|
|
229
229
|
if (!stat.isDirectory()) {
|
|
230
|
-
logger.warn(`
|
|
230
|
+
logger.warn(`iapeer-memory: skip non-directory path ${basePath}`);
|
|
231
231
|
return;
|
|
232
232
|
}
|
|
233
233
|
} catch {
|
|
234
|
-
logger.warn(`
|
|
234
|
+
logger.warn(`iapeer-memory: path does not exist, skipping ${basePath}`);
|
|
235
235
|
return;
|
|
236
236
|
}
|
|
237
237
|
|
|
@@ -264,7 +264,7 @@ async function walkDirectory(params: ScanRootParams, currentPath: string): Promi
|
|
|
264
264
|
await indexFile(params, fullPath);
|
|
265
265
|
} catch (err) {
|
|
266
266
|
params.logger.warn(
|
|
267
|
-
`
|
|
267
|
+
`iapeer-memory: skip ${fullPath} — ${err instanceof Error ? err.message : String(err)}`,
|
|
268
268
|
);
|
|
269
269
|
}
|
|
270
270
|
}
|
|
@@ -319,5 +319,5 @@ async function indexFile(params: ScanRootParams, fullPath: string): Promise<void
|
|
|
319
319
|
addTitlePath(titleToPath, titleNfc, docPath);
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
-
logger.info(`
|
|
322
|
+
logger.info(`iapeer-memory: indexed ${docPath}`);
|
|
323
323
|
}
|
package/src/mcp-tools.ts
CHANGED
|
@@ -59,7 +59,7 @@ export const MCP_TOOL_SURFACE = ["vault_search", "vault_graph", "vault_map"] as
|
|
|
59
59
|
/**
|
|
60
60
|
* Validate and resolve a user-supplied vault path before any disk access.
|
|
61
61
|
*
|
|
62
|
-
* vault_read is reachable from any agent that loads the
|
|
62
|
+
* vault_read is reachable from any agent that loads the reference plugin,
|
|
63
63
|
* including ones whose context can be poisoned by inbox drafts (prompt
|
|
64
64
|
* injection). Without containment, an attacker-controlled `path` like
|
|
65
65
|
* `../../.ssh/id_rsa`, `../../.mergemind/env`, or `/etc/passwd` would
|
|
@@ -237,7 +237,7 @@ export async function runRead(
|
|
|
237
237
|
// ---- vault_graph ----
|
|
238
238
|
|
|
239
239
|
// Oneway-фильтр графа: backlinks из `06_Оперативка_агентов/` **не**
|
|
240
|
-
// показываются при запросе графа канонической заметки — граф
|
|
240
|
+
// показываются при запросе графа канонической заметки — граф референса не
|
|
241
241
|
// должен засоряться упоминаниями оперативки разных агентов. От оперативной
|
|
242
242
|
// заметки исходящие связи (на каноники) показываются как есть — автор
|
|
243
243
|
// должен видеть на что ссылается его оперативка. Парсер сохраняет все
|
package/src/search.ts
CHANGED
|
@@ -61,7 +61,7 @@ const SNIPPET_LEAD_CHARS = 40;
|
|
|
61
61
|
// without faking relevance.
|
|
62
62
|
const EMPTY_NOTE_SNIPPET = "(пустой каркас — в заметке нет содержимого)";
|
|
63
63
|
// How many top-degree related notes to surface per result. Was unbounded —
|
|
64
|
-
// hub notes (e.g.
|
|
64
|
+
// hub notes (e.g. a project Plan note) inflated payload to ~10KB on a 6-result
|
|
65
65
|
// search. Agents can call vault_graph for the full neighborhood.
|
|
66
66
|
const RELATED_LIMIT = 3;
|
|
67
67
|
|
package/src/taxonomy.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Every folder name, enum value (type / status / subtype), the links-section
|
|
7
7
|
* heading, project file-name prefixes and system file names live here.
|
|
8
8
|
* i18n = presets of this same configuration: the EN base plus the RU preset
|
|
9
|
-
* (the live
|
|
9
|
+
* (the live reference vault, used for migration parity).
|
|
10
10
|
*
|
|
11
11
|
* The canonical RU↔EN mapping is the table in `docs/01-vault-layout.md`
|
|
12
12
|
* §«Таксономия» — this module encodes that table; tests guard shape parity
|
|
@@ -204,7 +204,7 @@ export const TAXONOMY_EN: TaxonomyPreset = {
|
|
|
204
204
|
};
|
|
205
205
|
|
|
206
206
|
/**
|
|
207
|
-
* RU preset — the live
|
|
207
|
+
* RU preset — the live reference-vault taxonomy (frozen, ADR-002).
|
|
208
208
|
* Values are verbatim from the reference `src/` constants and
|
|
209
209
|
* `docs/01-vault-layout.md`; migration parity runs against this preset.
|
|
210
210
|
*/
|
|
@@ -380,6 +380,6 @@ export const DEFAULT_RANKING: RankingConfig = {
|
|
|
380
380
|
*/
|
|
381
381
|
export const DEFAULT_CURATOR_SET: readonly string[] = [
|
|
382
382
|
"index",
|
|
383
|
-
"
|
|
383
|
+
"scriber",
|
|
384
384
|
"dreamweaver",
|
|
385
385
|
];
|