@vheins/local-memory-mcp 0.13.0 → 0.13.2
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.
|
@@ -81,8 +81,8 @@ function loadServerInstructions() {
|
|
|
81
81
|
// src/mcp/capabilities.ts
|
|
82
82
|
var __dirname2 = path2.dirname(fileURLToPath2(import.meta.url));
|
|
83
83
|
var pkgVersion = "0.1.0";
|
|
84
|
-
if ("0.13.
|
|
85
|
-
pkgVersion = "0.13.
|
|
84
|
+
if ("0.13.2") {
|
|
85
|
+
pkgVersion = "0.13.2";
|
|
86
86
|
} else {
|
|
87
87
|
let searchDir = __dirname2;
|
|
88
88
|
for (let i = 0; i < 5; i++) {
|
|
@@ -3206,7 +3206,8 @@ var MemoryStoreSchema = z.object({
|
|
|
3206
3206
|
structured: z.boolean().default(false)
|
|
3207
3207
|
});
|
|
3208
3208
|
var MemoryUpdateSchema = z.object({
|
|
3209
|
-
id: z.string().uuid(),
|
|
3209
|
+
id: z.string().uuid().optional(),
|
|
3210
|
+
code: z.string().max(20).optional(),
|
|
3210
3211
|
type: MemoryTypeSchema.optional(),
|
|
3211
3212
|
title: z.string().min(3).max(255).optional(),
|
|
3212
3213
|
content: z.string().min(10).optional(),
|
|
@@ -3220,6 +3221,8 @@ var MemoryUpdateSchema = z.object({
|
|
|
3220
3221
|
is_global: z.boolean().optional(),
|
|
3221
3222
|
completed_at: z.string().optional(),
|
|
3222
3223
|
structured: z.boolean().default(false)
|
|
3224
|
+
}).refine((data) => data.id !== void 0 || data.code !== void 0, {
|
|
3225
|
+
message: "Either id or code must be provided"
|
|
3223
3226
|
}).refine(
|
|
3224
3227
|
(data) => data.type !== void 0 || data.content !== void 0 || data.title !== void 0 || data.importance !== void 0 || data.status !== void 0 || data.supersedes !== void 0 || data.tags !== void 0 || data.metadata !== void 0 || data.is_global !== void 0 || data.agent !== void 0 || data.role !== void 0 || data.completed_at !== void 0,
|
|
3225
3228
|
{ message: "At least one field must be provided for update" }
|
|
@@ -3240,10 +3243,13 @@ var MemorySearchSchema = z.object({
|
|
|
3240
3243
|
structured: z.boolean().default(false)
|
|
3241
3244
|
});
|
|
3242
3245
|
var MemoryAcknowledgeSchema = z.object({
|
|
3243
|
-
memory_id: z.string().uuid(),
|
|
3246
|
+
memory_id: z.string().uuid().optional(),
|
|
3247
|
+
code: z.string().max(20).optional(),
|
|
3244
3248
|
status: z.enum(["used", "irrelevant", "contradictory"]),
|
|
3245
3249
|
application_context: z.string().min(10).optional(),
|
|
3246
3250
|
structured: z.boolean().default(false)
|
|
3251
|
+
}).refine((data) => data.memory_id !== void 0 || data.code !== void 0, {
|
|
3252
|
+
message: "Either memory_id or code must be provided"
|
|
3247
3253
|
});
|
|
3248
3254
|
var MemoryRecapSchema = z.object({
|
|
3249
3255
|
repo: z.string().min(1).transform(normalizeRepo),
|
|
@@ -3255,9 +3261,11 @@ var MemoryDeleteSchema = z.object({
|
|
|
3255
3261
|
repo: z.string().min(1).transform(normalizeRepo).optional(),
|
|
3256
3262
|
id: z.string().uuid().optional(),
|
|
3257
3263
|
ids: z.array(z.string().uuid()).min(1).optional(),
|
|
3264
|
+
code: z.string().max(20).optional(),
|
|
3265
|
+
codes: z.array(z.string().max(20)).min(1).optional(),
|
|
3258
3266
|
structured: z.boolean().default(false)
|
|
3259
|
-
}).refine((data) => data.id !== void 0 || data.ids !== void 0, {
|
|
3260
|
-
message: "Either 'id' or '
|
|
3267
|
+
}).refine((data) => data.id !== void 0 || data.ids !== void 0 || data.code !== void 0 || data.codes !== void 0, {
|
|
3268
|
+
message: "Either 'id', 'ids', 'code', or 'codes' must be provided for deletion"
|
|
3261
3269
|
});
|
|
3262
3270
|
var MemorySummarizeSchema = z.object({
|
|
3263
3271
|
repo: z.string().min(1).transform(normalizeRepo),
|
|
@@ -3374,9 +3382,10 @@ var TaskDeleteSchema = z.object({
|
|
|
3374
3382
|
repo: z.string().min(1).transform(normalizeRepo),
|
|
3375
3383
|
id: z.string().uuid().optional(),
|
|
3376
3384
|
ids: z.array(z.string().uuid()).min(1).optional(),
|
|
3385
|
+
task_code: z.string().optional(),
|
|
3377
3386
|
structured: z.boolean().default(false)
|
|
3378
|
-
}).refine((data) => data.id !== void 0 || data.ids !== void 0, {
|
|
3379
|
-
message: "Either 'id' or '
|
|
3387
|
+
}).refine((data) => data.id !== void 0 || data.ids !== void 0 || data.task_code !== void 0, {
|
|
3388
|
+
message: "Either 'id', 'ids', or 'task_code' must be provided for deletion"
|
|
3380
3389
|
});
|
|
3381
3390
|
var MemoryDetailSchema = z.object({
|
|
3382
3391
|
id: z.string().uuid().optional(),
|
|
@@ -3396,9 +3405,11 @@ var StandardDeleteSchema = z.object({
|
|
|
3396
3405
|
repo: z.string().min(1).transform(normalizeRepo).optional(),
|
|
3397
3406
|
id: z.string().uuid().optional(),
|
|
3398
3407
|
ids: z.array(z.string().uuid()).min(1).optional(),
|
|
3408
|
+
code: z.string().max(20).optional(),
|
|
3409
|
+
codes: z.array(z.string().max(20)).min(1).optional(),
|
|
3399
3410
|
structured: z.boolean().default(false)
|
|
3400
|
-
}).refine((data) => data.id !== void 0 || data.ids !== void 0, {
|
|
3401
|
-
message: "Either 'id' or '
|
|
3411
|
+
}).refine((data) => data.id !== void 0 || data.ids !== void 0 || data.code !== void 0 || data.codes !== void 0, {
|
|
3412
|
+
message: "Either 'id', 'ids', 'code', or 'codes' must be provided for deletion"
|
|
3402
3413
|
});
|
|
3403
3414
|
var TaskGetSchema = z.object({
|
|
3404
3415
|
repo: z.string().min(1).transform(normalizeRepo),
|
|
@@ -3494,7 +3505,8 @@ var StandardStoreSchema = z.object({
|
|
|
3494
3505
|
message: "repo is required for repo-specific standards"
|
|
3495
3506
|
});
|
|
3496
3507
|
var StandardUpdateSchema = z.object({
|
|
3497
|
-
id: z.string().uuid(),
|
|
3508
|
+
id: z.string().uuid().optional(),
|
|
3509
|
+
code: z.string().max(20).optional(),
|
|
3498
3510
|
name: z.string().min(3).max(255).optional(),
|
|
3499
3511
|
content: z.string().min(10).optional(),
|
|
3500
3512
|
parent_id: z.string().uuid().nullable().optional(),
|
|
@@ -3509,6 +3521,8 @@ var StandardUpdateSchema = z.object({
|
|
|
3509
3521
|
agent: z.string().optional(),
|
|
3510
3522
|
model: z.string().optional(),
|
|
3511
3523
|
structured: z.boolean().default(false)
|
|
3524
|
+
}).refine((data) => data.id !== void 0 || data.code !== void 0, {
|
|
3525
|
+
message: "Either id or code must be provided"
|
|
3512
3526
|
}).refine(
|
|
3513
3527
|
(data) => data.name !== void 0 || data.content !== void 0 || data.parent_id !== void 0 || data.context !== void 0 || data.version !== void 0 || data.language !== void 0 || data.stack !== void 0 || data.repo !== void 0 || data.is_global !== void 0 || data.tags !== void 0 || data.metadata !== void 0 || data.agent !== void 0 || data.model !== void 0,
|
|
3514
3528
|
{ message: "At least one field must be provided for update" }
|
|
@@ -3781,12 +3795,13 @@ var TOOL_DEFINITIONS = [
|
|
|
3781
3795
|
inputSchema: {
|
|
3782
3796
|
type: "object",
|
|
3783
3797
|
properties: {
|
|
3784
|
-
memory_id: { type: "string", format: "uuid" },
|
|
3798
|
+
memory_id: { type: "string", format: "uuid", description: "Memory entry ID. Optional if code is provided." },
|
|
3799
|
+
code: { type: "string", maxLength: 20, description: "Short memory code. Optional if memory_id is provided." },
|
|
3785
3800
|
status: { type: "string", enum: ["used", "irrelevant", "contradictory"] },
|
|
3786
3801
|
application_context: { type: "string", minLength: 10 },
|
|
3787
3802
|
structured: { type: "boolean", default: false, description: "If true, returns structured JSON result." }
|
|
3788
3803
|
},
|
|
3789
|
-
required: ["
|
|
3804
|
+
required: ["status"]
|
|
3790
3805
|
},
|
|
3791
3806
|
outputSchema: {
|
|
3792
3807
|
type: "object",
|
|
@@ -3811,7 +3826,8 @@ var TOOL_DEFINITIONS = [
|
|
|
3811
3826
|
inputSchema: {
|
|
3812
3827
|
type: "object",
|
|
3813
3828
|
properties: {
|
|
3814
|
-
id: { type: "string", format: "uuid" },
|
|
3829
|
+
id: { type: "string", format: "uuid", description: "Memory entry ID. Optional if code is provided." },
|
|
3830
|
+
code: { type: "string", maxLength: 20, description: "Short memory code. Optional if id is provided." },
|
|
3815
3831
|
type: {
|
|
3816
3832
|
type: "string",
|
|
3817
3833
|
enum: ["code_fact", "decision", "mistake", "pattern", "task_archive"]
|
|
@@ -3832,21 +3848,21 @@ var TOOL_DEFINITIONS = [
|
|
|
3832
3848
|
default: false,
|
|
3833
3849
|
description: "If true, returns structured JSON of the updated memory."
|
|
3834
3850
|
}
|
|
3835
|
-
}
|
|
3836
|
-
required: ["id"]
|
|
3851
|
+
}
|
|
3837
3852
|
},
|
|
3838
3853
|
outputSchema: {
|
|
3839
3854
|
type: "object",
|
|
3840
3855
|
properties: {
|
|
3841
3856
|
success: { type: "boolean" },
|
|
3842
3857
|
id: { type: "string" },
|
|
3858
|
+
code: { type: "string" },
|
|
3843
3859
|
repo: { type: "string" },
|
|
3844
3860
|
updatedFields: {
|
|
3845
3861
|
type: "array",
|
|
3846
3862
|
items: { type: "string" }
|
|
3847
3863
|
}
|
|
3848
3864
|
},
|
|
3849
|
-
required: ["success", "
|
|
3865
|
+
required: ["success", "repo", "updatedFields"]
|
|
3850
3866
|
}
|
|
3851
3867
|
},
|
|
3852
3868
|
{
|
|
@@ -3976,13 +3992,20 @@ var TOOL_DEFINITIONS = [
|
|
|
3976
3992
|
type: "object",
|
|
3977
3993
|
properties: {
|
|
3978
3994
|
repo: { type: "string", description: "Repository name (optional for single id)" },
|
|
3979
|
-
id: { type: "string", format: "uuid", description: "Memory entry ID to delete" },
|
|
3995
|
+
id: { type: "string", format: "uuid", description: "Memory entry ID to delete. Optional if code is provided." },
|
|
3980
3996
|
ids: {
|
|
3981
3997
|
type: "array",
|
|
3982
3998
|
items: { type: "string", format: "uuid" },
|
|
3983
3999
|
minItems: 1,
|
|
3984
4000
|
description: "Array of memory IDs to delete"
|
|
3985
4001
|
},
|
|
4002
|
+
code: { type: "string", maxLength: 20, description: "Short memory code. Optional if id is provided." },
|
|
4003
|
+
codes: {
|
|
4004
|
+
type: "array",
|
|
4005
|
+
items: { type: "string", maxLength: 20 },
|
|
4006
|
+
minItems: 1,
|
|
4007
|
+
description: "Array of memory codes to delete"
|
|
4008
|
+
},
|
|
3986
4009
|
structured: { type: "boolean", default: false, description: "If true, returns structured JSON result." }
|
|
3987
4010
|
}
|
|
3988
4011
|
},
|
|
@@ -3991,7 +4014,9 @@ var TOOL_DEFINITIONS = [
|
|
|
3991
4014
|
properties: {
|
|
3992
4015
|
success: { type: "boolean" },
|
|
3993
4016
|
id: { type: "string" },
|
|
4017
|
+
code: { type: "string" },
|
|
3994
4018
|
ids: { type: "array", items: { type: "string" } },
|
|
4019
|
+
codes: { type: "array", items: { type: "string" } },
|
|
3995
4020
|
repo: { type: "string" },
|
|
3996
4021
|
deletedCount: { type: "number" }
|
|
3997
4022
|
},
|
|
@@ -4012,13 +4037,20 @@ var TOOL_DEFINITIONS = [
|
|
|
4012
4037
|
type: "object",
|
|
4013
4038
|
properties: {
|
|
4014
4039
|
repo: { type: "string", description: "Repository name (optional for single id)" },
|
|
4015
|
-
id: { type: "string", format: "uuid", description: "Coding standard ID to delete" },
|
|
4040
|
+
id: { type: "string", format: "uuid", description: "Coding standard ID to delete. Optional if code is provided." },
|
|
4016
4041
|
ids: {
|
|
4017
4042
|
type: "array",
|
|
4018
4043
|
items: { type: "string", format: "uuid" },
|
|
4019
4044
|
minItems: 1,
|
|
4020
4045
|
description: "Array of coding standard IDs to delete"
|
|
4021
4046
|
},
|
|
4047
|
+
code: { type: "string", maxLength: 20, description: "Short standard code. Optional if id is provided." },
|
|
4048
|
+
codes: {
|
|
4049
|
+
type: "array",
|
|
4050
|
+
items: { type: "string", maxLength: 20 },
|
|
4051
|
+
minItems: 1,
|
|
4052
|
+
description: "Array of standard codes to delete"
|
|
4053
|
+
},
|
|
4022
4054
|
structured: { type: "boolean", default: false, description: "If true, returns structured JSON result." }
|
|
4023
4055
|
}
|
|
4024
4056
|
},
|
|
@@ -4027,7 +4059,9 @@ var TOOL_DEFINITIONS = [
|
|
|
4027
4059
|
properties: {
|
|
4028
4060
|
success: { type: "boolean" },
|
|
4029
4061
|
id: { type: "string" },
|
|
4062
|
+
code: { type: "string" },
|
|
4030
4063
|
ids: { type: "array", items: { type: "string" } },
|
|
4064
|
+
codes: { type: "array", items: { type: "string" } },
|
|
4031
4065
|
repo: { type: "string" },
|
|
4032
4066
|
deletedCount: { type: "number" }
|
|
4033
4067
|
},
|
|
@@ -4306,8 +4340,9 @@ var TOOL_DEFINITIONS = [
|
|
|
4306
4340
|
type: "object",
|
|
4307
4341
|
properties: {
|
|
4308
4342
|
repo: { type: "string", description: "Repository name" },
|
|
4309
|
-
id: { type: "string", format: "uuid", description: "Task ID (for single deletion)" },
|
|
4343
|
+
id: { type: "string", format: "uuid", description: "Task ID (for single deletion). Optional if task_code is provided." },
|
|
4310
4344
|
ids: { type: "array", items: { type: "string", format: "uuid" }, description: "Task IDs (for bulk deletion)" },
|
|
4345
|
+
task_code: { type: "string", description: "Task code (e.g. TASK-001). Optional if id is provided." },
|
|
4311
4346
|
structured: { type: "boolean", default: false, description: "If true, returns structured JSON result." }
|
|
4312
4347
|
},
|
|
4313
4348
|
required: ["repo"]
|
|
@@ -4317,6 +4352,7 @@ var TOOL_DEFINITIONS = [
|
|
|
4317
4352
|
properties: {
|
|
4318
4353
|
success: { type: "boolean" },
|
|
4319
4354
|
id: { type: "string" },
|
|
4355
|
+
task_code: { type: "string" },
|
|
4320
4356
|
ids: { type: "array", items: { type: "string" } },
|
|
4321
4357
|
repo: { type: "string" },
|
|
4322
4358
|
deletedCount: { type: "number" }
|
|
@@ -4762,7 +4798,8 @@ var TOOL_DEFINITIONS = [
|
|
|
4762
4798
|
inputSchema: {
|
|
4763
4799
|
type: "object",
|
|
4764
4800
|
properties: {
|
|
4765
|
-
id: { type: "string", description: "Standard ID to update" },
|
|
4801
|
+
id: { type: "string", format: "uuid", description: "Standard ID to update. Optional if code is provided." },
|
|
4802
|
+
code: { type: "string", maxLength: 20, description: "Short standard code. Optional if id is provided." },
|
|
4766
4803
|
name: { type: "string", minLength: 3, maxLength: 255 },
|
|
4767
4804
|
content: { type: "string", minLength: 10 },
|
|
4768
4805
|
parent_id: { type: "string", format: "uuid", nullable: true },
|
|
@@ -4777,8 +4814,7 @@ var TOOL_DEFINITIONS = [
|
|
|
4777
4814
|
agent: { type: "string" },
|
|
4778
4815
|
model: { type: "string" },
|
|
4779
4816
|
structured: { type: "boolean", default: false }
|
|
4780
|
-
}
|
|
4781
|
-
required: ["id"]
|
|
4817
|
+
}
|
|
4782
4818
|
},
|
|
4783
4819
|
outputSchema: {
|
|
4784
4820
|
type: "object",
|
package/dist/dashboard/server.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
createFileSink,
|
|
11
11
|
listResources,
|
|
12
12
|
logger
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-O4B6AFYU.js";
|
|
14
14
|
|
|
15
15
|
// src/dashboard/server.ts
|
|
16
16
|
import express from "express";
|
|
@@ -744,7 +744,9 @@ var TasksController = class {
|
|
|
744
744
|
toolArgs.est_tokens = existingTask.est_tokens || 0;
|
|
745
745
|
}
|
|
746
746
|
if (toolArgs.commit_id === void 0) {
|
|
747
|
-
|
|
747
|
+
if (existingTask.commit_id) {
|
|
748
|
+
toolArgs.commit_id = existingTask.commit_id;
|
|
749
|
+
}
|
|
748
750
|
}
|
|
749
751
|
if (toolArgs.changed_files === void 0) {
|
|
750
752
|
toolArgs.changed_files = existingTask.changed_files || [];
|
package/dist/mcp/server.js
CHANGED
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
toContextSlug,
|
|
58
58
|
updateSessionFromInitialize,
|
|
59
59
|
updateSessionRoots
|
|
60
|
-
} from "../chunk-
|
|
60
|
+
} from "../chunk-O4B6AFYU.js";
|
|
61
61
|
|
|
62
62
|
// src/mcp/server.ts
|
|
63
63
|
import readline from "readline";
|
|
@@ -416,9 +416,17 @@ function hasMetadataLikeTitle2(title) {
|
|
|
416
416
|
}
|
|
417
417
|
async function handleMemoryUpdate(params, db2, vectors2) {
|
|
418
418
|
const validated = MemoryUpdateSchema.parse(params);
|
|
419
|
-
|
|
419
|
+
let resolvedId = validated.id;
|
|
420
|
+
if (!resolvedId && validated.code) {
|
|
421
|
+
const byCode = db2.memories.getByCode(validated.code);
|
|
422
|
+
if (!byCode) throw new Error(`Memory not found: ${validated.code}`);
|
|
423
|
+
resolvedId = byCode.id;
|
|
424
|
+
} else if (!resolvedId) {
|
|
425
|
+
throw new Error("Either id or code must be provided");
|
|
426
|
+
}
|
|
427
|
+
const existing = db2.memories.getById(resolvedId);
|
|
420
428
|
if (!existing) {
|
|
421
|
-
throw new Error(`Memory not found: ${
|
|
429
|
+
throw new Error(`Memory not found: ${resolvedId}`);
|
|
422
430
|
}
|
|
423
431
|
const repoFilter = params?.repo || params?.scope?.repo;
|
|
424
432
|
if (repoFilter && repoFilter !== existing.scope.repo) {
|
|
@@ -444,20 +452,21 @@ async function handleMemoryUpdate(params, db2, vectors2) {
|
|
|
444
452
|
if (validated.metadata !== void 0) updates.metadata = validated.metadata;
|
|
445
453
|
if (validated.is_global !== void 0) updates.is_global = validated.is_global;
|
|
446
454
|
if (validated.completed_at !== void 0) updates.completed_at = validated.completed_at;
|
|
447
|
-
db2.memories.update(
|
|
455
|
+
db2.memories.update(resolvedId, updates);
|
|
448
456
|
if (validated.content !== void 0) {
|
|
449
|
-
await vectors2.upsert(
|
|
457
|
+
await vectors2.upsert(resolvedId, validated.content);
|
|
450
458
|
}
|
|
451
|
-
db2.actions.logAction("update", existing.scope.repo, { memoryId:
|
|
452
|
-
logger.info("[Tool] memory.update", { repo: existing.scope.repo, id:
|
|
459
|
+
db2.actions.logAction("update", existing.scope.repo, { memoryId: resolvedId, resultCount: 1 });
|
|
460
|
+
logger.info("[Tool] memory.update", { repo: existing.scope.repo, id: resolvedId, fields: Object.keys(updates) });
|
|
453
461
|
return createMcpResponse(
|
|
454
462
|
{
|
|
455
463
|
success: true,
|
|
456
|
-
id:
|
|
464
|
+
id: resolvedId,
|
|
465
|
+
code: existing.code,
|
|
457
466
|
repo: existing.scope.repo,
|
|
458
467
|
updatedFields: Object.keys(updates)
|
|
459
468
|
},
|
|
460
|
-
`Updated memory ${
|
|
469
|
+
`Updated memory ${resolvedId} in repo "${existing.scope.repo}". Fields: ${Object.keys(updates).join(", ") || "none"}.`,
|
|
461
470
|
{
|
|
462
471
|
structuredContentPathHint: "updatedFields",
|
|
463
472
|
includeSerializedStructuredContent: validated.structured
|
|
@@ -1306,11 +1315,19 @@ async function handleTaskUpdate(args, storage, vectors2) {
|
|
|
1306
1315
|
}
|
|
1307
1316
|
async function handleTaskDelete(args, storage) {
|
|
1308
1317
|
const validated = TaskDeleteSchema.parse(args);
|
|
1309
|
-
const { repo, id, ids } = validated;
|
|
1310
|
-
const
|
|
1311
|
-
if (
|
|
1312
|
-
|
|
1318
|
+
const { repo, id, ids, task_code } = validated;
|
|
1319
|
+
const resolvedIds = [];
|
|
1320
|
+
if (ids) resolvedIds.push(...ids);
|
|
1321
|
+
if (id) resolvedIds.push(id);
|
|
1322
|
+
if (task_code) {
|
|
1323
|
+
const task = storage.tasks.getTaskByCode(repo, task_code);
|
|
1324
|
+
if (!task) throw new Error(`Task not found: ${task_code}`);
|
|
1325
|
+
resolvedIds.push(task.id);
|
|
1313
1326
|
}
|
|
1327
|
+
if (resolvedIds.length === 0) {
|
|
1328
|
+
throw new Error("Either 'id', 'ids', or 'task_code' must be provided for deletion");
|
|
1329
|
+
}
|
|
1330
|
+
const targetIds = resolvedIds;
|
|
1314
1331
|
for (const targetId of targetIds) {
|
|
1315
1332
|
storage.tasks.deleteTask(targetId);
|
|
1316
1333
|
}
|
|
@@ -1561,11 +1578,26 @@ async function executeSamplingTool(toolName, rawInput, db2, vectors2) {
|
|
|
1561
1578
|
// src/mcp/tools/memory.delete.ts
|
|
1562
1579
|
async function handleMemoryDelete(params, db2, vectors2, onProgress) {
|
|
1563
1580
|
const validated = MemoryDeleteSchema.parse(params);
|
|
1564
|
-
const { id, ids, repo, structured } = validated;
|
|
1565
|
-
const
|
|
1566
|
-
if (
|
|
1567
|
-
|
|
1568
|
-
|
|
1581
|
+
const { id, ids, code, codes, repo, structured } = validated;
|
|
1582
|
+
const resolvedIds = [];
|
|
1583
|
+
if (ids) resolvedIds.push(...ids);
|
|
1584
|
+
if (id) resolvedIds.push(id);
|
|
1585
|
+
if (code) {
|
|
1586
|
+
const entry = db2.memories.getByCode(code);
|
|
1587
|
+
if (!entry) throw new Error(`Memory not found: ${code}`);
|
|
1588
|
+
resolvedIds.push(entry.id);
|
|
1589
|
+
}
|
|
1590
|
+
if (codes) {
|
|
1591
|
+
for (const c of codes) {
|
|
1592
|
+
const entry = db2.memories.getByCode(c);
|
|
1593
|
+
if (!entry) throw new Error(`Memory not found: ${c}`);
|
|
1594
|
+
resolvedIds.push(entry.id);
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
if (resolvedIds.length === 0) {
|
|
1598
|
+
throw new Error("Either 'id', 'ids', 'code', or 'codes' must be provided for deletion");
|
|
1599
|
+
}
|
|
1600
|
+
const targetIds = resolvedIds;
|
|
1569
1601
|
let deletedCount = 0;
|
|
1570
1602
|
const deletedCodes = [];
|
|
1571
1603
|
let lastRepo = repo || "unknown";
|
|
@@ -1611,9 +1643,17 @@ async function handleMemoryDelete(params, db2, vectors2, onProgress) {
|
|
|
1611
1643
|
// src/mcp/tools/memory.acknowledge.ts
|
|
1612
1644
|
async function handleMemoryAcknowledge(params, db2) {
|
|
1613
1645
|
const validated = MemoryAcknowledgeSchema.parse(params);
|
|
1614
|
-
|
|
1646
|
+
let memoryId = validated.memory_id;
|
|
1647
|
+
if (!memoryId && validated.code) {
|
|
1648
|
+
const byCode = db2.memories.getByCode(validated.code);
|
|
1649
|
+
if (!byCode) throw new Error(`Memory not found: ${validated.code}`);
|
|
1650
|
+
memoryId = byCode.id;
|
|
1651
|
+
} else if (!memoryId) {
|
|
1652
|
+
throw new Error("Either memory_id or code must be provided");
|
|
1653
|
+
}
|
|
1654
|
+
const memory = db2.memories.getById(memoryId);
|
|
1615
1655
|
if (!memory) {
|
|
1616
|
-
throw new Error(`Memory with ID ${
|
|
1656
|
+
throw new Error(`Memory with ID ${memoryId} not found.`);
|
|
1617
1657
|
}
|
|
1618
1658
|
if (validated.status === "used") {
|
|
1619
1659
|
db2.memories.incrementRecallCount(memory.id);
|
|
@@ -2252,9 +2292,17 @@ async function handleStandardSearch(params, db2, vectors2) {
|
|
|
2252
2292
|
// src/mcp/tools/standard.update.ts
|
|
2253
2293
|
async function handleStandardUpdate(params, db2, vectors2) {
|
|
2254
2294
|
const validated = StandardUpdateSchema.parse(params);
|
|
2255
|
-
|
|
2295
|
+
let resolvedId = validated.id;
|
|
2296
|
+
if (!resolvedId && validated.code) {
|
|
2297
|
+
const byCode = db2.standards.getByCode(validated.code);
|
|
2298
|
+
if (!byCode) throw new Error(`Coding standard not found: ${validated.code}`);
|
|
2299
|
+
resolvedId = byCode.id;
|
|
2300
|
+
} else if (!resolvedId) {
|
|
2301
|
+
throw new Error("Either id or code must be provided");
|
|
2302
|
+
}
|
|
2303
|
+
const existing = db2.standards.getById(resolvedId);
|
|
2256
2304
|
if (!existing) {
|
|
2257
|
-
throw new Error(`Coding standard not found: ${
|
|
2305
|
+
throw new Error(`Coding standard not found: ${resolvedId}`);
|
|
2258
2306
|
}
|
|
2259
2307
|
const updates = {};
|
|
2260
2308
|
if (validated.name !== void 0) updates.title = validated.name;
|
|
@@ -2270,26 +2318,27 @@ async function handleStandardUpdate(params, db2, vectors2) {
|
|
|
2270
2318
|
if (validated.metadata !== void 0) updates.metadata = validated.metadata;
|
|
2271
2319
|
if (validated.agent !== void 0) updates.agent = validated.agent;
|
|
2272
2320
|
if (validated.model !== void 0) updates.model = validated.model;
|
|
2273
|
-
db2.standards.update(
|
|
2321
|
+
db2.standards.update(resolvedId, updates);
|
|
2274
2322
|
const merged = {
|
|
2275
2323
|
...existing,
|
|
2276
2324
|
...updates,
|
|
2277
2325
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
2278
2326
|
};
|
|
2279
2327
|
if (validated.name !== void 0 || validated.content !== void 0 || validated.context !== void 0 || validated.version !== void 0 || validated.language !== void 0 || validated.stack !== void 0 || validated.tags !== void 0 || validated.metadata !== void 0) {
|
|
2280
|
-
await vectors2.upsert(
|
|
2328
|
+
await vectors2.upsert(resolvedId, buildStandardVectorText(merged), "standard");
|
|
2281
2329
|
}
|
|
2282
2330
|
logger.info("[Tool] standard.update - updated coding standard", {
|
|
2283
|
-
standardId:
|
|
2331
|
+
standardId: resolvedId,
|
|
2284
2332
|
fields: Object.keys(updates)
|
|
2285
2333
|
});
|
|
2286
2334
|
return createMcpResponse(
|
|
2287
2335
|
{
|
|
2288
2336
|
success: true,
|
|
2289
|
-
id:
|
|
2337
|
+
id: resolvedId,
|
|
2338
|
+
code: existing.code,
|
|
2290
2339
|
updatedFields: Object.keys(updates)
|
|
2291
2340
|
},
|
|
2292
|
-
`Updated coding standard ${
|
|
2341
|
+
`Updated coding standard ${resolvedId}. Fields: ${Object.keys(updates).join(", ") || "none"}.`,
|
|
2293
2342
|
{
|
|
2294
2343
|
structuredContentPathHint: "updatedFields",
|
|
2295
2344
|
includeSerializedStructuredContent: true
|
|
@@ -2334,11 +2383,26 @@ async function handleStandardDetail(args, storage) {
|
|
|
2334
2383
|
// src/mcp/tools/standard.delete.ts
|
|
2335
2384
|
async function handleStandardDelete(params, db2, vectors2) {
|
|
2336
2385
|
const validated = StandardDeleteSchema.parse(params);
|
|
2337
|
-
const { id, ids, repo, structured } = validated;
|
|
2338
|
-
const
|
|
2339
|
-
if (
|
|
2340
|
-
|
|
2341
|
-
|
|
2386
|
+
const { id, ids, code, codes, repo, structured } = validated;
|
|
2387
|
+
const resolvedIds = [];
|
|
2388
|
+
if (ids) resolvedIds.push(...ids);
|
|
2389
|
+
if (id) resolvedIds.push(id);
|
|
2390
|
+
if (code) {
|
|
2391
|
+
const entry = db2.standards.getByCode(code);
|
|
2392
|
+
if (!entry) throw new Error(`Coding standard not found: ${code}`);
|
|
2393
|
+
resolvedIds.push(entry.id);
|
|
2394
|
+
}
|
|
2395
|
+
if (codes) {
|
|
2396
|
+
for (const c of codes) {
|
|
2397
|
+
const entry = db2.standards.getByCode(c);
|
|
2398
|
+
if (!entry) throw new Error(`Coding standard not found: ${c}`);
|
|
2399
|
+
resolvedIds.push(entry.id);
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
if (resolvedIds.length === 0) {
|
|
2403
|
+
throw new Error("Either 'id', 'ids', 'code', or 'codes' must be provided for deletion");
|
|
2404
|
+
}
|
|
2405
|
+
const targetIds = resolvedIds;
|
|
2342
2406
|
let deletedCount = 0;
|
|
2343
2407
|
const deletedTitles = [];
|
|
2344
2408
|
let lastRepo = repo || "unknown";
|
|
@@ -94,7 +94,13 @@ agent: Task Executor
|
|
|
94
94
|
- **Link Dependencies**: Set parent task's `depends_on` to the new blocker-fix task (parent waits for fix before retry)
|
|
95
95
|
- **Skip Creation** (if external): Log that blocker is external, keep task status as `blocked`, no automatic task created.
|
|
96
96
|
|
|
97
|
-
11. **
|
|
97
|
+
11. **Loop**: Follow `~/.agents/AGENTS.md` → **CONTINUOUS EXECUTION MODE**:
|
|
98
|
+
- `task-list` (pending) → claim next
|
|
99
|
+
- If empty → promote backlog → loop
|
|
100
|
+
- If backlog empty → check stale in_progress → loop
|
|
101
|
+
- If stale empty → check handoff → loop
|
|
102
|
+
- **Only then → STOP**
|
|
103
|
+
- **Violation = incomplete execution**
|
|
98
104
|
|
|
99
105
|
## 3. BACKLOG MAINTENANCE
|
|
100
106
|
If active queue is empty:
|