@mrc2204/agent-smart-memo 5.0.0 → 5.0.1
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 +266 -144
- package/dist/commands/telegram-addproject-command.d.ts +33 -0
- package/dist/commands/telegram-addproject-command.d.ts.map +1 -0
- package/dist/commands/telegram-addproject-command.js +208 -0
- package/dist/commands/telegram-addproject-command.js.map +1 -0
- package/dist/core/contracts/adapter-contracts.d.ts +1 -1
- package/dist/core/contracts/adapter-contracts.d.ts.map +1 -1
- package/dist/core/usecases/default-memory-usecase-port.d.ts +33 -0
- package/dist/core/usecases/default-memory-usecase-port.d.ts.map +1 -1
- package/dist/core/usecases/default-memory-usecase-port.js +876 -0
- package/dist/core/usecases/default-memory-usecase-port.js.map +1 -1
- package/dist/db/slot-db.d.ts +293 -0
- package/dist/db/slot-db.d.ts.map +1 -1
- package/dist/db/slot-db.js +1272 -0
- package/dist/db/slot-db.js.map +1 -1
- package/dist/index.d.ts +537 -64
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +212 -90
- package/dist/index.js.map +1 -1
- package/dist/services/qdrant.d.ts.map +1 -1
- package/dist/services/qdrant.js +17 -0
- package/dist/services/qdrant.js.map +1 -1
- package/dist/tools/project-tools.d.ts +8 -0
- package/dist/tools/project-tools.d.ts.map +1 -0
- package/dist/tools/project-tools.js +649 -0
- package/dist/tools/project-tools.js.map +1 -0
- package/openclaw.plugin.json +22 -2
- package/package.json +1 -1
|
@@ -0,0 +1,649 @@
|
|
|
1
|
+
import { configureOpenClawRuntime, createOpenClawResult, getMemoryUseCasePortForContext, getSessionKey, parseOpenClawSessionIdentity, } from "../adapters/openclaw/tool-runtime.js";
|
|
2
|
+
function createResult(text, isError = false) {
|
|
3
|
+
return createOpenClawResult(text, isError);
|
|
4
|
+
}
|
|
5
|
+
export function registerProjectTools(api, options) {
|
|
6
|
+
configureOpenClawRuntime(options);
|
|
7
|
+
api.registerTool({
|
|
8
|
+
name: "project_registry_register",
|
|
9
|
+
label: "Project Registry Register",
|
|
10
|
+
description: "Register project identity lifecycle in ASM v5.1. Creates/updates project_id-centric registry, alias mapping, and registration state.",
|
|
11
|
+
parameters: {
|
|
12
|
+
type: "object",
|
|
13
|
+
properties: {
|
|
14
|
+
project_id: { type: "string", description: "Optional canonical project id. If omitted, system auto-generates." },
|
|
15
|
+
project_name: { type: "string", description: "Optional display name for project." },
|
|
16
|
+
project_alias: { type: "string", description: "Required human alias (unique within scope)." },
|
|
17
|
+
repo_root: { type: "string", description: "Optional repo root path." },
|
|
18
|
+
repo_remote: { type: "string", description: "Optional primary git remote URL." },
|
|
19
|
+
active_version: { type: "string", description: "Optional active architecture/runtime version." },
|
|
20
|
+
allow_alias_update: { type: "boolean", description: "Allow re-binding existing alias to another project_id." },
|
|
21
|
+
},
|
|
22
|
+
required: ["project_alias"],
|
|
23
|
+
},
|
|
24
|
+
async execute(_id, params, ctx) {
|
|
25
|
+
try {
|
|
26
|
+
const sessionKey = getSessionKey(ctx);
|
|
27
|
+
const { userId, agentId } = parseOpenClawSessionIdentity(sessionKey);
|
|
28
|
+
const useCasePort = getMemoryUseCasePortForContext(ctx);
|
|
29
|
+
const data = await useCasePort.run("project.register", {
|
|
30
|
+
context: { userId, agentId },
|
|
31
|
+
payload: params,
|
|
32
|
+
meta: {
|
|
33
|
+
source: "openclaw",
|
|
34
|
+
toolName: "project_registry_register",
|
|
35
|
+
requestId: _id,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
return createResult(JSON.stringify(data, null, 2));
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
return createResult(`Error: ${error instanceof Error ? error.message : String(error)}`, true);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
api.registerTool({
|
|
46
|
+
name: "project_registry_get",
|
|
47
|
+
label: "Project Registry Get",
|
|
48
|
+
description: "Get project registry record by project_id or project_alias.",
|
|
49
|
+
parameters: {
|
|
50
|
+
type: "object",
|
|
51
|
+
properties: {
|
|
52
|
+
project_id: { type: "string" },
|
|
53
|
+
project_alias: { type: "string" },
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
async execute(_id, params, ctx) {
|
|
57
|
+
try {
|
|
58
|
+
const sessionKey = getSessionKey(ctx);
|
|
59
|
+
const { userId, agentId } = parseOpenClawSessionIdentity(sessionKey);
|
|
60
|
+
const useCasePort = getMemoryUseCasePortForContext(ctx);
|
|
61
|
+
const data = await useCasePort.run("project.get", {
|
|
62
|
+
context: { userId, agentId },
|
|
63
|
+
payload: params,
|
|
64
|
+
meta: {
|
|
65
|
+
source: "openclaw",
|
|
66
|
+
toolName: "project_registry_get",
|
|
67
|
+
requestId: _id,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
if (!data) {
|
|
71
|
+
return createResult("No project registry record found.");
|
|
72
|
+
}
|
|
73
|
+
return createResult(JSON.stringify(data, null, 2));
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
return createResult(`Error: ${error instanceof Error ? error.message : String(error)}`, true);
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
api.registerTool({
|
|
81
|
+
name: "project_registry_list",
|
|
82
|
+
label: "Project Registry List",
|
|
83
|
+
description: "List all registered projects and registration states in current scope.",
|
|
84
|
+
parameters: {
|
|
85
|
+
type: "object",
|
|
86
|
+
properties: {},
|
|
87
|
+
},
|
|
88
|
+
async execute(_id, _params, ctx) {
|
|
89
|
+
try {
|
|
90
|
+
const sessionKey = getSessionKey(ctx);
|
|
91
|
+
const { userId, agentId } = parseOpenClawSessionIdentity(sessionKey);
|
|
92
|
+
const useCasePort = getMemoryUseCasePortForContext(ctx);
|
|
93
|
+
const data = await useCasePort.run("project.list", {
|
|
94
|
+
context: { userId, agentId },
|
|
95
|
+
payload: {},
|
|
96
|
+
meta: {
|
|
97
|
+
source: "openclaw",
|
|
98
|
+
toolName: "project_registry_list",
|
|
99
|
+
requestId: _id,
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
return createResult(JSON.stringify(data, null, 2));
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
return createResult(`Error: ${error instanceof Error ? error.message : String(error)}`, true);
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
api.registerTool({
|
|
110
|
+
name: "project_registration_state_set",
|
|
111
|
+
label: "Project Registration State Set",
|
|
112
|
+
description: "Update registration/validation state for a project registry identity.",
|
|
113
|
+
parameters: {
|
|
114
|
+
type: "object",
|
|
115
|
+
properties: {
|
|
116
|
+
project_id: { type: "string" },
|
|
117
|
+
registration_status: { type: "string", enum: ["draft", "registered", "validated", "blocked"] },
|
|
118
|
+
validation_status: { type: "string", enum: ["pending", "ok", "warn", "error"] },
|
|
119
|
+
validation_notes: { type: "string" },
|
|
120
|
+
completeness_score: { type: "number" },
|
|
121
|
+
missing_required_fields: { type: "array", items: { type: "string" } },
|
|
122
|
+
last_validated_at: { type: "string" },
|
|
123
|
+
},
|
|
124
|
+
required: [
|
|
125
|
+
"project_id",
|
|
126
|
+
"registration_status",
|
|
127
|
+
"validation_status",
|
|
128
|
+
"completeness_score",
|
|
129
|
+
"missing_required_fields",
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
async execute(_id, params, ctx) {
|
|
133
|
+
try {
|
|
134
|
+
const sessionKey = getSessionKey(ctx);
|
|
135
|
+
const { userId, agentId } = parseOpenClawSessionIdentity(sessionKey);
|
|
136
|
+
const useCasePort = getMemoryUseCasePortForContext(ctx);
|
|
137
|
+
const data = await useCasePort.run("project.set_registration_state", {
|
|
138
|
+
context: { userId, agentId },
|
|
139
|
+
payload: params,
|
|
140
|
+
meta: {
|
|
141
|
+
source: "openclaw",
|
|
142
|
+
toolName: "project_registration_state_set",
|
|
143
|
+
requestId: _id,
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
return createResult(JSON.stringify(data, null, 2));
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
return createResult(`Error: ${error instanceof Error ? error.message : String(error)}`, true);
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
api.registerTool({
|
|
154
|
+
name: "project_tracker_mapping_set",
|
|
155
|
+
label: "Project Tracker Mapping Set",
|
|
156
|
+
description: "Attach/update external tracker mapping (Jira/GitHub/other) for a registered project.",
|
|
157
|
+
parameters: {
|
|
158
|
+
type: "object",
|
|
159
|
+
properties: {
|
|
160
|
+
project_id: { type: "string" },
|
|
161
|
+
tracker_type: { type: "string", enum: ["jira", "github", "other"] },
|
|
162
|
+
tracker_space_key: { type: "string" },
|
|
163
|
+
tracker_project_id: { type: "string" },
|
|
164
|
+
default_epic_key: { type: "string" },
|
|
165
|
+
board_key: { type: "string" },
|
|
166
|
+
active_version: { type: "string" },
|
|
167
|
+
external_project_url: { type: "string" },
|
|
168
|
+
},
|
|
169
|
+
required: ["project_id", "tracker_type"],
|
|
170
|
+
},
|
|
171
|
+
async execute(_id, params, ctx) {
|
|
172
|
+
try {
|
|
173
|
+
const sessionKey = getSessionKey(ctx);
|
|
174
|
+
const { userId, agentId } = parseOpenClawSessionIdentity(sessionKey);
|
|
175
|
+
const useCasePort = getMemoryUseCasePortForContext(ctx);
|
|
176
|
+
const data = await useCasePort.run("project.set_tracker_mapping", {
|
|
177
|
+
context: { userId, agentId },
|
|
178
|
+
payload: params,
|
|
179
|
+
meta: {
|
|
180
|
+
source: "openclaw",
|
|
181
|
+
toolName: "project_tracker_mapping_set",
|
|
182
|
+
requestId: _id,
|
|
183
|
+
},
|
|
184
|
+
});
|
|
185
|
+
return createResult(JSON.stringify(data, null, 2));
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
return createResult(`Error: ${error instanceof Error ? error.message : String(error)}`, true);
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
api.registerTool({
|
|
193
|
+
name: "project_register_command",
|
|
194
|
+
label: "Project Register Command",
|
|
195
|
+
description: "Canonical ASM v5.1 add/register project command flow. Supports optional Jira mapping attach and optional initial index trigger.",
|
|
196
|
+
parameters: {
|
|
197
|
+
type: "object",
|
|
198
|
+
properties: {
|
|
199
|
+
project_alias: { type: "string" },
|
|
200
|
+
project_name: { type: "string" },
|
|
201
|
+
project_id: { type: "string" },
|
|
202
|
+
repo_root: { type: "string" },
|
|
203
|
+
repo_remote: { type: "string" },
|
|
204
|
+
active_version: { type: "string" },
|
|
205
|
+
tracker: {
|
|
206
|
+
type: "object",
|
|
207
|
+
properties: {
|
|
208
|
+
tracker_type: { type: "string", enum: ["jira", "github", "other"] },
|
|
209
|
+
tracker_space_key: { type: "string" },
|
|
210
|
+
tracker_project_id: { type: "string" },
|
|
211
|
+
default_epic_key: { type: "string" },
|
|
212
|
+
board_key: { type: "string" },
|
|
213
|
+
active_version: { type: "string" },
|
|
214
|
+
external_project_url: { type: "string" },
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
options: {
|
|
218
|
+
type: "object",
|
|
219
|
+
properties: {
|
|
220
|
+
trigger_index: { type: "boolean" },
|
|
221
|
+
allow_alias_update: { type: "boolean" },
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
required: ["project_alias"],
|
|
226
|
+
},
|
|
227
|
+
async execute(_id, params, ctx) {
|
|
228
|
+
try {
|
|
229
|
+
const sessionKey = getSessionKey(ctx);
|
|
230
|
+
const { userId, agentId } = parseOpenClawSessionIdentity(sessionKey);
|
|
231
|
+
const useCasePort = getMemoryUseCasePortForContext(ctx);
|
|
232
|
+
const data = await useCasePort.run("project.register_command", {
|
|
233
|
+
context: { userId, agentId },
|
|
234
|
+
payload: params,
|
|
235
|
+
meta: {
|
|
236
|
+
source: "openclaw",
|
|
237
|
+
toolName: "project_register_command",
|
|
238
|
+
requestId: _id,
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
return createResult(JSON.stringify(data, null, 2));
|
|
242
|
+
}
|
|
243
|
+
catch (error) {
|
|
244
|
+
return createResult(`Error: ${error instanceof Error ? error.message : String(error)}`, true);
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
});
|
|
248
|
+
api.registerTool({
|
|
249
|
+
name: "project_link_tracker",
|
|
250
|
+
label: "Project Link Tracker",
|
|
251
|
+
description: "Canonical ASM v5.1 link jira/tracker command flow by project_id or project_alias.",
|
|
252
|
+
parameters: {
|
|
253
|
+
type: "object",
|
|
254
|
+
properties: {
|
|
255
|
+
project_ref: {
|
|
256
|
+
type: "object",
|
|
257
|
+
properties: {
|
|
258
|
+
project_id: { type: "string" },
|
|
259
|
+
project_alias: { type: "string" },
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
tracker: {
|
|
263
|
+
type: "object",
|
|
264
|
+
properties: {
|
|
265
|
+
tracker_type: { type: "string", enum: ["jira", "github", "other"] },
|
|
266
|
+
tracker_space_key: { type: "string" },
|
|
267
|
+
tracker_project_id: { type: "string" },
|
|
268
|
+
default_epic_key: { type: "string" },
|
|
269
|
+
board_key: { type: "string" },
|
|
270
|
+
active_version: { type: "string" },
|
|
271
|
+
external_project_url: { type: "string" },
|
|
272
|
+
},
|
|
273
|
+
required: ["tracker_type"],
|
|
274
|
+
},
|
|
275
|
+
mode: { type: "string", enum: ["attach_or_update"] },
|
|
276
|
+
},
|
|
277
|
+
required: ["project_ref", "tracker"],
|
|
278
|
+
},
|
|
279
|
+
async execute(_id, params, ctx) {
|
|
280
|
+
try {
|
|
281
|
+
const sessionKey = getSessionKey(ctx);
|
|
282
|
+
const { userId, agentId } = parseOpenClawSessionIdentity(sessionKey);
|
|
283
|
+
const useCasePort = getMemoryUseCasePortForContext(ctx);
|
|
284
|
+
const data = await useCasePort.run("project.link_tracker", {
|
|
285
|
+
context: { userId, agentId },
|
|
286
|
+
payload: params,
|
|
287
|
+
meta: {
|
|
288
|
+
source: "openclaw",
|
|
289
|
+
toolName: "project_link_tracker",
|
|
290
|
+
requestId: _id,
|
|
291
|
+
},
|
|
292
|
+
});
|
|
293
|
+
return createResult(JSON.stringify(data, null, 2));
|
|
294
|
+
}
|
|
295
|
+
catch (error) {
|
|
296
|
+
return createResult(`Error: ${error instanceof Error ? error.message : String(error)}`, true);
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
});
|
|
300
|
+
api.registerTool({
|
|
301
|
+
name: "project_trigger_index",
|
|
302
|
+
label: "Project Trigger Index",
|
|
303
|
+
description: "Canonical ASM v5.1 index project/index now command flow after registration/linking.",
|
|
304
|
+
parameters: {
|
|
305
|
+
type: "object",
|
|
306
|
+
properties: {
|
|
307
|
+
project_ref: {
|
|
308
|
+
type: "object",
|
|
309
|
+
properties: {
|
|
310
|
+
project_id: { type: "string" },
|
|
311
|
+
project_alias: { type: "string" },
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
mode: { type: "string", enum: ["bootstrap", "incremental", "manual", "repair"] },
|
|
315
|
+
scope: {
|
|
316
|
+
type: "object",
|
|
317
|
+
properties: {
|
|
318
|
+
path_prefix: { type: "array", items: { type: "string" } },
|
|
319
|
+
module: { type: "array", items: { type: "string" } },
|
|
320
|
+
task_id: { type: "array", items: { type: "string" } },
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
reason: { type: "string" },
|
|
324
|
+
source_rev: { type: "string" },
|
|
325
|
+
index_profile: { type: "string" },
|
|
326
|
+
paths: {
|
|
327
|
+
type: "array",
|
|
328
|
+
items: {
|
|
329
|
+
type: "object",
|
|
330
|
+
properties: {
|
|
331
|
+
relative_path: { type: "string" },
|
|
332
|
+
checksum: { type: "string" },
|
|
333
|
+
module: { type: "string" },
|
|
334
|
+
language: { type: "string" },
|
|
335
|
+
},
|
|
336
|
+
required: ["relative_path"],
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
required: ["project_ref"],
|
|
341
|
+
},
|
|
342
|
+
async execute(_id, params, ctx) {
|
|
343
|
+
try {
|
|
344
|
+
const sessionKey = getSessionKey(ctx);
|
|
345
|
+
const { userId, agentId } = parseOpenClawSessionIdentity(sessionKey);
|
|
346
|
+
const useCasePort = getMemoryUseCasePortForContext(ctx);
|
|
347
|
+
const data = await useCasePort.run("project.trigger_index", {
|
|
348
|
+
context: { userId, agentId },
|
|
349
|
+
payload: params,
|
|
350
|
+
meta: {
|
|
351
|
+
source: "openclaw",
|
|
352
|
+
toolName: "project_trigger_index",
|
|
353
|
+
requestId: _id,
|
|
354
|
+
},
|
|
355
|
+
});
|
|
356
|
+
return createResult(JSON.stringify(data, null, 2));
|
|
357
|
+
}
|
|
358
|
+
catch (error) {
|
|
359
|
+
return createResult(`Error: ${error instanceof Error ? error.message : String(error)}`, true);
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
});
|
|
363
|
+
api.registerTool({
|
|
364
|
+
name: "project_telegram_onboarding",
|
|
365
|
+
label: "Project Telegram Onboarding",
|
|
366
|
+
description: "Operator-facing Telegram onboarding helper for project registration + Jira mapping + optional index-now. Preview/confirm flow that bridges to ASM-80 command layer.",
|
|
367
|
+
parameters: {
|
|
368
|
+
type: "object",
|
|
369
|
+
properties: {
|
|
370
|
+
command: { type: "string", description: "Slash command trigger, e.g. /project" },
|
|
371
|
+
repo_url: { type: "string", description: "Repo URL/import source from Telegram step." },
|
|
372
|
+
project_alias: { type: "string", description: "Operator-confirmed project alias." },
|
|
373
|
+
jira_space_key: { type: "string", description: "Jira space key (uppercase format)." },
|
|
374
|
+
default_epic_key: { type: "string", description: "Default epic key, must match <SPACE>-* when provided." },
|
|
375
|
+
index_now: { type: "boolean", description: "Whether to trigger index immediately after confirm." },
|
|
376
|
+
project_name: { type: "string", description: "Optional project display name." },
|
|
377
|
+
repo_root: { type: "string", description: "Optional resolved repo root." },
|
|
378
|
+
active_version: { type: "string", description: "Optional active version." },
|
|
379
|
+
mode: { type: "string", enum: ["preview", "confirm"], description: "preview validates and returns confirm card; confirm executes." },
|
|
380
|
+
},
|
|
381
|
+
},
|
|
382
|
+
async execute(_id, params, ctx) {
|
|
383
|
+
try {
|
|
384
|
+
const sessionKey = getSessionKey(ctx);
|
|
385
|
+
const { userId, agentId } = parseOpenClawSessionIdentity(sessionKey);
|
|
386
|
+
const useCasePort = getMemoryUseCasePortForContext(ctx);
|
|
387
|
+
const data = await useCasePort.run("project.telegram_onboarding", {
|
|
388
|
+
context: { userId, agentId },
|
|
389
|
+
payload: params,
|
|
390
|
+
meta: {
|
|
391
|
+
source: "openclaw",
|
|
392
|
+
toolName: "project_telegram_onboarding",
|
|
393
|
+
requestId: _id,
|
|
394
|
+
},
|
|
395
|
+
});
|
|
396
|
+
return createResult(JSON.stringify(data, null, 2));
|
|
397
|
+
}
|
|
398
|
+
catch (error) {
|
|
399
|
+
return createResult(`Error: ${error instanceof Error ? error.message : String(error)}`, true);
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
});
|
|
403
|
+
api.registerTool({
|
|
404
|
+
name: "project_reindex_diff",
|
|
405
|
+
label: "Project Reindex Diff",
|
|
406
|
+
description: "Run incremental reindex by diff/checksum and update watch state. Tracks changed/unchanged/deleted paths and updates index run lifecycle.",
|
|
407
|
+
parameters: {
|
|
408
|
+
type: "object",
|
|
409
|
+
properties: {
|
|
410
|
+
project_id: { type: "string" },
|
|
411
|
+
source_rev: { type: "string" },
|
|
412
|
+
trigger_type: { type: "string", enum: ["bootstrap", "incremental", "manual", "repair"] },
|
|
413
|
+
index_profile: { type: "string" },
|
|
414
|
+
paths: {
|
|
415
|
+
type: "array",
|
|
416
|
+
items: {
|
|
417
|
+
type: "object",
|
|
418
|
+
properties: {
|
|
419
|
+
relative_path: { type: "string" },
|
|
420
|
+
checksum: { type: "string" },
|
|
421
|
+
module: { type: "string" },
|
|
422
|
+
language: { type: "string" },
|
|
423
|
+
},
|
|
424
|
+
required: ["relative_path"],
|
|
425
|
+
},
|
|
426
|
+
},
|
|
427
|
+
},
|
|
428
|
+
required: ["project_id", "paths"],
|
|
429
|
+
},
|
|
430
|
+
async execute(_id, params, ctx) {
|
|
431
|
+
try {
|
|
432
|
+
const sessionKey = getSessionKey(ctx);
|
|
433
|
+
const { userId, agentId } = parseOpenClawSessionIdentity(sessionKey);
|
|
434
|
+
const useCasePort = getMemoryUseCasePortForContext(ctx);
|
|
435
|
+
const data = await useCasePort.run("project.reindex_diff", {
|
|
436
|
+
context: { userId, agentId },
|
|
437
|
+
payload: params,
|
|
438
|
+
meta: {
|
|
439
|
+
source: "openclaw",
|
|
440
|
+
toolName: "project_reindex_diff",
|
|
441
|
+
requestId: _id,
|
|
442
|
+
},
|
|
443
|
+
});
|
|
444
|
+
return createResult(JSON.stringify(data, null, 2));
|
|
445
|
+
}
|
|
446
|
+
catch (error) {
|
|
447
|
+
return createResult(`Error: ${error instanceof Error ? error.message : String(error)}`, true);
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
});
|
|
451
|
+
api.registerTool({
|
|
452
|
+
name: "project_index_watch_get",
|
|
453
|
+
label: "Project Index Watch Get",
|
|
454
|
+
description: "Get current project index watch-state snapshot (last source rev + checksum map).",
|
|
455
|
+
parameters: {
|
|
456
|
+
type: "object",
|
|
457
|
+
properties: {
|
|
458
|
+
project_id: { type: "string" },
|
|
459
|
+
},
|
|
460
|
+
required: ["project_id"],
|
|
461
|
+
},
|
|
462
|
+
async execute(_id, params, ctx) {
|
|
463
|
+
try {
|
|
464
|
+
const sessionKey = getSessionKey(ctx);
|
|
465
|
+
const { userId, agentId } = parseOpenClawSessionIdentity(sessionKey);
|
|
466
|
+
const useCasePort = getMemoryUseCasePortForContext(ctx);
|
|
467
|
+
const data = await useCasePort.run("project.index_watch_get", {
|
|
468
|
+
context: { userId, agentId },
|
|
469
|
+
payload: params,
|
|
470
|
+
meta: {
|
|
471
|
+
source: "openclaw",
|
|
472
|
+
toolName: "project_index_watch_get",
|
|
473
|
+
requestId: _id,
|
|
474
|
+
},
|
|
475
|
+
});
|
|
476
|
+
return createResult(JSON.stringify(data, null, 2));
|
|
477
|
+
}
|
|
478
|
+
catch (error) {
|
|
479
|
+
return createResult(`Error: ${error instanceof Error ? error.message : String(error)}`, true);
|
|
480
|
+
}
|
|
481
|
+
},
|
|
482
|
+
});
|
|
483
|
+
api.registerTool({
|
|
484
|
+
name: "project_legacy_backfill",
|
|
485
|
+
label: "Project Legacy Backfill",
|
|
486
|
+
description: "Run legacy compatibility migration/backfill for indexed-but-unregistered projects: alias/tracker inference, registration state normalization, migration_state upsert.",
|
|
487
|
+
parameters: {
|
|
488
|
+
type: "object",
|
|
489
|
+
properties: {
|
|
490
|
+
mode: { type: "string", enum: ["dry_run", "apply"] },
|
|
491
|
+
only_project_ids: { type: "array", items: { type: "string" } },
|
|
492
|
+
only_aliases: { type: "array", items: { type: "string" } },
|
|
493
|
+
force_registration_state: { type: "boolean" },
|
|
494
|
+
source: { type: "string", enum: ["repo_root", "repo_remote", "task_registry", "mixed"] },
|
|
495
|
+
},
|
|
496
|
+
},
|
|
497
|
+
async execute(_id, params, ctx) {
|
|
498
|
+
try {
|
|
499
|
+
const sessionKey = getSessionKey(ctx);
|
|
500
|
+
const { userId, agentId } = parseOpenClawSessionIdentity(sessionKey);
|
|
501
|
+
const useCasePort = getMemoryUseCasePortForContext(ctx);
|
|
502
|
+
const data = await useCasePort.run("project.legacy_backfill", {
|
|
503
|
+
context: { userId, agentId },
|
|
504
|
+
payload: params,
|
|
505
|
+
meta: {
|
|
506
|
+
source: "openclaw",
|
|
507
|
+
toolName: "project_legacy_backfill",
|
|
508
|
+
requestId: _id,
|
|
509
|
+
},
|
|
510
|
+
});
|
|
511
|
+
return createResult(JSON.stringify(data, null, 2));
|
|
512
|
+
}
|
|
513
|
+
catch (error) {
|
|
514
|
+
return createResult(`Error: ${error instanceof Error ? error.message : String(error)}`, true);
|
|
515
|
+
}
|
|
516
|
+
},
|
|
517
|
+
});
|
|
518
|
+
api.registerTool({
|
|
519
|
+
name: "project_task_registry_upsert",
|
|
520
|
+
label: "Project Task Registry Upsert",
|
|
521
|
+
description: "Upsert task-lineage metadata for a project task (parent/related links, touched files/symbols, decisions, tracker key).",
|
|
522
|
+
parameters: {
|
|
523
|
+
type: "object",
|
|
524
|
+
properties: {
|
|
525
|
+
task_id: { type: "string" },
|
|
526
|
+
project_id: { type: "string" },
|
|
527
|
+
task_title: { type: "string" },
|
|
528
|
+
task_type: { type: "string" },
|
|
529
|
+
task_status: { type: "string" },
|
|
530
|
+
parent_task_id: { type: "string" },
|
|
531
|
+
related_task_ids: { type: "array", items: { type: "string" } },
|
|
532
|
+
files_touched: { type: "array", items: { type: "string" } },
|
|
533
|
+
symbols_touched: { type: "array", items: { type: "string" } },
|
|
534
|
+
commit_refs: { type: "array", items: { type: "string" } },
|
|
535
|
+
diff_refs: { type: "array", items: { type: "string" } },
|
|
536
|
+
decision_notes: { type: "string" },
|
|
537
|
+
tracker_issue_key: { type: "string" },
|
|
538
|
+
},
|
|
539
|
+
required: ["task_id", "project_id", "task_title"],
|
|
540
|
+
},
|
|
541
|
+
async execute(_id, params, ctx) {
|
|
542
|
+
try {
|
|
543
|
+
const sessionKey = getSessionKey(ctx);
|
|
544
|
+
const { userId, agentId } = parseOpenClawSessionIdentity(sessionKey);
|
|
545
|
+
const useCasePort = getMemoryUseCasePortForContext(ctx);
|
|
546
|
+
const data = await useCasePort.run("project.task_registry_upsert", {
|
|
547
|
+
context: { userId, agentId },
|
|
548
|
+
payload: params,
|
|
549
|
+
meta: {
|
|
550
|
+
source: "openclaw",
|
|
551
|
+
toolName: "project_task_registry_upsert",
|
|
552
|
+
requestId: _id,
|
|
553
|
+
},
|
|
554
|
+
});
|
|
555
|
+
return createResult(JSON.stringify(data, null, 2));
|
|
556
|
+
}
|
|
557
|
+
catch (error) {
|
|
558
|
+
return createResult(`Error: ${error instanceof Error ? error.message : String(error)}`, true);
|
|
559
|
+
}
|
|
560
|
+
},
|
|
561
|
+
});
|
|
562
|
+
api.registerTool({
|
|
563
|
+
name: "project_task_lineage_context",
|
|
564
|
+
label: "Project Task Lineage Context",
|
|
565
|
+
description: "Assemble compact task-lineage context (focus task, parent chain, related tasks, touched files/symbols, commit refs, decisions).",
|
|
566
|
+
parameters: {
|
|
567
|
+
type: "object",
|
|
568
|
+
properties: {
|
|
569
|
+
project_id: { type: "string" },
|
|
570
|
+
task_id: { type: "string" },
|
|
571
|
+
tracker_issue_key: { type: "string" },
|
|
572
|
+
task_title: { type: "string" },
|
|
573
|
+
include_related: { type: "boolean" },
|
|
574
|
+
include_parent_chain: { type: "boolean" },
|
|
575
|
+
},
|
|
576
|
+
required: ["project_id"],
|
|
577
|
+
},
|
|
578
|
+
async execute(_id, params, ctx) {
|
|
579
|
+
try {
|
|
580
|
+
const sessionKey = getSessionKey(ctx);
|
|
581
|
+
const { userId, agentId } = parseOpenClawSessionIdentity(sessionKey);
|
|
582
|
+
const useCasePort = getMemoryUseCasePortForContext(ctx);
|
|
583
|
+
const data = await useCasePort.run("project.task_lineage_context", {
|
|
584
|
+
context: { userId, agentId },
|
|
585
|
+
payload: params,
|
|
586
|
+
meta: {
|
|
587
|
+
source: "openclaw",
|
|
588
|
+
toolName: "project_task_lineage_context",
|
|
589
|
+
requestId: _id,
|
|
590
|
+
},
|
|
591
|
+
});
|
|
592
|
+
return createResult(JSON.stringify(data, null, 2));
|
|
593
|
+
}
|
|
594
|
+
catch (error) {
|
|
595
|
+
return createResult(`Error: ${error instanceof Error ? error.message : String(error)}`, true);
|
|
596
|
+
}
|
|
597
|
+
},
|
|
598
|
+
});
|
|
599
|
+
api.registerTool({
|
|
600
|
+
name: "project_hybrid_search",
|
|
601
|
+
label: "Project Hybrid Search",
|
|
602
|
+
description: "Hybrid retrieval over file/symbol/task registries with optional task-lineage context assembly and project/task filters.",
|
|
603
|
+
parameters: {
|
|
604
|
+
type: "object",
|
|
605
|
+
properties: {
|
|
606
|
+
project_id: { type: "string" },
|
|
607
|
+
query: { type: "string" },
|
|
608
|
+
limit: { type: "number" },
|
|
609
|
+
path_prefix: { type: "array", items: { type: "string" } },
|
|
610
|
+
module: { type: "array", items: { type: "string" } },
|
|
611
|
+
language: { type: "array", items: { type: "string" } },
|
|
612
|
+
task_id: { type: "array", items: { type: "string" } },
|
|
613
|
+
tracker_issue_key: { type: "array", items: { type: "string" } },
|
|
614
|
+
task_context: {
|
|
615
|
+
type: "object",
|
|
616
|
+
properties: {
|
|
617
|
+
task_id: { type: "string" },
|
|
618
|
+
tracker_issue_key: { type: "string" },
|
|
619
|
+
task_title: { type: "string" },
|
|
620
|
+
include_related: { type: "boolean" },
|
|
621
|
+
include_parent_chain: { type: "boolean" },
|
|
622
|
+
},
|
|
623
|
+
},
|
|
624
|
+
},
|
|
625
|
+
required: ["project_id", "query"],
|
|
626
|
+
},
|
|
627
|
+
async execute(_id, params, ctx) {
|
|
628
|
+
try {
|
|
629
|
+
const sessionKey = getSessionKey(ctx);
|
|
630
|
+
const { userId, agentId } = parseOpenClawSessionIdentity(sessionKey);
|
|
631
|
+
const useCasePort = getMemoryUseCasePortForContext(ctx);
|
|
632
|
+
const data = await useCasePort.run("project.hybrid_search", {
|
|
633
|
+
context: { userId, agentId },
|
|
634
|
+
payload: params,
|
|
635
|
+
meta: {
|
|
636
|
+
source: "openclaw",
|
|
637
|
+
toolName: "project_hybrid_search",
|
|
638
|
+
requestId: _id,
|
|
639
|
+
},
|
|
640
|
+
});
|
|
641
|
+
return createResult(JSON.stringify(data, null, 2));
|
|
642
|
+
}
|
|
643
|
+
catch (error) {
|
|
644
|
+
return createResult(`Error: ${error instanceof Error ? error.message : String(error)}`, true);
|
|
645
|
+
}
|
|
646
|
+
},
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
//# sourceMappingURL=project-tools.js.map
|