@cleocode/cleo 2026.4.38 → 2026.4.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +438 -10
- package/dist/cli/index.js.map +4 -4
- package/package.json +8 -8
package/dist/cli/index.js
CHANGED
|
@@ -45821,6 +45821,390 @@ var init_brain_consolidator = __esm({
|
|
|
45821
45821
|
}
|
|
45822
45822
|
});
|
|
45823
45823
|
|
|
45824
|
+
// packages/core/src/memory/graph-memory-bridge.ts
|
|
45825
|
+
var graph_memory_bridge_exports = {};
|
|
45826
|
+
__export(graph_memory_bridge_exports, {
|
|
45827
|
+
autoLinkMemories: () => autoLinkMemories,
|
|
45828
|
+
linkMemoryToCode: () => linkMemoryToCode,
|
|
45829
|
+
listCodeLinks: () => listCodeLinks,
|
|
45830
|
+
queryCodeForMemory: () => queryCodeForMemory,
|
|
45831
|
+
queryMemoriesForCode: () => queryMemoriesForCode
|
|
45832
|
+
});
|
|
45833
|
+
function extractFilePaths(text3) {
|
|
45834
|
+
const paths = /* @__PURE__ */ new Set();
|
|
45835
|
+
for (const m2 of text3.matchAll(FILE_PATH_PATTERN)) {
|
|
45836
|
+
const p2 = m2[1];
|
|
45837
|
+
if (p2) paths.add(p2);
|
|
45838
|
+
}
|
|
45839
|
+
return Array.from(paths);
|
|
45840
|
+
}
|
|
45841
|
+
function extractSymbolCandidates(text3) {
|
|
45842
|
+
const syms = /* @__PURE__ */ new Set();
|
|
45843
|
+
for (const m2 of text3.matchAll(SYMBOL_PATTERN)) {
|
|
45844
|
+
const s3 = m2[1];
|
|
45845
|
+
if (s3 && s3.length >= 4 && !SYMBOL_STOP_WORDS.has(s3.toLowerCase())) {
|
|
45846
|
+
syms.add(s3);
|
|
45847
|
+
}
|
|
45848
|
+
}
|
|
45849
|
+
return Array.from(syms);
|
|
45850
|
+
}
|
|
45851
|
+
function metadataText(metaJson) {
|
|
45852
|
+
if (!metaJson) return "";
|
|
45853
|
+
try {
|
|
45854
|
+
const obj = JSON.parse(metaJson);
|
|
45855
|
+
return Object.values(obj).filter((v2) => typeof v2 === "string").join(" ");
|
|
45856
|
+
} catch {
|
|
45857
|
+
return "";
|
|
45858
|
+
}
|
|
45859
|
+
}
|
|
45860
|
+
async function linkMemoryToCode(projectRoot, memoryId, codeSymbol) {
|
|
45861
|
+
try {
|
|
45862
|
+
const brainDb = await getBrainDb(projectRoot);
|
|
45863
|
+
await getNexusDb();
|
|
45864
|
+
const nexusNative = getNexusNativeDb();
|
|
45865
|
+
if (!nexusNative) return false;
|
|
45866
|
+
const nexusNode = nexusNative.prepare("SELECT id, label, file_path, kind FROM nexus_nodes WHERE id = ? LIMIT 1").get(codeSymbol);
|
|
45867
|
+
if (!nexusNode) return false;
|
|
45868
|
+
const now2 = (/* @__PURE__ */ new Date()).toISOString().replace("T", " ").slice(0, 19);
|
|
45869
|
+
const idParts = memoryId.split(":");
|
|
45870
|
+
const nodeType = idParts[0] ?? "observation";
|
|
45871
|
+
await brainDb.insert(brainPageNodes).values({
|
|
45872
|
+
id: memoryId,
|
|
45873
|
+
nodeType,
|
|
45874
|
+
label: memoryId,
|
|
45875
|
+
qualityScore: 0.5,
|
|
45876
|
+
contentHash: null,
|
|
45877
|
+
lastActivityAt: now2,
|
|
45878
|
+
createdAt: now2,
|
|
45879
|
+
updatedAt: now2
|
|
45880
|
+
}).onConflictDoUpdate({
|
|
45881
|
+
target: brainPageNodes.id,
|
|
45882
|
+
set: { lastActivityAt: now2, updatedAt: now2 }
|
|
45883
|
+
});
|
|
45884
|
+
await brainDb.insert(brainPageEdges).values({
|
|
45885
|
+
fromId: memoryId,
|
|
45886
|
+
toId: codeSymbol,
|
|
45887
|
+
edgeType: "code_reference",
|
|
45888
|
+
weight: 1,
|
|
45889
|
+
provenance: "manual",
|
|
45890
|
+
createdAt: now2
|
|
45891
|
+
}).onConflictDoNothing();
|
|
45892
|
+
return true;
|
|
45893
|
+
} catch (err) {
|
|
45894
|
+
console.warn("[graph-memory-bridge] linkMemoryToCode failed:", err);
|
|
45895
|
+
return false;
|
|
45896
|
+
}
|
|
45897
|
+
}
|
|
45898
|
+
async function autoLinkMemories(projectRoot) {
|
|
45899
|
+
const result = { scanned: 0, linked: 0, alreadyLinked: 0, links: [] };
|
|
45900
|
+
try {
|
|
45901
|
+
await getBrainDb(projectRoot);
|
|
45902
|
+
const brainNative = getBrainNativeDb();
|
|
45903
|
+
await getNexusDb();
|
|
45904
|
+
const nexusNative = getNexusNativeDb();
|
|
45905
|
+
if (!brainNative || !nexusNative) return result;
|
|
45906
|
+
const brainNodes = typedAll(
|
|
45907
|
+
brainNative.prepare(`
|
|
45908
|
+
SELECT id, node_type, label, quality_score, metadata_json
|
|
45909
|
+
FROM brain_page_nodes
|
|
45910
|
+
WHERE node_type IN ('observation', 'decision', 'pattern', 'learning')
|
|
45911
|
+
AND quality_score >= 0.3
|
|
45912
|
+
ORDER BY quality_score DESC
|
|
45913
|
+
LIMIT 500
|
|
45914
|
+
`)
|
|
45915
|
+
);
|
|
45916
|
+
result.scanned = brainNodes.length;
|
|
45917
|
+
if (brainNodes.length === 0) return result;
|
|
45918
|
+
const nexusNodes2 = typedAll(
|
|
45919
|
+
nexusNative.prepare(`
|
|
45920
|
+
SELECT id, label, name, file_path, kind
|
|
45921
|
+
FROM nexus_nodes
|
|
45922
|
+
WHERE kind NOT IN ('community', 'process', 'folder')
|
|
45923
|
+
LIMIT 20000
|
|
45924
|
+
`)
|
|
45925
|
+
);
|
|
45926
|
+
if (nexusNodes2.length === 0) return result;
|
|
45927
|
+
const byFilePath = /* @__PURE__ */ new Map();
|
|
45928
|
+
const byNameExact = /* @__PURE__ */ new Map();
|
|
45929
|
+
const byNameLower = /* @__PURE__ */ new Map();
|
|
45930
|
+
for (const node of nexusNodes2) {
|
|
45931
|
+
if (node.file_path) {
|
|
45932
|
+
const fp = node.file_path.toLowerCase();
|
|
45933
|
+
const existing = byFilePath.get(fp) ?? [];
|
|
45934
|
+
existing.push(node);
|
|
45935
|
+
byFilePath.set(fp, existing);
|
|
45936
|
+
}
|
|
45937
|
+
if (node.name) {
|
|
45938
|
+
const exact = byNameExact.get(node.name) ?? [];
|
|
45939
|
+
exact.push(node);
|
|
45940
|
+
byNameExact.set(node.name, exact);
|
|
45941
|
+
const lower = node.name.toLowerCase();
|
|
45942
|
+
const fuzzy = byNameLower.get(lower) ?? [];
|
|
45943
|
+
fuzzy.push(node);
|
|
45944
|
+
byNameLower.set(lower, fuzzy);
|
|
45945
|
+
}
|
|
45946
|
+
}
|
|
45947
|
+
const now2 = (/* @__PURE__ */ new Date()).toISOString().replace("T", " ").slice(0, 19);
|
|
45948
|
+
const existingEdges = /* @__PURE__ */ new Set();
|
|
45949
|
+
const rawEdges = typedAll(
|
|
45950
|
+
brainNative.prepare(`
|
|
45951
|
+
SELECT from_id, to_id FROM brain_page_edges WHERE edge_type = 'code_reference'
|
|
45952
|
+
`)
|
|
45953
|
+
);
|
|
45954
|
+
for (const e of rawEdges) {
|
|
45955
|
+
existingEdges.add(`${e.from_id}|${e.to_id}`);
|
|
45956
|
+
}
|
|
45957
|
+
for (const brainNode of brainNodes) {
|
|
45958
|
+
const corpus = `${brainNode.label} ${metadataText(brainNode.metadata_json)}`;
|
|
45959
|
+
const filePaths = extractFilePaths(corpus);
|
|
45960
|
+
const symbolCandidates = extractSymbolCandidates(corpus);
|
|
45961
|
+
const candidates = [];
|
|
45962
|
+
for (const fp of filePaths) {
|
|
45963
|
+
const matches = byFilePath.get(fp.toLowerCase());
|
|
45964
|
+
if (matches) {
|
|
45965
|
+
for (const n of matches) {
|
|
45966
|
+
candidates.push({ nexusNode: n, strategy: "exact-file", weight: 1 });
|
|
45967
|
+
}
|
|
45968
|
+
}
|
|
45969
|
+
}
|
|
45970
|
+
for (const sym of symbolCandidates) {
|
|
45971
|
+
const exactMatches = byNameExact.get(sym);
|
|
45972
|
+
if (exactMatches) {
|
|
45973
|
+
for (const n of exactMatches) {
|
|
45974
|
+
candidates.push({ nexusNode: n, strategy: "exact-symbol", weight: 1 });
|
|
45975
|
+
}
|
|
45976
|
+
}
|
|
45977
|
+
}
|
|
45978
|
+
const exactSymSet = new Set(
|
|
45979
|
+
symbolCandidates.flatMap((s3) => byNameExact.get(s3) ?? []).map((n) => n.id)
|
|
45980
|
+
);
|
|
45981
|
+
for (const sym of symbolCandidates) {
|
|
45982
|
+
if (sym.length < 5) continue;
|
|
45983
|
+
const lower = sym.toLowerCase();
|
|
45984
|
+
const fuzzyMatches = byNameLower.get(lower);
|
|
45985
|
+
if (fuzzyMatches) {
|
|
45986
|
+
for (const n of fuzzyMatches) {
|
|
45987
|
+
if (!exactSymSet.has(n.id)) {
|
|
45988
|
+
candidates.push({ nexusNode: n, strategy: "fuzzy-symbol", weight: 0.6 });
|
|
45989
|
+
}
|
|
45990
|
+
}
|
|
45991
|
+
}
|
|
45992
|
+
}
|
|
45993
|
+
const bestByNexusId = /* @__PURE__ */ new Map();
|
|
45994
|
+
for (const c of candidates) {
|
|
45995
|
+
const existing = bestByNexusId.get(c.nexusNode.id);
|
|
45996
|
+
if (!existing || c.weight > existing.weight) {
|
|
45997
|
+
bestByNexusId.set(c.nexusNode.id, c);
|
|
45998
|
+
}
|
|
45999
|
+
}
|
|
46000
|
+
const sortedCandidates = Array.from(bestByNexusId.values()).sort((a, b2) => b2.weight - a.weight).slice(0, 10);
|
|
46001
|
+
for (const { nexusNode, strategy, weight } of sortedCandidates) {
|
|
46002
|
+
const edgeKey = `${brainNode.id}|${nexusNode.id}`;
|
|
46003
|
+
if (existingEdges.has(edgeKey)) {
|
|
46004
|
+
result.alreadyLinked++;
|
|
46005
|
+
continue;
|
|
46006
|
+
}
|
|
46007
|
+
brainNative.prepare(`
|
|
46008
|
+
INSERT OR IGNORE INTO brain_page_nodes
|
|
46009
|
+
(id, node_type, label, quality_score, content_hash, metadata_json, last_activity_at, created_at, updated_at)
|
|
46010
|
+
VALUES (?, ?, ?, ?, NULL, NULL, ?, ?, ?)
|
|
46011
|
+
`).run(
|
|
46012
|
+
brainNode.id,
|
|
46013
|
+
brainNode.node_type,
|
|
46014
|
+
brainNode.label,
|
|
46015
|
+
brainNode.quality_score,
|
|
46016
|
+
now2,
|
|
46017
|
+
now2,
|
|
46018
|
+
now2
|
|
46019
|
+
);
|
|
46020
|
+
try {
|
|
46021
|
+
brainNative.prepare(`
|
|
46022
|
+
INSERT OR IGNORE INTO brain_page_edges
|
|
46023
|
+
(from_id, to_id, edge_type, weight, provenance, created_at)
|
|
46024
|
+
VALUES (?, ?, 'code_reference', ?, ?, ?)
|
|
46025
|
+
`).run(brainNode.id, nexusNode.id, weight, `auto:${strategy}`, now2);
|
|
46026
|
+
existingEdges.add(edgeKey);
|
|
46027
|
+
result.linked++;
|
|
46028
|
+
result.links.push({
|
|
46029
|
+
brainNodeId: brainNode.id,
|
|
46030
|
+
nexusNodeId: nexusNode.id,
|
|
46031
|
+
nexusLabel: nexusNode.label,
|
|
46032
|
+
matchStrategy: strategy,
|
|
46033
|
+
weight
|
|
46034
|
+
});
|
|
46035
|
+
} catch (edgeErr) {
|
|
46036
|
+
console.warn("[graph-memory-bridge] edge insert failed:", edgeErr);
|
|
46037
|
+
}
|
|
46038
|
+
}
|
|
46039
|
+
}
|
|
46040
|
+
} catch (err) {
|
|
46041
|
+
console.warn("[graph-memory-bridge] autoLinkMemories failed:", err);
|
|
46042
|
+
}
|
|
46043
|
+
return result;
|
|
46044
|
+
}
|
|
46045
|
+
async function queryMemoriesForCode(projectRoot, symbol2) {
|
|
46046
|
+
const result = { nexusNodeId: symbol2, memories: [] };
|
|
46047
|
+
try {
|
|
46048
|
+
await getBrainDb(projectRoot);
|
|
46049
|
+
const brainNative = getBrainNativeDb();
|
|
46050
|
+
if (!brainNative) return result;
|
|
46051
|
+
const rows = typedAll(
|
|
46052
|
+
brainNative.prepare(`
|
|
46053
|
+
SELECT n.id, n.node_type, n.label, n.quality_score,
|
|
46054
|
+
e.weight, e.provenance
|
|
46055
|
+
FROM brain_page_edges e
|
|
46056
|
+
JOIN brain_page_nodes n ON n.id = e.from_id
|
|
46057
|
+
WHERE e.to_id = ?
|
|
46058
|
+
AND e.edge_type = 'code_reference'
|
|
46059
|
+
ORDER BY e.weight DESC, n.quality_score DESC
|
|
46060
|
+
LIMIT 50
|
|
46061
|
+
`),
|
|
46062
|
+
symbol2
|
|
46063
|
+
);
|
|
46064
|
+
result.memories = rows.map((r) => ({
|
|
46065
|
+
nodeId: r.id,
|
|
46066
|
+
nodeType: r.node_type,
|
|
46067
|
+
label: r.label,
|
|
46068
|
+
qualityScore: r.quality_score,
|
|
46069
|
+
edgeWeight: r.weight,
|
|
46070
|
+
matchStrategy: r.provenance?.replace("auto:", "") ?? "manual"
|
|
46071
|
+
}));
|
|
46072
|
+
} catch (err) {
|
|
46073
|
+
console.warn("[graph-memory-bridge] queryMemoriesForCode failed:", err);
|
|
46074
|
+
}
|
|
46075
|
+
return result;
|
|
46076
|
+
}
|
|
46077
|
+
async function queryCodeForMemory(projectRoot, memoryId) {
|
|
46078
|
+
const result = { brainNodeId: memoryId, codeNodes: [] };
|
|
46079
|
+
try {
|
|
46080
|
+
await getBrainDb(projectRoot);
|
|
46081
|
+
const brainNative = getBrainNativeDb();
|
|
46082
|
+
await getNexusDb();
|
|
46083
|
+
const nexusNative = getNexusNativeDb();
|
|
46084
|
+
if (!brainNative || !nexusNative) return result;
|
|
46085
|
+
const brainEdges = typedAll(
|
|
46086
|
+
brainNative.prepare(`
|
|
46087
|
+
SELECT to_id, weight, provenance
|
|
46088
|
+
FROM brain_page_edges
|
|
46089
|
+
WHERE from_id = ?
|
|
46090
|
+
AND edge_type = 'code_reference'
|
|
46091
|
+
ORDER BY weight DESC
|
|
46092
|
+
LIMIT 50
|
|
46093
|
+
`),
|
|
46094
|
+
memoryId
|
|
46095
|
+
);
|
|
46096
|
+
if (brainEdges.length === 0) return result;
|
|
46097
|
+
for (const edge of brainEdges) {
|
|
46098
|
+
const nexusNode = nexusNative.prepare("SELECT id, label, file_path, kind FROM nexus_nodes WHERE id = ? LIMIT 1").get(edge.to_id);
|
|
46099
|
+
if (nexusNode) {
|
|
46100
|
+
result.codeNodes.push({
|
|
46101
|
+
nexusNodeId: nexusNode.id,
|
|
46102
|
+
label: nexusNode.label,
|
|
46103
|
+
filePath: nexusNode.file_path,
|
|
46104
|
+
kind: nexusNode.kind,
|
|
46105
|
+
edgeWeight: edge.weight,
|
|
46106
|
+
matchStrategy: edge.provenance?.replace("auto:", "") ?? "manual"
|
|
46107
|
+
});
|
|
46108
|
+
}
|
|
46109
|
+
}
|
|
46110
|
+
} catch (err) {
|
|
46111
|
+
console.warn("[graph-memory-bridge] queryCodeForMemory failed:", err);
|
|
46112
|
+
}
|
|
46113
|
+
return result;
|
|
46114
|
+
}
|
|
46115
|
+
async function listCodeLinks(projectRoot, limit = 100) {
|
|
46116
|
+
const entries = [];
|
|
46117
|
+
try {
|
|
46118
|
+
await getBrainDb(projectRoot);
|
|
46119
|
+
const brainNative = getBrainNativeDb();
|
|
46120
|
+
await getNexusDb();
|
|
46121
|
+
const nexusNative = getNexusNativeDb();
|
|
46122
|
+
if (!brainNative || !nexusNative) return entries;
|
|
46123
|
+
const rows = typedAll(
|
|
46124
|
+
brainNative.prepare(`
|
|
46125
|
+
SELECT e.from_id, e.to_id, e.weight, e.created_at,
|
|
46126
|
+
n.node_type, n.label
|
|
46127
|
+
FROM brain_page_edges e
|
|
46128
|
+
JOIN brain_page_nodes n ON n.id = e.from_id
|
|
46129
|
+
WHERE e.edge_type = 'code_reference'
|
|
46130
|
+
ORDER BY e.weight DESC, e.created_at DESC
|
|
46131
|
+
LIMIT ?
|
|
46132
|
+
`),
|
|
46133
|
+
limit
|
|
46134
|
+
);
|
|
46135
|
+
for (const row of rows) {
|
|
46136
|
+
const nexusNode = nexusNative.prepare("SELECT id, label, file_path, kind FROM nexus_nodes WHERE id = ? LIMIT 1").get(row.to_id);
|
|
46137
|
+
entries.push({
|
|
46138
|
+
brainNodeId: row.from_id,
|
|
46139
|
+
brainNodeType: row.node_type,
|
|
46140
|
+
brainNodeLabel: row.label,
|
|
46141
|
+
nexusNodeId: row.to_id,
|
|
46142
|
+
nexusNodeLabel: nexusNode?.label ?? row.to_id,
|
|
46143
|
+
filePath: nexusNode?.file_path ?? null,
|
|
46144
|
+
kind: nexusNode?.kind ?? "unknown",
|
|
46145
|
+
weight: row.weight,
|
|
46146
|
+
createdAt: row.created_at
|
|
46147
|
+
});
|
|
46148
|
+
}
|
|
46149
|
+
} catch (err) {
|
|
46150
|
+
console.warn("[graph-memory-bridge] listCodeLinks failed:", err);
|
|
46151
|
+
}
|
|
46152
|
+
return entries;
|
|
46153
|
+
}
|
|
46154
|
+
var FILE_PATH_PATTERN, SYMBOL_PATTERN, SYMBOL_STOP_WORDS;
|
|
46155
|
+
var init_graph_memory_bridge = __esm({
|
|
46156
|
+
"packages/core/src/memory/graph-memory-bridge.ts"() {
|
|
46157
|
+
"use strict";
|
|
46158
|
+
init_brain_schema();
|
|
46159
|
+
init_brain_sqlite();
|
|
46160
|
+
init_nexus_sqlite();
|
|
46161
|
+
init_typed_query();
|
|
46162
|
+
FILE_PATH_PATTERN = /(?:^|\s|['"`(])([a-zA-Z0-9_\-./]+\.(?:ts|tsx|js|jsx|rs|go|py|mjs|cjs))(?:$|\s|['"`)])/g;
|
|
46163
|
+
SYMBOL_PATTERN = /\b([a-zA-Z_][a-zA-Z0-9_]*(?:[A-Z][a-zA-Z0-9_]*)+|[a-zA-Z_]{4,}[a-zA-Z0-9_]*)\b/g;
|
|
46164
|
+
SYMBOL_STOP_WORDS = /* @__PURE__ */ new Set([
|
|
46165
|
+
"true",
|
|
46166
|
+
"false",
|
|
46167
|
+
"null",
|
|
46168
|
+
"undefined",
|
|
46169
|
+
"const",
|
|
46170
|
+
"async",
|
|
46171
|
+
"await",
|
|
46172
|
+
"return",
|
|
46173
|
+
"export",
|
|
46174
|
+
"import",
|
|
46175
|
+
"from",
|
|
46176
|
+
"type",
|
|
46177
|
+
"interface",
|
|
46178
|
+
"function",
|
|
46179
|
+
"class",
|
|
46180
|
+
"this",
|
|
46181
|
+
"super",
|
|
46182
|
+
"extends",
|
|
46183
|
+
"implements",
|
|
46184
|
+
"with",
|
|
46185
|
+
"that",
|
|
46186
|
+
"then",
|
|
46187
|
+
"when",
|
|
46188
|
+
"have",
|
|
46189
|
+
"been",
|
|
46190
|
+
"will",
|
|
46191
|
+
"should",
|
|
46192
|
+
"could",
|
|
46193
|
+
"would",
|
|
46194
|
+
"error",
|
|
46195
|
+
"result",
|
|
46196
|
+
"value",
|
|
46197
|
+
"data",
|
|
46198
|
+
"info",
|
|
46199
|
+
"note",
|
|
46200
|
+
"todo",
|
|
46201
|
+
"done",
|
|
46202
|
+
"fail",
|
|
46203
|
+
"pass"
|
|
46204
|
+
]);
|
|
46205
|
+
}
|
|
46206
|
+
});
|
|
46207
|
+
|
|
45824
46208
|
// packages/core/src/memory/brain-lifecycle.ts
|
|
45825
46209
|
var brain_lifecycle_exports = {};
|
|
45826
46210
|
__export(brain_lifecycle_exports, {
|
|
@@ -46120,6 +46504,13 @@ async function runConsolidation(projectRoot) {
|
|
|
46120
46504
|
} catch (err) {
|
|
46121
46505
|
console.warn("[consolidation] Step 7 summary generation failed:", err);
|
|
46122
46506
|
}
|
|
46507
|
+
try {
|
|
46508
|
+
const { autoLinkMemories: autoLinkMemories2 } = await Promise.resolve().then(() => (init_graph_memory_bridge(), graph_memory_bridge_exports));
|
|
46509
|
+
const bridgeResult = await autoLinkMemories2(projectRoot);
|
|
46510
|
+
result.graphLinksCreated = bridgeResult.linked;
|
|
46511
|
+
} catch (err) {
|
|
46512
|
+
console.warn("[consolidation] Step 8 graph memory bridge failed:", err);
|
|
46513
|
+
}
|
|
46123
46514
|
return result;
|
|
46124
46515
|
}
|
|
46125
46516
|
async function deduplicateByEmbedding(projectRoot) {
|
|
@@ -65809,6 +66200,19 @@ async function completeTask(options, cwd, accessor) {
|
|
|
65809
66200
|
})()
|
|
65810
66201
|
).catch(() => {
|
|
65811
66202
|
});
|
|
66203
|
+
try {
|
|
66204
|
+
const { hooks: hooks2 } = await Promise.resolve().then(() => (init_registry(), registry_exports));
|
|
66205
|
+
await hooks2.dispatch("PostToolUse", cwd ?? process.cwd(), {
|
|
66206
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
66207
|
+
taskId: options.taskId,
|
|
66208
|
+
taskTitle: task.title,
|
|
66209
|
+
previousStatus: before.status,
|
|
66210
|
+
newStatus: "done",
|
|
66211
|
+
unblockedCount: unblockedTasks.length
|
|
66212
|
+
}).catch(() => {
|
|
66213
|
+
});
|
|
66214
|
+
} catch {
|
|
66215
|
+
}
|
|
65812
66216
|
return {
|
|
65813
66217
|
task,
|
|
65814
66218
|
...autoCompleted.length > 0 && { autoCompleted },
|
|
@@ -118731,7 +119135,31 @@ async function orchestrateSpawnExecute(taskId, adapterId, protocolType, projectR
|
|
|
118731
119135
|
}
|
|
118732
119136
|
} catch {
|
|
118733
119137
|
}
|
|
119138
|
+
try {
|
|
119139
|
+
const { hooks: hooks2 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
119140
|
+
await hooks2.dispatch("SubagentStart", cwd, {
|
|
119141
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
119142
|
+
taskId,
|
|
119143
|
+
agentId: cleoSpawnContext.options?.preferredAgent ?? `worker-${taskId}`,
|
|
119144
|
+
role: protocolType || "worker",
|
|
119145
|
+
providerId: adapter.providerId
|
|
119146
|
+
}).catch(() => {
|
|
119147
|
+
});
|
|
119148
|
+
} catch {
|
|
119149
|
+
}
|
|
118734
119150
|
const result = await adapter.spawn(cleoSpawnContext);
|
|
119151
|
+
try {
|
|
119152
|
+
const { hooks: hooks2 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
119153
|
+
await hooks2.dispatch("SubagentStop", cwd, {
|
|
119154
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
119155
|
+
taskId,
|
|
119156
|
+
agentId: cleoSpawnContext.options?.preferredAgent ?? `worker-${taskId}`,
|
|
119157
|
+
status: result.status,
|
|
119158
|
+
instanceId: result.instanceId
|
|
119159
|
+
}).catch(() => {
|
|
119160
|
+
});
|
|
119161
|
+
} catch {
|
|
119162
|
+
}
|
|
118735
119163
|
void sendConduitEvent(cwd, "cleo-core", {
|
|
118736
119164
|
event: "agent.spawned",
|
|
118737
119165
|
taskId,
|
|
@@ -124218,8 +124646,8 @@ var init_memory2 = __esm({
|
|
|
124218
124646
|
return wrapResult(result, "query", "memory", operation, startTime);
|
|
124219
124647
|
}
|
|
124220
124648
|
case "code.links": {
|
|
124221
|
-
const { listCodeLinks } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
124222
|
-
const result = await
|
|
124649
|
+
const { listCodeLinks: listCodeLinks2 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
124650
|
+
const result = await listCodeLinks2(projectRoot);
|
|
124223
124651
|
return wrapResult(result, "query", "memory", operation, startTime);
|
|
124224
124652
|
}
|
|
124225
124653
|
case "code.memories-for-code": {
|
|
@@ -124227,8 +124655,8 @@ var init_memory2 = __esm({
|
|
|
124227
124655
|
if (!symbol2) {
|
|
124228
124656
|
return errorResult("query", "memory", operation, "E_INVALID_INPUT", "symbol is required", startTime);
|
|
124229
124657
|
}
|
|
124230
|
-
const { queryMemoriesForCode } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
124231
|
-
const result = await
|
|
124658
|
+
const { queryMemoriesForCode: queryMemoriesForCode2 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
124659
|
+
const result = await queryMemoriesForCode2(projectRoot, symbol2);
|
|
124232
124660
|
return wrapResult({ success: true, data: result }, "query", "memory", operation, startTime);
|
|
124233
124661
|
}
|
|
124234
124662
|
case "code.for-memory": {
|
|
@@ -124236,8 +124664,8 @@ var init_memory2 = __esm({
|
|
|
124236
124664
|
if (!memoryId) {
|
|
124237
124665
|
return errorResult("query", "memory", operation, "E_INVALID_INPUT", "memoryId is required", startTime);
|
|
124238
124666
|
}
|
|
124239
|
-
const { queryCodeForMemory } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
124240
|
-
const result = await
|
|
124667
|
+
const { queryCodeForMemory: queryCodeForMemory2 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
124668
|
+
const result = await queryCodeForMemory2(projectRoot, memoryId);
|
|
124241
124669
|
return wrapResult({ success: true, data: result }, "query", "memory", operation, startTime);
|
|
124242
124670
|
}
|
|
124243
124671
|
default:
|
|
@@ -124416,13 +124844,13 @@ var init_memory2 = __esm({
|
|
|
124416
124844
|
if (!memoryId || !codeSymbol) {
|
|
124417
124845
|
return errorResult("mutate", "memory", operation, "E_INVALID_INPUT", "memoryId and codeSymbol are required", startTime);
|
|
124418
124846
|
}
|
|
124419
|
-
const { linkMemoryToCode } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
124420
|
-
const linked = await
|
|
124847
|
+
const { linkMemoryToCode: linkMemoryToCode2 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
124848
|
+
const linked = await linkMemoryToCode2(projectRoot, memoryId, codeSymbol);
|
|
124421
124849
|
return wrapResult({ success: true, data: { linked } }, "mutate", "memory", operation, startTime);
|
|
124422
124850
|
}
|
|
124423
124851
|
case "code.auto-link": {
|
|
124424
|
-
const { autoLinkMemories } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
124425
|
-
const result = await
|
|
124852
|
+
const { autoLinkMemories: autoLinkMemories2 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
124853
|
+
const result = await autoLinkMemories2(projectRoot);
|
|
124426
124854
|
return wrapResult({ success: true, data: result }, "mutate", "memory", operation, startTime);
|
|
124427
124855
|
}
|
|
124428
124856
|
default:
|