@pyxmate/memory 0.27.0 → 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/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 +78 -2
- package/dist/dashboard.mjs +2 -2
- package/dist/index.d.ts +74 -2
- package/dist/index.mjs +1 -1
- package/dist/react.mjs +2 -2
- package/package.json +1 -1
|
@@ -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
|
@@ -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."),
|
|
@@ -15679,14 +15753,16 @@ var ALL_TOOLS = [
|
|
|
15679
15753
|
summarizeMemoryEntityTool,
|
|
15680
15754
|
statusTool,
|
|
15681
15755
|
getUserProfileTool,
|
|
15682
|
-
upsertUserProfileTool
|
|
15756
|
+
upsertUserProfileTool,
|
|
15757
|
+
recordCorrectionTool,
|
|
15758
|
+
fetchApplicableCorrectionsTool
|
|
15683
15759
|
];
|
|
15684
15760
|
var ALL_TOOL_NAMES = ALL_TOOLS.map((t) => t.name);
|
|
15685
15761
|
|
|
15686
15762
|
// src/mcp/server.ts
|
|
15687
15763
|
async function runMcpServer(opts) {
|
|
15688
15764
|
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
15689
|
-
const version2 = opts.version ?? (true ? "0.
|
|
15765
|
+
const version2 = opts.version ?? (true ? "0.28.0" : "0.0.0-dev");
|
|
15690
15766
|
const server = new McpServer(
|
|
15691
15767
|
{ name: "pyx-memory", version: version2 },
|
|
15692
15768
|
{ instructions: PYX_MEMORY_INSTRUCTIONS, capabilities: { tools: {} } }
|
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
|
|
@@ -675,6 +702,51 @@ interface MemoryIngestRequest {
|
|
|
675
702
|
*/
|
|
676
703
|
pinned?: boolean;
|
|
677
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
|
+
}
|
|
678
750
|
interface MemoryStats {
|
|
679
751
|
totalEntries: number;
|
|
680
752
|
storageUsedBytes: number;
|
|
@@ -1093,4 +1165,4 @@ interface PrincipalContext {
|
|
|
1093
1165
|
/** Sentinel tenant ID used in single-tenant deployments. */
|
|
1094
1166
|
declare const SINGLE_TENANT_ID = "_single";
|
|
1095
1167
|
|
|
1096
|
-
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
|