u-foo 2.2.4 → 2.3.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/SKILLS/ufoo/SKILL.md +56 -12
- package/SKILLS/uinit/SKILL.md +3 -2
- package/modules/AGENTS.template.md +2 -1
- package/modules/bus/README.md +1 -1
- package/modules/context/SKILLS/uctx/SKILL.md +6 -4
- package/package.json +1 -1
- package/src/agent/codexThreadProvider.js +2 -2
- package/src/agent/controllerToolExecutor.js +24 -1
- package/src/agent/credentials/claude.js +85 -16
- package/src/agent/credentials/codex.js +251 -23
- package/src/agent/defaultBootstrap.js +3 -1
- package/src/agent/directAuthStatus.js +264 -0
- package/src/agent/internalRunner.js +18 -12
- package/src/agent/loopObservability.js +10 -0
- package/src/agent/loopRuntime.js +19 -0
- package/src/agent/ufooAgent.js +43 -13
- package/src/agent/upstreamTransport.js +23 -8
- package/src/bus/index.js +6 -1
- package/src/bus/message.js +156 -8
- package/src/chat/commandExecutor.js +187 -7
- package/src/chat/commands.js +23 -4
- package/src/chat/completionController.js +30 -7
- package/src/chat/index.js +3 -5
- package/src/cli/groupCoreCommands.js +5 -0
- package/src/cli.js +309 -0
- package/src/code/UCODE_PROMPT.md +3 -2
- package/src/code/prompts/ufoo.js +3 -2
- package/src/config.js +16 -3
- package/src/context/doctor.js +1 -1
- package/src/daemon/groupOrchestrator.js +13 -9
- package/src/daemon/promptRequest.js +11 -2
- package/src/daemon/soloBootstrap.js +2 -0
- package/src/group/bootstrap.js +1 -1
- package/src/group/promptProfiles.js +106 -22
- package/src/group/templates.js +1 -0
- package/src/init/index.js +4 -0
- package/src/memory/historySearch.js +308 -0
- package/src/memory/index.js +653 -8
- package/src/providerapi/redactor.js +4 -1
- package/src/status/index.js +24 -1
- package/src/tools/handlers/memory.js +168 -0
- package/src/tools/index.js +12 -0
- package/src/tools/registry.js +12 -0
- package/src/tools/schemaFixtures.js +213 -0
- package/src/tools/tier1/editMemory.js +14 -0
- package/src/tools/tier1/forget.js +14 -0
- package/src/tools/tier1/recall.js +14 -0
- package/src/tools/tier1/remember.js +14 -0
- package/src/tools/tier1/searchHistory.js +14 -0
- package/src/tools/tier1/searchMemory.js +14 -0
- package/templates/groups/build-lane.json +44 -6
- package/templates/groups/build-ultra.json +6 -5
- package/templates/groups/design-system.json +84 -0
- package/templates/groups/product-discovery.json +9 -4
- package/templates/groups/ui-plan-review.json +84 -0
- package/templates/groups/ui-polish.json +6 -2
- package/templates/groups/verify-ship.json +9 -4
package/src/status/index.js
CHANGED
|
@@ -4,6 +4,10 @@ const childProcess = require("child_process");
|
|
|
4
4
|
const { readJSON } = require("../bus/utils");
|
|
5
5
|
const { getUfooPaths } = require("../ufoo/paths");
|
|
6
6
|
const { resolveDisplayNickname } = require("../daemon/nicknameScope");
|
|
7
|
+
const {
|
|
8
|
+
inspectDirectAuthStatus,
|
|
9
|
+
formatDirectAuthStatus,
|
|
10
|
+
} = require("../agent/directAuthStatus");
|
|
7
11
|
|
|
8
12
|
function normalizeTty(ttyPath) {
|
|
9
13
|
if (!ttyPath) return "";
|
|
@@ -52,10 +56,16 @@ function detectCurrentTty() {
|
|
|
52
56
|
* 显示项目状态
|
|
53
57
|
*/
|
|
54
58
|
class StatusDisplay {
|
|
55
|
-
constructor(projectRoot) {
|
|
59
|
+
constructor(projectRoot, options = {}) {
|
|
56
60
|
this.projectRoot = projectRoot;
|
|
57
61
|
this.paths = getUfooPaths(projectRoot);
|
|
58
62
|
this.ufooDir = this.paths.ufooDir;
|
|
63
|
+
this.inspectDirectAuthStatus = options.inspectDirectAuthStatus
|
|
64
|
+
|| options.inspectCodexDirectAuth
|
|
65
|
+
|| inspectDirectAuthStatus;
|
|
66
|
+
this.formatDirectAuthStatus = options.formatDirectAuthStatus
|
|
67
|
+
|| options.formatCodexDirectAuthStatus
|
|
68
|
+
|| formatDirectAuthStatus;
|
|
59
69
|
}
|
|
60
70
|
|
|
61
71
|
/**
|
|
@@ -249,6 +259,16 @@ class StatusDisplay {
|
|
|
249
259
|
}
|
|
250
260
|
}
|
|
251
261
|
|
|
262
|
+
async showDirectApiStatus() {
|
|
263
|
+
const status = await this.inspectDirectAuthStatus({
|
|
264
|
+
projectRoot: this.projectRoot,
|
|
265
|
+
autoRefresh: false,
|
|
266
|
+
});
|
|
267
|
+
for (const line of this.formatDirectAuthStatus(status)) {
|
|
268
|
+
console.log(line);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
252
272
|
/**
|
|
253
273
|
* 显示完整状态
|
|
254
274
|
*/
|
|
@@ -263,6 +283,9 @@ class StatusDisplay {
|
|
|
263
283
|
// 显示项目路径
|
|
264
284
|
console.log(`Project: ${this.projectRoot}`);
|
|
265
285
|
|
|
286
|
+
// 显示直连 API 凭证状态
|
|
287
|
+
await this.showDirectApiStatus();
|
|
288
|
+
|
|
266
289
|
// 显示未读消息
|
|
267
290
|
const unread = this.countUnreadMessages();
|
|
268
291
|
console.log(`Unread messages: ${unread.total}`);
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
const MemoryManager = require("../../memory");
|
|
2
|
+
const { estimateTokens } = require("../../memory");
|
|
3
|
+
const { searchHistory } = require("../../memory/historySearch");
|
|
4
|
+
const { buildToolError, extractAuditFields, requireSubscriber } = require("./common");
|
|
5
|
+
|
|
6
|
+
const BANNED_TIME_PATTERNS = [
|
|
7
|
+
/\bjust decided\b/i,
|
|
8
|
+
/\bjust now\b/i,
|
|
9
|
+
/\btoday\b/i,
|
|
10
|
+
/\bcurrent\b/i,
|
|
11
|
+
/现在/,
|
|
12
|
+
/今天/,
|
|
13
|
+
/本月/,
|
|
14
|
+
/最近/,
|
|
15
|
+
/正在/,
|
|
16
|
+
/刚才/,
|
|
17
|
+
/本\s*sprint/i,
|
|
18
|
+
/本阶段/,
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
function getMemoryManager(ctx = {}) {
|
|
22
|
+
return ctx.memoryManager || new MemoryManager(ctx.projectRoot);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function normalizeTags(value = []) {
|
|
26
|
+
return Array.isArray(value)
|
|
27
|
+
? value.map((item) => String(item || "").trim()).filter(Boolean)
|
|
28
|
+
: String(value || "").split(",").map((item) => item.trim()).filter(Boolean);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function extractMemoryEvidence(args = {}) {
|
|
32
|
+
const evidence = {};
|
|
33
|
+
if (args.history_session_id) evidence.history_session_id = String(args.history_session_id);
|
|
34
|
+
if (args.history_offset) evidence.history_offset = String(args.history_offset);
|
|
35
|
+
if (Array.isArray(args.recall_ids)) {
|
|
36
|
+
evidence.recall_ids = args.recall_ids.map((id) => String(id || "").trim()).filter(Boolean);
|
|
37
|
+
}
|
|
38
|
+
return evidence;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function assertAgentWriteQuality(args = {}, fields = ["title", "body"]) {
|
|
42
|
+
const title = String(args.title || "").trim();
|
|
43
|
+
const body = String(args.body || "").trim();
|
|
44
|
+
if (fields.includes("body")) {
|
|
45
|
+
if (body.length < 20 || body.length > 2000) {
|
|
46
|
+
throw buildToolError(
|
|
47
|
+
"invalid_memory_body",
|
|
48
|
+
"memory body must be between 20 and 2000 characters"
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const combined = `${title}\n${body}`;
|
|
53
|
+
if (BANNED_TIME_PATTERNS.some((pattern) => pattern.test(combined))) {
|
|
54
|
+
throw buildToolError(
|
|
55
|
+
"memory_not_durable",
|
|
56
|
+
"memory text contains time-relative wording; record durable facts only"
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function rememberHandler(ctx = {}, args = {}) {
|
|
62
|
+
const subscriber = requireSubscriber(ctx);
|
|
63
|
+
assertAgentWriteQuality(args);
|
|
64
|
+
const manager = getMemoryManager(ctx);
|
|
65
|
+
const entry = manager.add({
|
|
66
|
+
title: args.title,
|
|
67
|
+
body: args.body,
|
|
68
|
+
tags: normalizeTags(args.tags),
|
|
69
|
+
source: `agent:${subscriber}`,
|
|
70
|
+
}, {
|
|
71
|
+
source: "tool",
|
|
72
|
+
actor: subscriber,
|
|
73
|
+
...extractAuditFields(ctx),
|
|
74
|
+
...extractMemoryEvidence(args),
|
|
75
|
+
});
|
|
76
|
+
return { ok: true, entry };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function recallHandler(ctx = {}, args = {}) {
|
|
80
|
+
const manager = getMemoryManager(ctx);
|
|
81
|
+
if (args.id) {
|
|
82
|
+
const entries = [manager.get(args.id, { includeArchived: args.include_archived === true })];
|
|
83
|
+
return { ok: true, count: 1, entries, dynamic_memory_tokens: estimateTokens(JSON.stringify(entries)) };
|
|
84
|
+
}
|
|
85
|
+
const tags = normalizeTags(args.tags);
|
|
86
|
+
const limit = Number.isFinite(Number(args.limit)) && Number(args.limit) > 0
|
|
87
|
+
? Math.floor(Number(args.limit))
|
|
88
|
+
: 10;
|
|
89
|
+
let entries = manager.list({ limit, includeArchived: args.include_archived === true });
|
|
90
|
+
if (tags.length) {
|
|
91
|
+
entries = entries.filter((entry) => tags.every((tag) => entry.tags.includes(String(tag).toLowerCase())));
|
|
92
|
+
}
|
|
93
|
+
return { ok: true, count: entries.length, entries, dynamic_memory_tokens: estimateTokens(JSON.stringify(entries)) };
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function searchMemoryHandler(ctx = {}, args = {}) {
|
|
97
|
+
const query = String(args.query || "").trim();
|
|
98
|
+
if (!query) throw buildToolError("invalid_memory_query", "search_memory requires query");
|
|
99
|
+
const manager = getMemoryManager(ctx);
|
|
100
|
+
const entries = manager.search(query, {
|
|
101
|
+
limit: args.limit,
|
|
102
|
+
includeArchived: args.include_archived === true,
|
|
103
|
+
});
|
|
104
|
+
return { ok: true, count: entries.length, entries, dynamic_memory_tokens: estimateTokens(JSON.stringify(entries)) };
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function searchHistoryHandler(ctx = {}, args = {}) {
|
|
108
|
+
const query = String(args.query || "").trim();
|
|
109
|
+
if (!query) throw buildToolError("invalid_history_query", "search_history requires query");
|
|
110
|
+
const manager = getMemoryManager(ctx);
|
|
111
|
+
const result = searchHistory(ctx.projectRoot, args, {
|
|
112
|
+
homeDir: ctx.historyHomeDir,
|
|
113
|
+
claudeProjectDir: ctx.claudeProjectDir,
|
|
114
|
+
claudeHistoryFile: ctx.claudeHistoryFile,
|
|
115
|
+
codexSessionsDir: ctx.codexSessionsDir,
|
|
116
|
+
codexHistoryFile: ctx.codexHistoryFile,
|
|
117
|
+
});
|
|
118
|
+
manager.recordHistorySearch(query, result.snippets, {
|
|
119
|
+
source: "tool",
|
|
120
|
+
actor: ctx.subscriber || "",
|
|
121
|
+
...extractAuditFields(ctx),
|
|
122
|
+
});
|
|
123
|
+
return {
|
|
124
|
+
...result,
|
|
125
|
+
dynamic_memory_tokens: estimateTokens(JSON.stringify(result.snippets || [])),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function editMemoryHandler(ctx = {}, args = {}) {
|
|
130
|
+
const subscriber = requireSubscriber(ctx);
|
|
131
|
+
const hasBody = Object.prototype.hasOwnProperty.call(args, "body");
|
|
132
|
+
if (hasBody) assertAgentWriteQuality(args, ["body"]);
|
|
133
|
+
const manager = getMemoryManager(ctx);
|
|
134
|
+
const patch = {};
|
|
135
|
+
if (Object.prototype.hasOwnProperty.call(args, "title")) patch.title = args.title;
|
|
136
|
+
if (Object.prototype.hasOwnProperty.call(args, "body")) patch.body = args.body;
|
|
137
|
+
if (Object.prototype.hasOwnProperty.call(args, "tags")) patch.tags = normalizeTags(args.tags);
|
|
138
|
+
if (Object.prototype.hasOwnProperty.call(args, "expected_updated_at")) {
|
|
139
|
+
patch.expected_updated_at = args.expected_updated_at;
|
|
140
|
+
}
|
|
141
|
+
const entry = manager.update(args.id, patch, {
|
|
142
|
+
source: "tool",
|
|
143
|
+
actor: subscriber,
|
|
144
|
+
...extractAuditFields(ctx),
|
|
145
|
+
...extractMemoryEvidence(args),
|
|
146
|
+
});
|
|
147
|
+
return { ok: true, entry };
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function forgetMemoryHandler(ctx = {}, args = {}) {
|
|
151
|
+
const subscriber = requireSubscriber(ctx);
|
|
152
|
+
const manager = getMemoryManager(ctx);
|
|
153
|
+
const entry = manager.archive(args.id, {
|
|
154
|
+
source: "tool",
|
|
155
|
+
actor: subscriber,
|
|
156
|
+
...extractAuditFields(ctx),
|
|
157
|
+
});
|
|
158
|
+
return { ok: true, entry };
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
module.exports = {
|
|
162
|
+
rememberHandler,
|
|
163
|
+
recallHandler,
|
|
164
|
+
searchMemoryHandler,
|
|
165
|
+
searchHistoryHandler,
|
|
166
|
+
editMemoryHandler,
|
|
167
|
+
forgetMemoryHandler,
|
|
168
|
+
};
|
package/src/tools/index.js
CHANGED
|
@@ -16,6 +16,12 @@ const {
|
|
|
16
16
|
ROUTE_AGENT_SCHEMA,
|
|
17
17
|
DISPATCH_MESSAGE_SCHEMA,
|
|
18
18
|
ACK_BUS_SCHEMA,
|
|
19
|
+
REMEMBER_SCHEMA,
|
|
20
|
+
RECALL_SCHEMA,
|
|
21
|
+
SEARCH_MEMORY_SCHEMA,
|
|
22
|
+
SEARCH_HISTORY_SCHEMA,
|
|
23
|
+
EDIT_MEMORY_SCHEMA,
|
|
24
|
+
FORGET_MEMORY_SCHEMA,
|
|
19
25
|
LAUNCH_AGENT_SCHEMA,
|
|
20
26
|
RENAME_AGENT_SCHEMA,
|
|
21
27
|
CLOSE_AGENT_SCHEMA,
|
|
@@ -45,6 +51,12 @@ module.exports = {
|
|
|
45
51
|
ROUTE_AGENT_SCHEMA,
|
|
46
52
|
DISPATCH_MESSAGE_SCHEMA,
|
|
47
53
|
ACK_BUS_SCHEMA,
|
|
54
|
+
REMEMBER_SCHEMA,
|
|
55
|
+
RECALL_SCHEMA,
|
|
56
|
+
SEARCH_MEMORY_SCHEMA,
|
|
57
|
+
SEARCH_HISTORY_SCHEMA,
|
|
58
|
+
EDIT_MEMORY_SCHEMA,
|
|
59
|
+
FORGET_MEMORY_SCHEMA,
|
|
48
60
|
LAUNCH_AGENT_SCHEMA,
|
|
49
61
|
RENAME_AGENT_SCHEMA,
|
|
50
62
|
CLOSE_AGENT_SCHEMA,
|
package/src/tools/registry.js
CHANGED
|
@@ -5,7 +5,13 @@ const readProjectRegistry = require("./tier0/readProjectRegistry");
|
|
|
5
5
|
const readPromptHistory = require("./tier0/readPromptHistory");
|
|
6
6
|
const ackBus = require("./tier1/ackBus");
|
|
7
7
|
const dispatchMessage = require("./tier1/dispatchMessage");
|
|
8
|
+
const editMemory = require("./tier1/editMemory");
|
|
9
|
+
const forget = require("./tier1/forget");
|
|
10
|
+
const recall = require("./tier1/recall");
|
|
11
|
+
const remember = require("./tier1/remember");
|
|
8
12
|
const routeAgent = require("./tier1/routeAgent");
|
|
13
|
+
const searchHistory = require("./tier1/searchHistory");
|
|
14
|
+
const searchMemory = require("./tier1/searchMemory");
|
|
9
15
|
const closeAgent = require("./tier2/closeAgent");
|
|
10
16
|
const launchAgent = require("./tier2/launchAgent");
|
|
11
17
|
const manageCron = require("./tier2/manageCron");
|
|
@@ -26,6 +32,12 @@ const SHARED_TOOL_REGISTRY = Object.freeze([
|
|
|
26
32
|
routeAgent,
|
|
27
33
|
dispatchMessage,
|
|
28
34
|
ackBus,
|
|
35
|
+
remember,
|
|
36
|
+
recall,
|
|
37
|
+
searchMemory,
|
|
38
|
+
searchHistory,
|
|
39
|
+
editMemory,
|
|
40
|
+
forget,
|
|
29
41
|
launchAgent,
|
|
30
42
|
renameAgent,
|
|
31
43
|
closeAgent,
|
|
@@ -243,6 +243,207 @@ const ACK_BUS_SCHEMA = Object.freeze({
|
|
|
243
243
|
}),
|
|
244
244
|
});
|
|
245
245
|
|
|
246
|
+
const REMEMBER_SCHEMA = Object.freeze({
|
|
247
|
+
schema_version: SCHEMA_VERSION,
|
|
248
|
+
name: "remember",
|
|
249
|
+
tier: "tier1-coordination",
|
|
250
|
+
allowed_tiers: CALLER_TIERS_READ_COORD,
|
|
251
|
+
description: "Record a durable project memory fact.",
|
|
252
|
+
input_schema: Object.freeze({
|
|
253
|
+
type: "object",
|
|
254
|
+
required: Object.freeze(["title", "body"]),
|
|
255
|
+
properties: Object.freeze({
|
|
256
|
+
title: Object.freeze({ type: "string", maxLength: 150 }),
|
|
257
|
+
body: Object.freeze({ type: "string", minLength: 20 }),
|
|
258
|
+
tags: Object.freeze({
|
|
259
|
+
type: "array",
|
|
260
|
+
items: Object.freeze({ type: "string" }),
|
|
261
|
+
}),
|
|
262
|
+
history_session_id: Object.freeze({ type: "string" }),
|
|
263
|
+
history_offset: Object.freeze({ type: "string" }),
|
|
264
|
+
recall_ids: Object.freeze({
|
|
265
|
+
type: "array",
|
|
266
|
+
items: Object.freeze({ type: "string" }),
|
|
267
|
+
}),
|
|
268
|
+
}),
|
|
269
|
+
additionalProperties: false,
|
|
270
|
+
}),
|
|
271
|
+
output_schema: Object.freeze({
|
|
272
|
+
type: "object",
|
|
273
|
+
required: Object.freeze(["ok", "entry"]),
|
|
274
|
+
properties: Object.freeze({
|
|
275
|
+
ok: Object.freeze({ type: "boolean" }),
|
|
276
|
+
entry: Object.freeze({ type: "object", additionalProperties: true }),
|
|
277
|
+
}),
|
|
278
|
+
additionalProperties: false,
|
|
279
|
+
}),
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
const RECALL_SCHEMA = Object.freeze({
|
|
283
|
+
schema_version: SCHEMA_VERSION,
|
|
284
|
+
name: "recall",
|
|
285
|
+
tier: "tier1-coordination",
|
|
286
|
+
allowed_tiers: CALLER_TIERS_READ_COORD,
|
|
287
|
+
description: "Read project memory entries by id or tags.",
|
|
288
|
+
input_schema: Object.freeze({
|
|
289
|
+
type: "object",
|
|
290
|
+
properties: Object.freeze({
|
|
291
|
+
id: Object.freeze({ type: "string" }),
|
|
292
|
+
tags: Object.freeze({
|
|
293
|
+
type: "array",
|
|
294
|
+
items: Object.freeze({ type: "string" }),
|
|
295
|
+
}),
|
|
296
|
+
limit: Object.freeze({ type: "integer", minimum: 1 }),
|
|
297
|
+
include_archived: Object.freeze({ type: "boolean" }),
|
|
298
|
+
}),
|
|
299
|
+
additionalProperties: false,
|
|
300
|
+
}),
|
|
301
|
+
output_schema: Object.freeze({
|
|
302
|
+
type: "object",
|
|
303
|
+
required: Object.freeze(["ok", "count", "entries"]),
|
|
304
|
+
properties: Object.freeze({
|
|
305
|
+
ok: Object.freeze({ type: "boolean" }),
|
|
306
|
+
count: Object.freeze({ type: "integer" }),
|
|
307
|
+
dynamic_memory_tokens: Object.freeze({ type: "integer" }),
|
|
308
|
+
entries: Object.freeze({
|
|
309
|
+
type: "array",
|
|
310
|
+
items: Object.freeze({ type: "object", additionalProperties: true }),
|
|
311
|
+
}),
|
|
312
|
+
}),
|
|
313
|
+
additionalProperties: false,
|
|
314
|
+
}),
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
const SEARCH_MEMORY_SCHEMA = Object.freeze({
|
|
318
|
+
schema_version: SCHEMA_VERSION,
|
|
319
|
+
name: "search_memory",
|
|
320
|
+
tier: "tier1-coordination",
|
|
321
|
+
allowed_tiers: CALLER_TIERS_READ_COORD,
|
|
322
|
+
description: "Search project memory entries with token and substring matching.",
|
|
323
|
+
input_schema: Object.freeze({
|
|
324
|
+
type: "object",
|
|
325
|
+
required: Object.freeze(["query"]),
|
|
326
|
+
properties: Object.freeze({
|
|
327
|
+
query: Object.freeze({ type: "string" }),
|
|
328
|
+
limit: Object.freeze({ type: "integer", minimum: 1 }),
|
|
329
|
+
include_archived: Object.freeze({ type: "boolean" }),
|
|
330
|
+
}),
|
|
331
|
+
additionalProperties: false,
|
|
332
|
+
}),
|
|
333
|
+
output_schema: Object.freeze({
|
|
334
|
+
type: "object",
|
|
335
|
+
required: Object.freeze(["ok", "count", "entries"]),
|
|
336
|
+
properties: Object.freeze({
|
|
337
|
+
ok: Object.freeze({ type: "boolean" }),
|
|
338
|
+
count: Object.freeze({ type: "integer" }),
|
|
339
|
+
dynamic_memory_tokens: Object.freeze({ type: "integer" }),
|
|
340
|
+
entries: Object.freeze({
|
|
341
|
+
type: "array",
|
|
342
|
+
items: Object.freeze({ type: "object", additionalProperties: true }),
|
|
343
|
+
}),
|
|
344
|
+
}),
|
|
345
|
+
additionalProperties: false,
|
|
346
|
+
}),
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
const SEARCH_HISTORY_SCHEMA = Object.freeze({
|
|
350
|
+
schema_version: SCHEMA_VERSION,
|
|
351
|
+
name: "search_history",
|
|
352
|
+
tier: "tier1-coordination",
|
|
353
|
+
allowed_tiers: CALLER_TIERS_READ_COORD,
|
|
354
|
+
description: "Search local Claude/Codex session history snippets as evidence for memory work.",
|
|
355
|
+
input_schema: Object.freeze({
|
|
356
|
+
type: "object",
|
|
357
|
+
required: Object.freeze(["query"]),
|
|
358
|
+
properties: Object.freeze({
|
|
359
|
+
query: Object.freeze({ type: "string" }),
|
|
360
|
+
agent: Object.freeze({ type: "string" }),
|
|
361
|
+
session_id: Object.freeze({ type: "string" }),
|
|
362
|
+
limit: Object.freeze({ type: "integer", minimum: 1, maximum: 3 }),
|
|
363
|
+
}),
|
|
364
|
+
additionalProperties: false,
|
|
365
|
+
}),
|
|
366
|
+
output_schema: Object.freeze({
|
|
367
|
+
type: "object",
|
|
368
|
+
required: Object.freeze(["ok", "from_history", "query", "count", "snippets"]),
|
|
369
|
+
properties: Object.freeze({
|
|
370
|
+
ok: Object.freeze({ type: "boolean" }),
|
|
371
|
+
from_history: Object.freeze({ type: "boolean" }),
|
|
372
|
+
query: Object.freeze({ type: "string" }),
|
|
373
|
+
count: Object.freeze({ type: "integer" }),
|
|
374
|
+
dynamic_memory_tokens: Object.freeze({ type: "integer" }),
|
|
375
|
+
snippets: Object.freeze({
|
|
376
|
+
type: "array",
|
|
377
|
+
items: Object.freeze({ type: "object", additionalProperties: true }),
|
|
378
|
+
}),
|
|
379
|
+
}),
|
|
380
|
+
additionalProperties: false,
|
|
381
|
+
}),
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
const EDIT_MEMORY_SCHEMA = Object.freeze({
|
|
385
|
+
schema_version: SCHEMA_VERSION,
|
|
386
|
+
name: "edit_memory",
|
|
387
|
+
tier: "tier1-coordination",
|
|
388
|
+
allowed_tiers: CALLER_TIERS_READ_COORD,
|
|
389
|
+
description: "Edit an existing project memory entry.",
|
|
390
|
+
input_schema: Object.freeze({
|
|
391
|
+
type: "object",
|
|
392
|
+
required: Object.freeze(["id"]),
|
|
393
|
+
properties: Object.freeze({
|
|
394
|
+
id: Object.freeze({ type: "string" }),
|
|
395
|
+
title: Object.freeze({ type: "string", maxLength: 150 }),
|
|
396
|
+
body: Object.freeze({ type: "string", minLength: 20 }),
|
|
397
|
+
tags: Object.freeze({
|
|
398
|
+
type: "array",
|
|
399
|
+
items: Object.freeze({ type: "string" }),
|
|
400
|
+
}),
|
|
401
|
+
expected_updated_at: Object.freeze({ type: "string" }),
|
|
402
|
+
history_session_id: Object.freeze({ type: "string" }),
|
|
403
|
+
history_offset: Object.freeze({ type: "string" }),
|
|
404
|
+
recall_ids: Object.freeze({
|
|
405
|
+
type: "array",
|
|
406
|
+
items: Object.freeze({ type: "string" }),
|
|
407
|
+
}),
|
|
408
|
+
}),
|
|
409
|
+
additionalProperties: false,
|
|
410
|
+
}),
|
|
411
|
+
output_schema: Object.freeze({
|
|
412
|
+
type: "object",
|
|
413
|
+
required: Object.freeze(["ok", "entry"]),
|
|
414
|
+
properties: Object.freeze({
|
|
415
|
+
ok: Object.freeze({ type: "boolean" }),
|
|
416
|
+
entry: Object.freeze({ type: "object", additionalProperties: true }),
|
|
417
|
+
}),
|
|
418
|
+
additionalProperties: false,
|
|
419
|
+
}),
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
const FORGET_MEMORY_SCHEMA = Object.freeze({
|
|
423
|
+
schema_version: SCHEMA_VERSION,
|
|
424
|
+
name: "forget",
|
|
425
|
+
tier: "tier1-coordination",
|
|
426
|
+
allowed_tiers: CALLER_TIERS_READ_COORD,
|
|
427
|
+
description: "Archive a project memory entry.",
|
|
428
|
+
input_schema: Object.freeze({
|
|
429
|
+
type: "object",
|
|
430
|
+
required: Object.freeze(["id"]),
|
|
431
|
+
properties: Object.freeze({
|
|
432
|
+
id: Object.freeze({ type: "string" }),
|
|
433
|
+
}),
|
|
434
|
+
additionalProperties: false,
|
|
435
|
+
}),
|
|
436
|
+
output_schema: Object.freeze({
|
|
437
|
+
type: "object",
|
|
438
|
+
required: Object.freeze(["ok", "entry"]),
|
|
439
|
+
properties: Object.freeze({
|
|
440
|
+
ok: Object.freeze({ type: "boolean" }),
|
|
441
|
+
entry: Object.freeze({ type: "object", additionalProperties: true }),
|
|
442
|
+
}),
|
|
443
|
+
additionalProperties: false,
|
|
444
|
+
}),
|
|
445
|
+
});
|
|
446
|
+
|
|
246
447
|
const LAUNCH_AGENT_SCHEMA = Object.freeze({
|
|
247
448
|
schema_version: SCHEMA_VERSION,
|
|
248
449
|
name: "launch_agent",
|
|
@@ -391,6 +592,12 @@ const PHASE0_TOOL_SCHEMAS = Object.freeze({
|
|
|
391
592
|
route_agent: ROUTE_AGENT_SCHEMA,
|
|
392
593
|
dispatch_message: DISPATCH_MESSAGE_SCHEMA,
|
|
393
594
|
ack_bus: ACK_BUS_SCHEMA,
|
|
595
|
+
remember: REMEMBER_SCHEMA,
|
|
596
|
+
recall: RECALL_SCHEMA,
|
|
597
|
+
search_memory: SEARCH_MEMORY_SCHEMA,
|
|
598
|
+
search_history: SEARCH_HISTORY_SCHEMA,
|
|
599
|
+
edit_memory: EDIT_MEMORY_SCHEMA,
|
|
600
|
+
forget: FORGET_MEMORY_SCHEMA,
|
|
394
601
|
launch_agent: LAUNCH_AGENT_SCHEMA,
|
|
395
602
|
rename_agent: RENAME_AGENT_SCHEMA,
|
|
396
603
|
close_agent: CLOSE_AGENT_SCHEMA,
|
|
@@ -407,6 +614,12 @@ module.exports = {
|
|
|
407
614
|
ROUTE_AGENT_SCHEMA,
|
|
408
615
|
DISPATCH_MESSAGE_SCHEMA,
|
|
409
616
|
ACK_BUS_SCHEMA,
|
|
617
|
+
REMEMBER_SCHEMA,
|
|
618
|
+
RECALL_SCHEMA,
|
|
619
|
+
SEARCH_MEMORY_SCHEMA,
|
|
620
|
+
SEARCH_HISTORY_SCHEMA,
|
|
621
|
+
EDIT_MEMORY_SCHEMA,
|
|
622
|
+
FORGET_MEMORY_SCHEMA,
|
|
410
623
|
LAUNCH_AGENT_SCHEMA,
|
|
411
624
|
RENAME_AGENT_SCHEMA,
|
|
412
625
|
CLOSE_AGENT_SCHEMA,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const { EDIT_MEMORY_SCHEMA } = require("../schemaFixtures");
|
|
2
|
+
const { CALLER_TIERS, TOOL_TIERS, createToolDefinition } = require("../types");
|
|
3
|
+
const { editMemoryHandler } = require("../handlers/memory");
|
|
4
|
+
|
|
5
|
+
module.exports = createToolDefinition({
|
|
6
|
+
name: EDIT_MEMORY_SCHEMA.name,
|
|
7
|
+
description: EDIT_MEMORY_SCHEMA.description,
|
|
8
|
+
tier: TOOL_TIERS.TIER_1,
|
|
9
|
+
allowedCallerTiers: [CALLER_TIERS.CONTROLLER, CALLER_TIERS.WORKER],
|
|
10
|
+
inputSchema: EDIT_MEMORY_SCHEMA.input_schema,
|
|
11
|
+
outputSchema: EDIT_MEMORY_SCHEMA.output_schema,
|
|
12
|
+
schemaVersion: EDIT_MEMORY_SCHEMA.schema_version,
|
|
13
|
+
handler: editMemoryHandler,
|
|
14
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const { FORGET_MEMORY_SCHEMA } = require("../schemaFixtures");
|
|
2
|
+
const { CALLER_TIERS, TOOL_TIERS, createToolDefinition } = require("../types");
|
|
3
|
+
const { forgetMemoryHandler } = require("../handlers/memory");
|
|
4
|
+
|
|
5
|
+
module.exports = createToolDefinition({
|
|
6
|
+
name: FORGET_MEMORY_SCHEMA.name,
|
|
7
|
+
description: FORGET_MEMORY_SCHEMA.description,
|
|
8
|
+
tier: TOOL_TIERS.TIER_1,
|
|
9
|
+
allowedCallerTiers: [CALLER_TIERS.CONTROLLER, CALLER_TIERS.WORKER],
|
|
10
|
+
inputSchema: FORGET_MEMORY_SCHEMA.input_schema,
|
|
11
|
+
outputSchema: FORGET_MEMORY_SCHEMA.output_schema,
|
|
12
|
+
schemaVersion: FORGET_MEMORY_SCHEMA.schema_version,
|
|
13
|
+
handler: forgetMemoryHandler,
|
|
14
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const { RECALL_SCHEMA } = require("../schemaFixtures");
|
|
2
|
+
const { CALLER_TIERS, TOOL_TIERS, createToolDefinition } = require("../types");
|
|
3
|
+
const { recallHandler } = require("../handlers/memory");
|
|
4
|
+
|
|
5
|
+
module.exports = createToolDefinition({
|
|
6
|
+
name: RECALL_SCHEMA.name,
|
|
7
|
+
description: RECALL_SCHEMA.description,
|
|
8
|
+
tier: TOOL_TIERS.TIER_1,
|
|
9
|
+
allowedCallerTiers: [CALLER_TIERS.CONTROLLER, CALLER_TIERS.WORKER],
|
|
10
|
+
inputSchema: RECALL_SCHEMA.input_schema,
|
|
11
|
+
outputSchema: RECALL_SCHEMA.output_schema,
|
|
12
|
+
schemaVersion: RECALL_SCHEMA.schema_version,
|
|
13
|
+
handler: recallHandler,
|
|
14
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const { REMEMBER_SCHEMA } = require("../schemaFixtures");
|
|
2
|
+
const { CALLER_TIERS, TOOL_TIERS, createToolDefinition } = require("../types");
|
|
3
|
+
const { rememberHandler } = require("../handlers/memory");
|
|
4
|
+
|
|
5
|
+
module.exports = createToolDefinition({
|
|
6
|
+
name: REMEMBER_SCHEMA.name,
|
|
7
|
+
description: REMEMBER_SCHEMA.description,
|
|
8
|
+
tier: TOOL_TIERS.TIER_1,
|
|
9
|
+
allowedCallerTiers: [CALLER_TIERS.CONTROLLER, CALLER_TIERS.WORKER],
|
|
10
|
+
inputSchema: REMEMBER_SCHEMA.input_schema,
|
|
11
|
+
outputSchema: REMEMBER_SCHEMA.output_schema,
|
|
12
|
+
schemaVersion: REMEMBER_SCHEMA.schema_version,
|
|
13
|
+
handler: rememberHandler,
|
|
14
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const { SEARCH_HISTORY_SCHEMA } = require("../schemaFixtures");
|
|
2
|
+
const { CALLER_TIERS, TOOL_TIERS, createToolDefinition } = require("../types");
|
|
3
|
+
const { searchHistoryHandler } = require("../handlers/memory");
|
|
4
|
+
|
|
5
|
+
module.exports = createToolDefinition({
|
|
6
|
+
name: SEARCH_HISTORY_SCHEMA.name,
|
|
7
|
+
description: SEARCH_HISTORY_SCHEMA.description,
|
|
8
|
+
tier: TOOL_TIERS.TIER_1,
|
|
9
|
+
allowedCallerTiers: [CALLER_TIERS.CONTROLLER, CALLER_TIERS.WORKER],
|
|
10
|
+
inputSchema: SEARCH_HISTORY_SCHEMA.input_schema,
|
|
11
|
+
outputSchema: SEARCH_HISTORY_SCHEMA.output_schema,
|
|
12
|
+
schemaVersion: SEARCH_HISTORY_SCHEMA.schema_version,
|
|
13
|
+
handler: searchHistoryHandler,
|
|
14
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const { SEARCH_MEMORY_SCHEMA } = require("../schemaFixtures");
|
|
2
|
+
const { CALLER_TIERS, TOOL_TIERS, createToolDefinition } = require("../types");
|
|
3
|
+
const { searchMemoryHandler } = require("../handlers/memory");
|
|
4
|
+
|
|
5
|
+
module.exports = createToolDefinition({
|
|
6
|
+
name: SEARCH_MEMORY_SCHEMA.name,
|
|
7
|
+
description: SEARCH_MEMORY_SCHEMA.description,
|
|
8
|
+
tier: TOOL_TIERS.TIER_1,
|
|
9
|
+
allowedCallerTiers: [CALLER_TIERS.CONTROLLER, CALLER_TIERS.WORKER],
|
|
10
|
+
inputSchema: SEARCH_MEMORY_SCHEMA.input_schema,
|
|
11
|
+
outputSchema: SEARCH_MEMORY_SCHEMA.output_schema,
|
|
12
|
+
schemaVersion: SEARCH_MEMORY_SCHEMA.schema_version,
|
|
13
|
+
handler: searchMemoryHandler,
|
|
14
|
+
});
|