@pyxmate/memory 0.26.4 → 0.28.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/README.md +11 -9
- package/dist/{chunk-5X2HOMDQ.mjs → chunk-C5HKNVI5.mjs} +25 -0
- package/dist/{chunk-4BJCSQOO.mjs → chunk-XPZ4DUON.mjs} +1 -1
- package/dist/cli/pyx-mem.mjs +96 -12
- package/dist/dashboard.mjs +2 -2
- package/dist/index.d.ts +82 -6
- package/dist/index.mjs +1 -1
- package/dist/react.mjs +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,12 +36,12 @@ Restart Claude Code. The 7 memory tools (`search_memories`, `store_memory`,
|
|
|
36
36
|
`get_memory`, `list_memories`, `delete_memory`, `ingest_memory_file`,
|
|
37
37
|
`summarize_memory_entity`) are auto-discovered via MCP Tool Search.
|
|
38
38
|
|
|
39
|
-
**That's the whole setup** — no extra LLM API keys.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
**That's the whole setup** — no extra server-side LLM API keys. Graph is a
|
|
40
|
+
relational retrieval dimension, not a search-score boost. When content names
|
|
41
|
+
people, organizations, tools, places, events, or key concepts, the caller LLM
|
|
42
|
+
must pass both `entities` and `relationships`; edges matter as much as nodes because traversal
|
|
43
|
+
needs them to connect related memories. The server does not auto-extract graph
|
|
44
|
+
data and there is no regex fallback. See
|
|
45
45
|
[`graph-auto-entity-extraction-v2`](https://github.com/pyx-corp/pyx-memory-v1/blob/main/docs/specs/graph-auto-entity-extraction-v2/spec.md)
|
|
46
46
|
for the full contract.
|
|
47
47
|
|
|
@@ -68,7 +68,7 @@ await memory.store({
|
|
|
68
68
|
const results = await memory.search({ query: 'deadline', limit: 5 });
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
### Optional:
|
|
71
|
+
### Optional: caller-side extraction helper
|
|
72
72
|
|
|
73
73
|
`MemoryClient.store(entry, options)` accepts an `enrichment.extractEntities`
|
|
74
74
|
callback. The SDK invokes your callback (running against **your own** LLM
|
|
@@ -94,9 +94,11 @@ await memory.store(
|
|
|
94
94
|
);
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
+
Entity-free memories are valid. Store responses include `graphEntitiesWritten`
|
|
98
|
+
and `graphRelationshipsWritten`, with zero making an omitted graph write visible.
|
|
97
99
|
Per-call `entry.extractEntities: false` skips the callback entirely;
|
|
98
|
-
`entry.extractEntities: true` with no callback throws a loud error
|
|
99
|
-
|
|
100
|
+
`entry.extractEntities: true` with no callback throws a loud error. The server
|
|
101
|
+
never sees an LLM API key or runs regex extraction — it persists what you send.
|
|
100
102
|
|
|
101
103
|
## Entry Points
|
|
102
104
|
|
|
@@ -663,6 +663,31 @@ var MemoryClient = class {
|
|
|
663
663
|
throw error;
|
|
664
664
|
}
|
|
665
665
|
}
|
|
666
|
+
/**
|
|
667
|
+
* v0.28 correction-memory — record an explicit correction. POSTs to
|
|
668
|
+
* `/api/memory/corrections`; tenant is header-derived (server-side), so
|
|
669
|
+
* the body carries only the correction fields. Returns `{ id, createdAt }`.
|
|
670
|
+
*/
|
|
671
|
+
async recordCorrection(input) {
|
|
672
|
+
return this.fetchApi("/api/memory/corrections", {
|
|
673
|
+
method: "POST",
|
|
674
|
+
body: JSON.stringify(input)
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* v0.28 correction-memory — fetch the corrections applicable to a task
|
|
679
|
+
* shape. GETs `/api/memory/corrections`; returns `[]` when none have
|
|
680
|
+
* positive overlap. pyx never auto-prepends — the agent owns inclusion.
|
|
681
|
+
*/
|
|
682
|
+
async fetchApplicableCorrections(input) {
|
|
683
|
+
const params = new URLSearchParams({
|
|
684
|
+
namespaceId: input.namespaceId,
|
|
685
|
+
taskShape: input.taskShape
|
|
686
|
+
});
|
|
687
|
+
if (input.project) params.set("project", input.project);
|
|
688
|
+
if (input.limit !== void 0) params.set("limit", String(input.limit));
|
|
689
|
+
return this.fetchApi(`/api/memory/corrections?${params}`);
|
|
690
|
+
}
|
|
666
691
|
async fetchApi(path, options) {
|
|
667
692
|
const signal = options?.signal ?? AbortSignal.timeout(this._requestTimeoutMs);
|
|
668
693
|
let res;
|
package/dist/cli/pyx-mem.mjs
CHANGED
|
@@ -516,7 +516,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
516
516
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
517
517
|
|
|
518
518
|
// src/mcp/instructions.ts
|
|
519
|
-
var PYX_MEMORY_INSTRUCTIONS = `Use pyx-memory to search durable project/user memory before assuming prior decisions, and to store concise facts after corrections, bug fixes, design decisions, integration discoveries, gotchas, explicit preferences, or "remember this" requests. Store decisions, not deliberation. Include topic and project.
|
|
519
|
+
var PYX_MEMORY_INSTRUCTIONS = `Use pyx-memory to search durable project/user memory before assuming prior decisions, and to store concise facts after corrections, bug fixes, design decisions, integration discoveries, gotchas, explicit preferences, or "remember this" requests. Store decisions, not deliberation. Include topic and project. When content names people, organizations, tools, places, events, or key concepts, you (the caller) must extract and pass both entities and relationships \u2014 the server does not auto-extract them. Edges matter as much as nodes: without relationships the graph cannot connect related memories. Use file ingest for documents/images worth persisting; images require a description.`;
|
|
520
520
|
|
|
521
521
|
// src/mcp/sampling.ts
|
|
522
522
|
function createSamplingClient(server) {
|
|
@@ -15169,6 +15169,80 @@ var scopeShape = {
|
|
|
15169
15169
|
callerAccessLevel: external_exports.enum(["public", "internal", "secret"]).optional().describe("Sent as X-Caller-Access-Level for sensitivity filtering.")
|
|
15170
15170
|
};
|
|
15171
15171
|
|
|
15172
|
+
// src/mcp/tools/corrections.ts
|
|
15173
|
+
var recordInputShape = {
|
|
15174
|
+
namespaceId: external_exports.string().min(1).describe("Namespace id to record the correction into."),
|
|
15175
|
+
whatWasWrong: external_exports.string().min(1).describe("What the agent did wrong."),
|
|
15176
|
+
whatToDoInstead: external_exports.string().min(1).describe("The corrective instruction to follow instead."),
|
|
15177
|
+
appliesWhen: external_exports.string().min(1).describe("When this correction applies \u2014 the task context future tasks are matched against."),
|
|
15178
|
+
project: external_exports.string().optional().describe("Optional project scope; omit to apply to all projects."),
|
|
15179
|
+
taskShape: external_exports.string().optional().describe("Optional task-shape hint stored for provenance."),
|
|
15180
|
+
...scopeShape
|
|
15181
|
+
};
|
|
15182
|
+
var recordCorrectionTool = {
|
|
15183
|
+
name: "record_correction",
|
|
15184
|
+
config: {
|
|
15185
|
+
title: "Record a pyx-memory correction",
|
|
15186
|
+
description: 'Record an explicit user correction so the same mistake can be avoided next time. Call this when the user explicitly corrects the agent ("you did X wrong; do Y instead"). HTTP proxy to POST /api/memory/corrections \u2014 returns `{id, createdAt}`.',
|
|
15187
|
+
inputSchema: recordInputShape,
|
|
15188
|
+
annotations: { readOnlyHint: false, openWorldHint: true }
|
|
15189
|
+
},
|
|
15190
|
+
handler: (deps) => async (raw) => {
|
|
15191
|
+
const args = raw;
|
|
15192
|
+
const creds = await deps.readCredentials();
|
|
15193
|
+
if (!creds.ok) return creds.result;
|
|
15194
|
+
const http = createHttpClient(creds.credentials, deps.fetchImpl);
|
|
15195
|
+
const res = await http.requestJson({
|
|
15196
|
+
method: "POST",
|
|
15197
|
+
path: "/api/memory/corrections",
|
|
15198
|
+
body: {
|
|
15199
|
+
namespaceId: args.namespaceId,
|
|
15200
|
+
whatWasWrong: args.whatWasWrong,
|
|
15201
|
+
whatToDoInstead: args.whatToDoInstead,
|
|
15202
|
+
appliesWhen: args.appliesWhen,
|
|
15203
|
+
...args.project !== void 0 ? { project: args.project } : {},
|
|
15204
|
+
...args.taskShape !== void 0 ? { taskShape: args.taskShape } : {}
|
|
15205
|
+
},
|
|
15206
|
+
scope: args
|
|
15207
|
+
});
|
|
15208
|
+
return res.ok ? mcpJson(res.data) : res.result;
|
|
15209
|
+
}
|
|
15210
|
+
};
|
|
15211
|
+
var fetchInputShape = {
|
|
15212
|
+
namespaceId: external_exports.string().min(1).describe("Namespace id whose corrections to fetch."),
|
|
15213
|
+
taskShape: external_exports.string().min(1).describe("Shape of the task about to run \u2014 scored against each correction."),
|
|
15214
|
+
project: external_exports.string().optional().describe("Optional project filter."),
|
|
15215
|
+
limit: external_exports.number().int().positive().optional().describe("Max corrections to return (cap 5)."),
|
|
15216
|
+
...scopeShape
|
|
15217
|
+
};
|
|
15218
|
+
var fetchApplicableCorrectionsTool = {
|
|
15219
|
+
name: "fetch_applicable_corrections",
|
|
15220
|
+
config: {
|
|
15221
|
+
title: "Fetch applicable pyx-memory corrections",
|
|
15222
|
+
description: "Fetch the corrections applicable to a task shape (\u22645, ranked by overlap then recency). pyx never auto-prepends \u2014 you decide whether to follow them. HTTP proxy to GET /api/memory/corrections \u2014 returns a `CorrectionRecord[]` (`[]` when none apply).",
|
|
15223
|
+
inputSchema: fetchInputShape,
|
|
15224
|
+
annotations: { readOnlyHint: true, openWorldHint: true }
|
|
15225
|
+
},
|
|
15226
|
+
handler: (deps) => async (raw) => {
|
|
15227
|
+
const args = raw;
|
|
15228
|
+
const creds = await deps.readCredentials();
|
|
15229
|
+
if (!creds.ok) return creds.result;
|
|
15230
|
+
const http = createHttpClient(creds.credentials, deps.fetchImpl);
|
|
15231
|
+
const res = await http.requestJson({
|
|
15232
|
+
method: "GET",
|
|
15233
|
+
path: "/api/memory/corrections",
|
|
15234
|
+
query: {
|
|
15235
|
+
namespaceId: args.namespaceId,
|
|
15236
|
+
taskShape: args.taskShape,
|
|
15237
|
+
project: args.project,
|
|
15238
|
+
limit: args.limit
|
|
15239
|
+
},
|
|
15240
|
+
scope: args
|
|
15241
|
+
});
|
|
15242
|
+
return res.ok ? mcpJson(res.data) : res.result;
|
|
15243
|
+
}
|
|
15244
|
+
};
|
|
15245
|
+
|
|
15172
15246
|
// src/mcp/tools/delete.ts
|
|
15173
15247
|
var inputShape = {
|
|
15174
15248
|
id: external_exports.string().min(1).describe("Required memory entry id to delete."),
|
|
@@ -15524,11 +15598,15 @@ var relationshipTypes = [
|
|
|
15524
15598
|
"WORKS_AT",
|
|
15525
15599
|
"LOCATED_IN"
|
|
15526
15600
|
];
|
|
15601
|
+
var storeTargets = ["sqlite", "vector", "graph"];
|
|
15527
15602
|
var inputShape7 = {
|
|
15528
15603
|
content: external_exports.string().min(1).describe("Concise factual statement to persist; decision, not deliberation."),
|
|
15529
15604
|
topic: external_exports.string().min(1).describe("Required metadata.topic for retrieval grouping."),
|
|
15530
15605
|
project: external_exports.string().min(1).describe("Required metadata.project namespace."),
|
|
15531
15606
|
type: external_exports.enum(["short-term", "long-term", "working", "episodic", "summary"]).optional().describe("Memory type. Default long-term."),
|
|
15607
|
+
targets: external_exports.array(external_exports.enum(storeTargets)).optional().describe(
|
|
15608
|
+
"Storage targets. Include 'graph' when you provide entities/relationships or want zero graph write counts reported."
|
|
15609
|
+
),
|
|
15532
15610
|
importance: external_exports.number().int().min(1).max(10).optional().describe("Importance 1\u201310."),
|
|
15533
15611
|
eventTime: external_exports.string().optional().describe("ISO-8601 timestamp of when the event happened (bi-temporal)."),
|
|
15534
15612
|
source: external_exports.string().optional().describe("Free-form origin (filename, URL, conversation id)."),
|
|
@@ -15541,7 +15619,7 @@ var inputShape7 = {
|
|
|
15541
15619
|
type: external_exports.enum(entityTypes).describe("Entity type.")
|
|
15542
15620
|
})
|
|
15543
15621
|
).optional().describe(
|
|
15544
|
-
"Named entities mentioned by the content
|
|
15622
|
+
"Named entities mentioned by the content. The caller LLM must extract and pass these when the content names people, organizations, tools, places, events, or key concepts; the server does not auto-extract them."
|
|
15545
15623
|
),
|
|
15546
15624
|
relationships: external_exports.array(
|
|
15547
15625
|
external_exports.object({
|
|
@@ -15550,10 +15628,10 @@ var inputShape7 = {
|
|
|
15550
15628
|
type: external_exports.enum(relationshipTypes).describe("Relationship type.")
|
|
15551
15629
|
})
|
|
15552
15630
|
).optional().describe(
|
|
15553
|
-
"Edges between entities; source and target must be entity names from this request.
|
|
15631
|
+
"Edges between entities; source and target must be entity names from this request. Relationships matter as much as entities because graph traversal needs edges to connect related memories."
|
|
15554
15632
|
),
|
|
15555
15633
|
extractEntities: external_exports.boolean().optional().describe(
|
|
15556
|
-
"Override
|
|
15634
|
+
"Override extraction: false skips caller-side extraction; true requires caller entities or MCP sampling and errors loudly if neither is available."
|
|
15557
15635
|
),
|
|
15558
15636
|
...scopeShape
|
|
15559
15637
|
};
|
|
@@ -15561,7 +15639,7 @@ var storeMemoryTool = {
|
|
|
15561
15639
|
name: "store_memory",
|
|
15562
15640
|
config: {
|
|
15563
15641
|
title: "Store pyx-memory entry",
|
|
15564
|
-
description: "Store one concise factual memory with required topic and project metadata.
|
|
15642
|
+
description: "Store one concise factual memory with required topic and project metadata. When content names people, organizations, tools, places, events, or key concepts, the caller LLM must extract and pass entities and relationships; the server does not auto-extract them. Relationships (edges) matter as much as entities because graph traversal needs edges to connect related memories. Entity-free memories are valid; omit graph data or set extractEntities:false when there are no graph facts.",
|
|
15565
15643
|
inputSchema: inputShape7,
|
|
15566
15644
|
annotations: { readOnlyHint: false, idempotentHint: false, openWorldHint: true }
|
|
15567
15645
|
},
|
|
@@ -15575,12 +15653,14 @@ var storeMemoryTool = {
|
|
|
15575
15653
|
const samplingAvailable = deps.samplingClient?.isAvailable() ?? false;
|
|
15576
15654
|
const optedOut = args.extractEntities === false;
|
|
15577
15655
|
const forced = args.extractEntities === true;
|
|
15578
|
-
|
|
15656
|
+
const graphTargeted = args.targets?.includes("graph") ?? true;
|
|
15657
|
+
const hasCallerEntities = (entities?.length ?? 0) > 0;
|
|
15658
|
+
if (forced && graphTargeted && !samplingAvailable && !hasCallerEntities) {
|
|
15579
15659
|
throw new Error(
|
|
15580
|
-
"extractEntities=true requested but the connected MCP client did not advertise the
|
|
15660
|
+
"extractEntities=true requested but the connected MCP client did not advertise the sampling capability. Pass entities/relationships explicitly, set extractEntities:false, or connect a sampling-capable client."
|
|
15581
15661
|
);
|
|
15582
15662
|
}
|
|
15583
|
-
if (deps.samplingClient && samplingAvailable && !optedOut &&
|
|
15663
|
+
if (graphTargeted && deps.samplingClient && samplingAvailable && !optedOut && !hasCallerEntities) {
|
|
15584
15664
|
const prompt = buildExtractionPrompt(args.content);
|
|
15585
15665
|
const completion = await deps.samplingClient.complete(
|
|
15586
15666
|
prompt,
|
|
@@ -15594,6 +15674,7 @@ var storeMemoryTool = {
|
|
|
15594
15674
|
const body = {
|
|
15595
15675
|
content: args.content,
|
|
15596
15676
|
type: args.type ?? "long-term",
|
|
15677
|
+
targets: args.targets,
|
|
15597
15678
|
metadata: {
|
|
15598
15679
|
source: "agent",
|
|
15599
15680
|
topic: args.topic,
|
|
@@ -15605,7 +15686,8 @@ var storeMemoryTool = {
|
|
|
15605
15686
|
sessionId: args.sessionId,
|
|
15606
15687
|
parentId: args.parentId,
|
|
15607
15688
|
entities,
|
|
15608
|
-
relationships
|
|
15689
|
+
relationships,
|
|
15690
|
+
...args.extractEntities === false ? { extractEntities: false } : {}
|
|
15609
15691
|
};
|
|
15610
15692
|
const res = await http.requestJson({
|
|
15611
15693
|
method: "POST",
|
|
@@ -15671,14 +15753,16 @@ var ALL_TOOLS = [
|
|
|
15671
15753
|
summarizeMemoryEntityTool,
|
|
15672
15754
|
statusTool,
|
|
15673
15755
|
getUserProfileTool,
|
|
15674
|
-
upsertUserProfileTool
|
|
15756
|
+
upsertUserProfileTool,
|
|
15757
|
+
recordCorrectionTool,
|
|
15758
|
+
fetchApplicableCorrectionsTool
|
|
15675
15759
|
];
|
|
15676
15760
|
var ALL_TOOL_NAMES = ALL_TOOLS.map((t) => t.name);
|
|
15677
15761
|
|
|
15678
15762
|
// src/mcp/server.ts
|
|
15679
15763
|
async function runMcpServer(opts) {
|
|
15680
15764
|
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
15681
|
-
const version2 = opts.version ?? (true ? "0.
|
|
15765
|
+
const version2 = opts.version ?? (true ? "0.28.0" : "0.0.0-dev");
|
|
15682
15766
|
const server = new McpServer(
|
|
15683
15767
|
{ name: "pyx-memory", version: version2 },
|
|
15684
15768
|
{ instructions: PYX_MEMORY_INSTRUCTIONS, capabilities: { tools: {} } }
|
|
@@ -15865,7 +15949,7 @@ function mcpInstallClaudeCodeCommand(opts = {}) {
|
|
|
15865
15949
|
process.stdout.write(
|
|
15866
15950
|
`Installed pyx-memory MCP server in Claude Code (scope: ${scope}).
|
|
15867
15951
|
Restart Claude Code to make the tools available. No API key was written to .mcp.json \u2014 credentials live in the OS credential store.
|
|
15868
|
-
|
|
15952
|
+
To populate the knowledge graph, pass entities and relationships when you call store_memory \u2014 the server does not auto-extract them. Sampling-capable MCP clients can fill them from your own LLM; Claude Code does not advertise sampling, so extract and pass them yourself.
|
|
15869
15953
|
`
|
|
15870
15954
|
);
|
|
15871
15955
|
return EXIT.OK;
|
package/dist/dashboard.mjs
CHANGED
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
toGraphologyFormat,
|
|
12
12
|
transformGraphData,
|
|
13
13
|
unreachableHealth
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-XPZ4DUON.mjs";
|
|
15
|
+
import "./chunk-C5HKNVI5.mjs";
|
|
16
16
|
import "./chunk-SSUYQJUI.mjs";
|
|
17
17
|
export {
|
|
18
18
|
DashboardClient,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StoreInput as StoreInput$1, MemoryEntry as MemoryEntry$1, MemorySearchParams as MemorySearchParams$1, MemorySearchResult as MemorySearchResult$1, MemoryType as MemoryType$1, PrincipalContext as PrincipalContext$1, MemoryStats as MemoryStats$1, WikiLintReport as WikiLintReport$1, GraphRepairResult as GraphRepairResult$1, ExtractedImageMeta as ExtractedImageMeta$1, IngestEntity as IngestEntity$1, IngestRelationship as IngestRelationship$1, EntityExtractionResult as EntityExtractionResult$1, Topology as Topology$1, IngestEvent as IngestEvent$1, GraphNode as GraphNode$1, GraphTraversalResult as GraphTraversalResult$1 } from '@pyx-memory/shared';
|
|
1
|
+
import { StoreInput as StoreInput$1, MemoryEntry as MemoryEntry$1, MemorySearchParams as MemorySearchParams$1, MemorySearchResult as MemorySearchResult$1, MemoryType as MemoryType$1, PrincipalContext as PrincipalContext$1, MemoryStats as MemoryStats$1, WikiLintReport as WikiLintReport$1, GraphRepairResult as GraphRepairResult$1, ExtractedImageMeta as ExtractedImageMeta$1, IngestEntity as IngestEntity$1, IngestRelationship as IngestRelationship$1, EntityExtractionResult as EntityExtractionResult$1, Topology as Topology$1, IngestEvent as IngestEvent$1, GraphNode as GraphNode$1, GraphTraversalResult as GraphTraversalResult$1, CorrectionRecord as CorrectionRecord$1 } from '@pyx-memory/shared';
|
|
2
2
|
|
|
3
3
|
/** Parameters for paginated entry listing. */
|
|
4
4
|
interface MemoryListParams {
|
|
@@ -374,6 +374,33 @@ declare class MemoryClient implements ExtendedMemoryInterface {
|
|
|
374
374
|
updatedAt: string;
|
|
375
375
|
contentSize: number;
|
|
376
376
|
} | null>;
|
|
377
|
+
/**
|
|
378
|
+
* v0.28 correction-memory — record an explicit correction. POSTs to
|
|
379
|
+
* `/api/memory/corrections`; tenant is header-derived (server-side), so
|
|
380
|
+
* the body carries only the correction fields. Returns `{ id, createdAt }`.
|
|
381
|
+
*/
|
|
382
|
+
recordCorrection(input: {
|
|
383
|
+
namespaceId: string;
|
|
384
|
+
whatWasWrong: string;
|
|
385
|
+
whatToDoInstead: string;
|
|
386
|
+
appliesWhen: string;
|
|
387
|
+
project?: string;
|
|
388
|
+
taskShape?: string;
|
|
389
|
+
}): Promise<{
|
|
390
|
+
id: string;
|
|
391
|
+
createdAt: string;
|
|
392
|
+
}>;
|
|
393
|
+
/**
|
|
394
|
+
* v0.28 correction-memory — fetch the corrections applicable to a task
|
|
395
|
+
* shape. GETs `/api/memory/corrections`; returns `[]` when none have
|
|
396
|
+
* positive overlap. pyx never auto-prepends — the agent owns inclusion.
|
|
397
|
+
*/
|
|
398
|
+
fetchApplicableCorrections(input: {
|
|
399
|
+
namespaceId: string;
|
|
400
|
+
taskShape: string;
|
|
401
|
+
project?: string;
|
|
402
|
+
limit?: number;
|
|
403
|
+
}): Promise<CorrectionRecord$1[]>;
|
|
377
404
|
protected fetchApi<T>(path: string, options?: RequestInit): Promise<T>;
|
|
378
405
|
/**
|
|
379
406
|
* Map fetch-layer rejections into a typed `MemoryServerError` so callers
|
|
@@ -482,6 +509,10 @@ interface MemoryEntry {
|
|
|
482
509
|
sensitivity?: SensitivityLevel;
|
|
483
510
|
/** Whether the content field is encrypted at rest. */
|
|
484
511
|
encrypted?: boolean;
|
|
512
|
+
/** Number of graph entities written by this store call. Present on store responses. */
|
|
513
|
+
graphEntitiesWritten?: number;
|
|
514
|
+
/** Number of graph relationships written by this store call. Present on store responses. */
|
|
515
|
+
graphRelationshipsWritten?: number;
|
|
485
516
|
/** Tenant ID for multi-tenant isolation. */
|
|
486
517
|
tenantId?: string;
|
|
487
518
|
/** User ID within the tenant. */
|
|
@@ -620,11 +651,11 @@ type StoreInput = Omit<MemoryEntry, 'id' | 'createdAt'> & {
|
|
|
620
651
|
createdAt?: string;
|
|
621
652
|
/** Storage targets. Default: ["sqlite", "vector"]. */
|
|
622
653
|
targets?: StoreTarget[];
|
|
623
|
-
/** Agent-provided entities for graph storage.
|
|
654
|
+
/** Agent-provided entities for graph storage. */
|
|
624
655
|
entities?: IngestEntity[];
|
|
625
656
|
/** Agent-provided relationships for graph storage. */
|
|
626
657
|
relationships?: IngestRelationship[];
|
|
627
|
-
/** Override
|
|
658
|
+
/** Override graph entity extraction for this store call. */
|
|
628
659
|
extractEntities?: boolean;
|
|
629
660
|
/** Graph-failure handling. Default: "throw" (loud) — see GraphFailureMode. */
|
|
630
661
|
graphFailureMode?: GraphFailureMode;
|
|
@@ -637,11 +668,11 @@ interface MemoryIngestRequest {
|
|
|
637
668
|
sessionId?: string;
|
|
638
669
|
/** Storage targets. Default: ["sqlite", "vector"]. */
|
|
639
670
|
targets?: StoreTarget[];
|
|
640
|
-
/** Agent-provided entities for graph storage.
|
|
671
|
+
/** Agent-provided entities for graph storage. */
|
|
641
672
|
entities?: IngestEntity[];
|
|
642
673
|
/** Agent-provided relationships for graph storage. */
|
|
643
674
|
relationships?: IngestRelationship[];
|
|
644
|
-
/** Override
|
|
675
|
+
/** Override graph entity extraction for this ingest request. */
|
|
645
676
|
extractEntities?: boolean;
|
|
646
677
|
/** Graph-failure handling. Default: "throw" (loud) — see GraphFailureMode. */
|
|
647
678
|
graphFailureMode?: GraphFailureMode;
|
|
@@ -671,6 +702,51 @@ interface MemoryIngestRequest {
|
|
|
671
702
|
*/
|
|
672
703
|
pinned?: boolean;
|
|
673
704
|
}
|
|
705
|
+
/**
|
|
706
|
+
* Agent-recorded explicit correction ("you did X wrong; do Y instead").
|
|
707
|
+
* `Memory.recordCorrection` writes one pinned, sqlite-only entry; pyx does
|
|
708
|
+
* pure structural retrieval with zero LLM / embedding on this path. Scope is
|
|
709
|
+
* `(tenantId, namespaceId)` + optional `project` — NOT per-user, because a
|
|
710
|
+
* correction about how to do X in this project is namespace-shared. No
|
|
711
|
+
* `confidence` field by design: ranking is overlap-then-recency only.
|
|
712
|
+
*/
|
|
713
|
+
interface CorrectionInput {
|
|
714
|
+
tenantId: string;
|
|
715
|
+
namespaceId: string;
|
|
716
|
+
/** What the agent did wrong (required free text). */
|
|
717
|
+
whatWasWrong: string;
|
|
718
|
+
/** The corrective instruction (required free text) — stored as `entry.content`. */
|
|
719
|
+
whatToDoInstead: string;
|
|
720
|
+
/** Applicability context the matcher scores task shapes against (required free text). */
|
|
721
|
+
appliesWhen: string;
|
|
722
|
+
/** Optional project scope — when set, the correction applies only to that project. */
|
|
723
|
+
project?: string;
|
|
724
|
+
/** Optional task-shape hint, stored for provenance; matching uses `appliesWhen`. */
|
|
725
|
+
taskShape?: string;
|
|
726
|
+
/** Optional agent id; defaults to the Memory instance's `agentId`. */
|
|
727
|
+
agentId?: string;
|
|
728
|
+
}
|
|
729
|
+
/** Input to `Memory.fetchApplicableCorrections`. */
|
|
730
|
+
interface FetchCorrectionsInput {
|
|
731
|
+
tenantId: string;
|
|
732
|
+
namespaceId: string;
|
|
733
|
+
/** Shape of the task about to run — scored against each correction's `appliesWhen`. */
|
|
734
|
+
taskShape: string;
|
|
735
|
+
/** Optional project filter — keeps only project-matching or project-absent rows. */
|
|
736
|
+
project?: string;
|
|
737
|
+
/** Max corrections to return. Default 5, hard cap 5. */
|
|
738
|
+
limit?: number;
|
|
739
|
+
}
|
|
740
|
+
/** One applicable correction returned by `fetchApplicableCorrections`. */
|
|
741
|
+
interface CorrectionRecord {
|
|
742
|
+
id: string;
|
|
743
|
+
whatWasWrong: string;
|
|
744
|
+
whatToDoInstead: string;
|
|
745
|
+
appliesWhen: string;
|
|
746
|
+
createdAt: string;
|
|
747
|
+
/** Overlap-coefficient score between the query `taskShape` and this row's `appliesWhen`. */
|
|
748
|
+
score: number;
|
|
749
|
+
}
|
|
674
750
|
interface MemoryStats {
|
|
675
751
|
totalEntries: number;
|
|
676
752
|
storageUsedBytes: number;
|
|
@@ -1089,4 +1165,4 @@ interface PrincipalContext {
|
|
|
1089
1165
|
/** Sentinel tenant ID used in single-tenant deployments. */
|
|
1090
1166
|
declare const SINGLE_TENANT_ID = "_single";
|
|
1091
1167
|
|
|
1092
|
-
export { type AgentId, type ApiResponse, type ConsolidationRunResult, DEFAULTS, DEPRECATED_RAG_STRATEGIES, EmbeddingProviderName, type EnrichmentCallbacks, type EntityExtractionResult, type ExtendedMemoryInterface, type GraphFailureMode, type GraphNode, type GraphRelationship, type GraphRepairResult, type GraphTraversalResult, type IngestEntity, type IngestErrorEvent, type IngestEvent, type IngestFileOptions, type IngestHeartbeatEvent, type IngestProgressEvent, type IngestRelationship, type IngestResultEvent, type IngestStage, type IngestionResult, MemoryClient, type MemoryClientOptions, type MemoryEntry, type MemoryIngestRequest, type MemoryInterface, type MemoryListParams, type MemoryListResult, type MemoryLogFilters, type MemorySearchParams, type MemorySearchResult, MemoryServerError, type MemoryStats, MemoryType, type MoveEntriesFilter, MoveFailureReason, type MoveResult, type MoveTarget, NamespaceIsolation, type PrincipalContext, RAGStrategy, SINGLE_TENANT_ID, SensitivityLevel, type StoreInput, StoreTarget, type TemporalQueryFilters, type TenantScopeOptions, type Timestamp, type Topology, type TopologyServiceVariant, VectorProvider, type WikiLintReport, mergeExtractedEntities };
|
|
1168
|
+
export { type AgentId, type ApiResponse, type ConsolidationRunResult, type CorrectionInput, type CorrectionRecord, DEFAULTS, DEPRECATED_RAG_STRATEGIES, EmbeddingProviderName, type EnrichmentCallbacks, type EntityExtractionResult, type ExtendedMemoryInterface, type FetchCorrectionsInput, type GraphFailureMode, type GraphNode, type GraphRelationship, type GraphRepairResult, type GraphTraversalResult, type IngestEntity, type IngestErrorEvent, type IngestEvent, type IngestFileOptions, type IngestHeartbeatEvent, type IngestProgressEvent, type IngestRelationship, type IngestResultEvent, type IngestStage, type IngestionResult, MemoryClient, type MemoryClientOptions, type MemoryEntry, type MemoryIngestRequest, type MemoryInterface, type MemoryListParams, type MemoryListResult, type MemoryLogFilters, type MemorySearchParams, type MemorySearchResult, MemoryServerError, type MemoryStats, MemoryType, type MoveEntriesFilter, MoveFailureReason, type MoveResult, type MoveTarget, NamespaceIsolation, type PrincipalContext, RAGStrategy, SINGLE_TENANT_ID, SensitivityLevel, type StoreInput, StoreTarget, type TemporalQueryFilters, type TenantScopeOptions, type Timestamp, type Topology, type TopologyServiceVariant, VectorProvider, type WikiLintReport, mergeExtractedEntities };
|
package/dist/index.mjs
CHANGED
package/dist/react.mjs
CHANGED
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
toGraphologyFormat,
|
|
12
12
|
transformGraphData,
|
|
13
13
|
unreachableHealth
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-XPZ4DUON.mjs";
|
|
15
|
+
import "./chunk-C5HKNVI5.mjs";
|
|
16
16
|
import "./chunk-SSUYQJUI.mjs";
|
|
17
17
|
|
|
18
18
|
// ../dashboard/src/hooks/use-consolidation-log.ts
|