mcp-agents-memory 0.7.0 → 0.8.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/build/index.js +34 -10
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -116326,26 +116326,33 @@ var BRANCH_THRESHOLD = 0.7;
|
|
|
116326
116326
|
function singletonArray(value) {
|
|
116327
116327
|
return typeof value === "number" ? [value] : [];
|
|
116328
116328
|
}
|
|
116329
|
+
function mergeProjectIntoApplicableTo(base, projectKey) {
|
|
116330
|
+
if (!projectKey) return base;
|
|
116331
|
+
if (Array.isArray(base.projects)) return base;
|
|
116332
|
+
return { ...base, projects: [projectKey] };
|
|
116333
|
+
}
|
|
116329
116334
|
function getPersistedSkillFields(candidate, audit) {
|
|
116330
116335
|
if (!audit) {
|
|
116336
|
+
const applicable = mergeProjectIntoApplicableTo({}, candidate.project_key);
|
|
116331
116337
|
return {
|
|
116332
116338
|
content: candidate.content,
|
|
116333
116339
|
sources: JSON.stringify([]),
|
|
116334
116340
|
validationTier: "unvalidated",
|
|
116335
|
-
applicableTo: JSON.stringify(
|
|
116341
|
+
applicableTo: JSON.stringify(applicable),
|
|
116336
116342
|
auditMetadata: {}
|
|
116337
116343
|
};
|
|
116338
116344
|
}
|
|
116345
|
+
const merged = mergeProjectIntoApplicableTo(audit.applicable_to ?? {}, candidate.project_key);
|
|
116339
116346
|
return {
|
|
116340
116347
|
content: audit.reconciled_content,
|
|
116341
116348
|
sources: JSON.stringify(audit.sources),
|
|
116342
116349
|
validationTier: audit.validation_tier,
|
|
116343
|
-
applicableTo: JSON.stringify(
|
|
116350
|
+
applicableTo: JSON.stringify(merged),
|
|
116344
116351
|
auditMetadata: {
|
|
116345
116352
|
validation_tier: audit.validation_tier,
|
|
116346
116353
|
audit_reasoning: audit.audit_reasoning,
|
|
116347
116354
|
sources: audit.sources,
|
|
116348
|
-
applicable_to:
|
|
116355
|
+
applicable_to: merged
|
|
116349
116356
|
}
|
|
116350
116357
|
};
|
|
116351
116358
|
}
|
|
@@ -116383,11 +116390,14 @@ async function getInjectableSkills(ctx) {
|
|
|
116383
116390
|
AND
|
|
116384
116391
|
($2::text IS NULL OR NOT (applicable_to ? 'platforms')
|
|
116385
116392
|
OR applicable_to->'platforms' @> to_jsonb($2::text))
|
|
116393
|
+
AND
|
|
116394
|
+
($3::text IS NULL OR NOT (applicable_to ? 'projects')
|
|
116395
|
+
OR applicable_to->'projects' @> to_jsonb($3::text))
|
|
116386
116396
|
)
|
|
116387
116397
|
)
|
|
116388
116398
|
ORDER BY use_count DESC, last_used_at DESC NULLS LAST, created_at DESC
|
|
116389
|
-
LIMIT $
|
|
116390
|
-
[ctx.author_model ?? null, ctx.platform ?? null, limit2]
|
|
116399
|
+
LIMIT $4`,
|
|
116400
|
+
[ctx.author_model ?? null, ctx.platform ?? null, ctx.project_key ?? null, limit2]
|
|
116391
116401
|
);
|
|
116392
116402
|
return res.rows.map((row) => ({
|
|
116393
116403
|
id: Number(row.id),
|
|
@@ -116427,9 +116437,16 @@ ${persisted.content}`);
|
|
|
116427
116437
|
await client2.query(
|
|
116428
116438
|
`UPDATE skills
|
|
116429
116439
|
SET use_count = use_count + 1,
|
|
116430
|
-
last_used_at = NOW()
|
|
116440
|
+
last_used_at = NOW(),
|
|
116441
|
+
applicable_to = CASE
|
|
116442
|
+
WHEN $2::text IS NULL THEN applicable_to
|
|
116443
|
+
WHEN NOT (applicable_to ? 'projects') THEN applicable_to
|
|
116444
|
+
WHEN applicable_to->'projects' @> to_jsonb($2::text) THEN applicable_to
|
|
116445
|
+
ELSE jsonb_set(applicable_to, '{projects}',
|
|
116446
|
+
applicable_to->'projects' || to_jsonb($2::text))
|
|
116447
|
+
END
|
|
116431
116448
|
WHERE id = $1`,
|
|
116432
|
-
[match.id]
|
|
116449
|
+
[match.id, candidate.project_key ?? null]
|
|
116433
116450
|
);
|
|
116434
116451
|
await client2.query(
|
|
116435
116452
|
`INSERT INTO skill_changelog (
|
|
@@ -116914,7 +116931,10 @@ async function runCurator(options = {}) {
|
|
|
116914
116931
|
content: parsed.content,
|
|
116915
116932
|
source_memory_ids: cluster.member_ids,
|
|
116916
116933
|
author_model: "curator",
|
|
116917
|
-
platform: "system"
|
|
116934
|
+
platform: "system",
|
|
116935
|
+
// v0.8: propagate project scope from cluster context to the skill.
|
|
116936
|
+
// Cross-project clusters (projectKey unset) leave applicable_to.projects unset → match-all.
|
|
116937
|
+
project_key: options.projectKey
|
|
116918
116938
|
};
|
|
116919
116939
|
let audit;
|
|
116920
116940
|
let audited;
|
|
@@ -117367,7 +117387,8 @@ function registerTools(server) {
|
|
|
117367
117387
|
inputSchema: {
|
|
117368
117388
|
user_key: external_exports.string().optional().default(process.env.MEMORY_DEFAULT_SUBJECT || "default_user").describe("User subject key."),
|
|
117369
117389
|
author_model: external_exports.string().optional().describe("Caller's author model (for skill filtering)."),
|
|
117370
|
-
platform: external_exports.string().optional().describe("Caller's platform (for skill filtering).")
|
|
117390
|
+
platform: external_exports.string().optional().describe("Caller's platform (for skill filtering)."),
|
|
117391
|
+
project_key: external_exports.string().optional().describe("Active project key. Skills scoped to specific projects only inject when this matches; unscoped skills (applicable_to.projects unset) inject regardless.")
|
|
117371
117392
|
}
|
|
117372
117393
|
},
|
|
117373
117394
|
async (args) => {
|
|
@@ -117468,6 +117489,7 @@ function registerTools(server) {
|
|
|
117468
117489
|
const skills = await getInjectableSkills({
|
|
117469
117490
|
author_model: args.author_model,
|
|
117470
117491
|
platform: args.platform,
|
|
117492
|
+
project_key: args.project_key,
|
|
117471
117493
|
limit: 5
|
|
117472
117494
|
});
|
|
117473
117495
|
if (skills.length > 0) {
|
|
@@ -117584,6 +117606,7 @@ function registerTools(server) {
|
|
|
117584
117606
|
source_memory_ids: external_exports.array(external_exports.number()).optional().describe("Memory IDs that produced this skill."),
|
|
117585
117607
|
author_model: external_exports.string().optional().describe("Model name or alias that authored the skill."),
|
|
117586
117608
|
platform: external_exports.string().optional().describe("Platform where the skill was authored."),
|
|
117609
|
+
project_key: external_exports.string().optional().describe("Project subject key. If set, skill is scoped to this project (only injects when memory_startup gets matching project_key). Omit for cross-project skills."),
|
|
117587
117610
|
agent_key: external_exports.string().optional().describe("Agent persona key. See memory_add for details."),
|
|
117588
117611
|
audit: external_exports.boolean().optional().default(true).describe("Run Skill Auditor before saving. Default: true.")
|
|
117589
117612
|
}
|
|
@@ -117594,7 +117617,8 @@ function registerTools(server) {
|
|
|
117594
117617
|
content: args.content,
|
|
117595
117618
|
source_memory_ids: args.source_memory_ids,
|
|
117596
117619
|
author_model: args.author_model,
|
|
117597
|
-
platform: args.platform
|
|
117620
|
+
platform: args.platform,
|
|
117621
|
+
project_key: args.project_key
|
|
117598
117622
|
};
|
|
117599
117623
|
const agentKeyRaw = args.agent_key ?? process.env.AGENT_KEY ?? null;
|
|
117600
117624
|
const agentCuratorId = agentKeyRaw ? await getOrCreateSubject(agentKeyRaw, "agent") : null;
|