agenr 0.12.2 → 0.12.3
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/CHANGELOG.md +8 -0
- package/dist/{chunk-YXHYBR54.js → chunk-HF26SPJ5.js} +21 -56
- package/dist/{chunk-D3DYUJKW.js → chunk-J7RWXEZR.js} +2 -2
- package/dist/{chunk-HMBONTF3.js → chunk-M52AGWZN.js} +59 -1
- package/dist/{chunk-L2CPAYHC.js → chunk-U2XR7TUK.js} +113 -4
- package/dist/{chunk-R2X5CMR3.js → chunk-UT7V3EX6.js} +2 -2
- package/dist/{chunk-YFOFO2FC.js → chunk-VULDJJZI.js} +1 -1
- package/dist/{classify-entries-XI6ACRFB.js → classify-entries-W6DZOUHK.js} +2 -2
- package/dist/cli-main.js +10 -10
- package/dist/{eval-defaults-KQT4VBA7.js → eval-defaults-EKBAJD6S.js} +1 -1
- package/dist/{maintain-5PS7LHYL.js → maintain-KK55GBPA.js} +4 -4
- package/dist/openclaw-plugin/index.js +10 -16
- package/dist/{workflow-CNIGIVEH.js → workflow-DR7B4JLP.js} +3 -3
- package/package.json +21 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.12.3] - 2026-03-22
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **Plugin DB tables in core schema.** `session_projects`, `seen_sessions`, and `session_identity_breadcrumbs` tables are now created as part of the main schema init, fixing `SQLITE_ERROR: no such table: session_projects` errors when calling `agenr_set_session_project` or `agenr_get_session_project`. Previously these tables depended on a lazy plugin-db init path that could fail to run.
|
|
8
|
+
- **Tool schema Codex compatibility.** Replaced `Type.Union([Type.Literal(...)])` with `Type.String({ enum: [...] })` for the `expiry` and recall `context` fields in tool schemas. Codex and other providers that reject `anyOf`/`oneOf` at top level now get clean schemas.
|
|
9
|
+
- **Support-aware cluster validation.** Consolidation cluster validation now uses support-aware entry resolution, preventing false merge candidates from stale or unsupported cluster assignments.
|
|
10
|
+
|
|
3
11
|
## [0.12.2] - 2026-03-22
|
|
4
12
|
|
|
5
13
|
### Recall Scoping Fixes
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
updateRecallMetadata,
|
|
23
23
|
validateAndNormalizeEntry,
|
|
24
24
|
withStoreSession
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-J7RWXEZR.js";
|
|
26
26
|
import {
|
|
27
27
|
resolveTargetProcessorDefaults
|
|
28
28
|
} from "./chunk-TXJKNB2Y.js";
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
resolveAppRuntimeDeps,
|
|
56
56
|
resolveDefaultAppRuntimeDeps,
|
|
57
57
|
withAppDb
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-VULDJJZI.js";
|
|
59
59
|
import {
|
|
60
60
|
shapeRecallText
|
|
61
61
|
} from "./chunk-W776WVZS.js";
|
|
@@ -69,6 +69,8 @@ import {
|
|
|
69
69
|
} from "./chunk-QDW77NBA.js";
|
|
70
70
|
import {
|
|
71
71
|
APP_VERSION,
|
|
72
|
+
OPENCLAW_PLUGIN_COLUMN_MIGRATIONS,
|
|
73
|
+
OPENCLAW_PLUGIN_SCHEMA_STATEMENTS,
|
|
72
74
|
clearBulkIngestMeta,
|
|
73
75
|
closeDb,
|
|
74
76
|
createLogger,
|
|
@@ -80,7 +82,7 @@ import {
|
|
|
80
82
|
rebuildVectorIndex2 as rebuildVectorIndex,
|
|
81
83
|
setBulkIngestMeta,
|
|
82
84
|
walCheckpoint
|
|
83
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-M52AGWZN.js";
|
|
84
86
|
import {
|
|
85
87
|
getRecallMetricsBatch
|
|
86
88
|
} from "./chunk-5JLYIHAQ.js";
|
|
@@ -190,7 +192,9 @@ function resolveOpenClawPluginDbDefaults() {
|
|
|
190
192
|
return {
|
|
191
193
|
getDb: shared.getDbFn,
|
|
192
194
|
initDb: shared.initDbFn,
|
|
193
|
-
closeDb: shared.closeDbFn
|
|
195
|
+
closeDb: shared.closeDbFn,
|
|
196
|
+
pluginSchemaStatements: OPENCLAW_PLUGIN_SCHEMA_STATEMENTS,
|
|
197
|
+
pluginColumnMigrations: OPENCLAW_PLUGIN_COLUMN_MIGRATIONS
|
|
194
198
|
};
|
|
195
199
|
}
|
|
196
200
|
function resolveOpenClawSignalDefaults() {
|
|
@@ -210,46 +214,6 @@ function resolveOpenClawHandoffDefaults() {
|
|
|
210
214
|
}
|
|
211
215
|
|
|
212
216
|
// src/openclaw-plugin/plugin-db.ts
|
|
213
|
-
var CREATE_SEEN_SESSIONS_TABLE_SQL = `
|
|
214
|
-
CREATE TABLE IF NOT EXISTS seen_sessions (
|
|
215
|
-
dedupe_key TEXT PRIMARY KEY,
|
|
216
|
-
seen_at INTEGER NOT NULL
|
|
217
|
-
)
|
|
218
|
-
`;
|
|
219
|
-
var CREATE_SEEN_SESSIONS_SEEN_AT_INDEX_SQL = `
|
|
220
|
-
CREATE INDEX IF NOT EXISTS idx_seen_sessions_seen_at
|
|
221
|
-
ON seen_sessions(seen_at)
|
|
222
|
-
`;
|
|
223
|
-
var CREATE_SESSION_PROJECTS_TABLE_SQL = `
|
|
224
|
-
CREATE TABLE IF NOT EXISTS session_projects (
|
|
225
|
-
session_key TEXT PRIMARY KEY,
|
|
226
|
-
project TEXT NOT NULL,
|
|
227
|
-
state TEXT NOT NULL DEFAULT 'set',
|
|
228
|
-
updated_at TEXT NOT NULL
|
|
229
|
-
)
|
|
230
|
-
`;
|
|
231
|
-
var CREATE_SESSION_IDENTITY_BREADCRUMBS_TABLE_SQL = `
|
|
232
|
-
CREATE TABLE IF NOT EXISTS session_identity_breadcrumbs (
|
|
233
|
-
session_id TEXT PRIMARY KEY,
|
|
234
|
-
session_key TEXT,
|
|
235
|
-
family TEXT NOT NULL,
|
|
236
|
-
lane_id TEXT,
|
|
237
|
-
origin_surface TEXT,
|
|
238
|
-
delivery_channel TEXT,
|
|
239
|
-
family_source TEXT,
|
|
240
|
-
lane_source TEXT,
|
|
241
|
-
created_at TEXT NOT NULL,
|
|
242
|
-
updated_at TEXT NOT NULL
|
|
243
|
-
)
|
|
244
|
-
`;
|
|
245
|
-
var CREATE_SESSION_IDENTITY_BREADCRUMBS_UPDATED_AT_INDEX_SQL = `
|
|
246
|
-
CREATE INDEX IF NOT EXISTS idx_session_identity_breadcrumbs_updated_at
|
|
247
|
-
ON session_identity_breadcrumbs(updated_at)
|
|
248
|
-
`;
|
|
249
|
-
var ADD_SESSION_PROJECT_STATE_COLUMN_SQL = `
|
|
250
|
-
ALTER TABLE session_projects
|
|
251
|
-
ADD COLUMN state TEXT NOT NULL DEFAULT 'set'
|
|
252
|
-
`;
|
|
253
217
|
var PLUGIN_DB_STATE_KEY = "__agenrOpenClawPluginDbState";
|
|
254
218
|
function getPluginDbState() {
|
|
255
219
|
const globalState = globalThis;
|
|
@@ -269,18 +233,19 @@ function closePluginDbState(state) {
|
|
|
269
233
|
state.init = null;
|
|
270
234
|
}
|
|
271
235
|
async function ensurePluginDbTables(client) {
|
|
272
|
-
|
|
273
|
-
await
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
236
|
+
const defaults = resolveOpenClawPluginDbDefaults();
|
|
237
|
+
await defaults.initDb(client);
|
|
238
|
+
for (const statement of defaults.pluginSchemaStatements) {
|
|
239
|
+
await client.execute(statement);
|
|
240
|
+
}
|
|
241
|
+
for (const migration of defaults.pluginColumnMigrations) {
|
|
242
|
+
const tableInfo = await client.execute(`PRAGMA table_info(${migration.table})`);
|
|
243
|
+
const hasColumn = tableInfo.rows.some(
|
|
244
|
+
(row) => String(row.name) === migration.column
|
|
245
|
+
);
|
|
246
|
+
if (!hasColumn) {
|
|
247
|
+
await client.execute(migration.sql);
|
|
248
|
+
}
|
|
284
249
|
}
|
|
285
250
|
}
|
|
286
251
|
function registerDbShutdown(state) {
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
createAppRuntime,
|
|
48
48
|
readAppDbSession,
|
|
49
49
|
resolveDefaultAppRuntimeDeps
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-VULDJJZI.js";
|
|
51
51
|
import {
|
|
52
52
|
mapStoredEntry,
|
|
53
53
|
shapeRecallText
|
|
@@ -65,7 +65,7 @@ import {
|
|
|
65
65
|
import {
|
|
66
66
|
createLogger,
|
|
67
67
|
walCheckpoint
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-M52AGWZN.js";
|
|
69
69
|
import {
|
|
70
70
|
DEFAULT_TASK_MODEL,
|
|
71
71
|
resolveClaimExtractionBatchSize,
|
|
@@ -105,6 +105,60 @@ var CREATE_ENTRIES_FTS_TRIGGER_AU_SQL = `
|
|
|
105
105
|
WHERE new.retired = 0 AND new.superseded_by IS NULL;
|
|
106
106
|
END
|
|
107
107
|
`;
|
|
108
|
+
var CREATE_SEEN_SESSIONS_TABLE_SQL = `
|
|
109
|
+
CREATE TABLE IF NOT EXISTS seen_sessions (
|
|
110
|
+
dedupe_key TEXT PRIMARY KEY,
|
|
111
|
+
seen_at INTEGER NOT NULL
|
|
112
|
+
)
|
|
113
|
+
`;
|
|
114
|
+
var CREATE_SEEN_SESSIONS_SEEN_AT_INDEX_SQL = `
|
|
115
|
+
CREATE INDEX IF NOT EXISTS idx_seen_sessions_seen_at
|
|
116
|
+
ON seen_sessions(seen_at)
|
|
117
|
+
`;
|
|
118
|
+
var CREATE_SESSION_PROJECTS_TABLE_SQL = `
|
|
119
|
+
CREATE TABLE IF NOT EXISTS session_projects (
|
|
120
|
+
session_key TEXT PRIMARY KEY,
|
|
121
|
+
project TEXT NOT NULL,
|
|
122
|
+
state TEXT NOT NULL DEFAULT 'set',
|
|
123
|
+
updated_at TEXT NOT NULL
|
|
124
|
+
)
|
|
125
|
+
`;
|
|
126
|
+
var CREATE_SESSION_IDENTITY_BREADCRUMBS_TABLE_SQL = `
|
|
127
|
+
CREATE TABLE IF NOT EXISTS session_identity_breadcrumbs (
|
|
128
|
+
session_id TEXT PRIMARY KEY,
|
|
129
|
+
session_key TEXT,
|
|
130
|
+
family TEXT NOT NULL,
|
|
131
|
+
lane_id TEXT,
|
|
132
|
+
origin_surface TEXT,
|
|
133
|
+
delivery_channel TEXT,
|
|
134
|
+
family_source TEXT,
|
|
135
|
+
lane_source TEXT,
|
|
136
|
+
created_at TEXT NOT NULL,
|
|
137
|
+
updated_at TEXT NOT NULL
|
|
138
|
+
)
|
|
139
|
+
`;
|
|
140
|
+
var CREATE_SESSION_IDENTITY_BREADCRUMBS_UPDATED_AT_INDEX_SQL = `
|
|
141
|
+
CREATE INDEX IF NOT EXISTS idx_session_identity_breadcrumbs_updated_at
|
|
142
|
+
ON session_identity_breadcrumbs(updated_at)
|
|
143
|
+
`;
|
|
144
|
+
var ADD_SESSION_PROJECT_STATE_COLUMN_SQL = `
|
|
145
|
+
ALTER TABLE session_projects
|
|
146
|
+
ADD COLUMN state TEXT NOT NULL DEFAULT 'set'
|
|
147
|
+
`;
|
|
148
|
+
var OPENCLAW_PLUGIN_SCHEMA_STATEMENTS = [
|
|
149
|
+
CREATE_SEEN_SESSIONS_TABLE_SQL,
|
|
150
|
+
CREATE_SEEN_SESSIONS_SEEN_AT_INDEX_SQL,
|
|
151
|
+
CREATE_SESSION_PROJECTS_TABLE_SQL,
|
|
152
|
+
CREATE_SESSION_IDENTITY_BREADCRUMBS_TABLE_SQL,
|
|
153
|
+
CREATE_SESSION_IDENTITY_BREADCRUMBS_UPDATED_AT_INDEX_SQL
|
|
154
|
+
];
|
|
155
|
+
var OPENCLAW_PLUGIN_COLUMN_MIGRATIONS = [
|
|
156
|
+
{
|
|
157
|
+
table: "session_projects",
|
|
158
|
+
column: "state",
|
|
159
|
+
sql: ADD_SESSION_PROJECT_STATE_COLUMN_SQL
|
|
160
|
+
}
|
|
161
|
+
];
|
|
108
162
|
var CREATE_TABLE_AND_TRIGGER_STATEMENTS = [
|
|
109
163
|
`
|
|
110
164
|
CREATE TABLE IF NOT EXISTS _meta (
|
|
@@ -378,9 +432,11 @@ var CREATE_TABLE_AND_TRIGGER_STATEMENTS = [
|
|
|
378
432
|
CREATE_ENTRIES_FTS_TABLE_SQL,
|
|
379
433
|
CREATE_ENTRIES_FTS_TRIGGER_AI_SQL,
|
|
380
434
|
CREATE_ENTRIES_FTS_TRIGGER_AD_SQL,
|
|
381
|
-
CREATE_ENTRIES_FTS_TRIGGER_AU_SQL
|
|
435
|
+
CREATE_ENTRIES_FTS_TRIGGER_AU_SQL,
|
|
436
|
+
...OPENCLAW_PLUGIN_SCHEMA_STATEMENTS
|
|
382
437
|
];
|
|
383
438
|
var COLUMN_MIGRATIONS = [
|
|
439
|
+
...OPENCLAW_PLUGIN_COLUMN_MIGRATIONS,
|
|
384
440
|
{
|
|
385
441
|
table: "co_recall_edges",
|
|
386
442
|
column: "edge_type",
|
|
@@ -1808,6 +1864,8 @@ function closeDb(client) {
|
|
|
1808
1864
|
export {
|
|
1809
1865
|
APP_VERSION,
|
|
1810
1866
|
createLogger,
|
|
1867
|
+
OPENCLAW_PLUGIN_SCHEMA_STATEMENTS,
|
|
1868
|
+
OPENCLAW_PLUGIN_COLUMN_MIGRATIONS,
|
|
1811
1869
|
getVectorIndexShadowStats,
|
|
1812
1870
|
rebuildVectorIndex,
|
|
1813
1871
|
dropFtsTriggersAndIndex,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
resolveHigherExpiry,
|
|
12
12
|
resolveHighestExpiry,
|
|
13
13
|
runSimpleStream
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-J7RWXEZR.js";
|
|
15
15
|
import {
|
|
16
16
|
deleteCoRecallEdgesForEntryIds
|
|
17
17
|
} from "./chunk-BXN5MMRG.js";
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
import {
|
|
28
28
|
isShutdownRequested,
|
|
29
29
|
resolveDefaultAppRuntimeDeps
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-VULDJJZI.js";
|
|
31
31
|
import {
|
|
32
32
|
isRecord
|
|
33
33
|
} from "./chunk-IVDSYJNR.js";
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
createLogger,
|
|
42
42
|
rebuildVectorIndex,
|
|
43
43
|
walCheckpoint
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-M52AGWZN.js";
|
|
45
45
|
import {
|
|
46
46
|
cosineSimilarity,
|
|
47
47
|
mapBufferToVector
|
|
@@ -388,6 +388,75 @@ function averageEmbedding(embeddings) {
|
|
|
388
388
|
}
|
|
389
389
|
return sums.map((sum) => sum / count);
|
|
390
390
|
}
|
|
391
|
+
var FLOAT_TIE_EPSILON = 1e-9;
|
|
392
|
+
function buildSimilarityCache(group) {
|
|
393
|
+
const pairwiseSimilarityById = /* @__PURE__ */ new Map();
|
|
394
|
+
for (const entry of group) {
|
|
395
|
+
pairwiseSimilarityById.set(entry.id, /* @__PURE__ */ new Map());
|
|
396
|
+
}
|
|
397
|
+
for (let i = 0; i < group.length; i += 1) {
|
|
398
|
+
const left = group[i];
|
|
399
|
+
const leftSims = pairwiseSimilarityById.get(left.id);
|
|
400
|
+
if (!leftSims) {
|
|
401
|
+
continue;
|
|
402
|
+
}
|
|
403
|
+
for (let j = i + 1; j < group.length; j += 1) {
|
|
404
|
+
const right = group[j];
|
|
405
|
+
const sim = cosineSim(left.embedding, right.embedding);
|
|
406
|
+
leftSims.set(right.id, sim);
|
|
407
|
+
const rightSims = pairwiseSimilarityById.get(right.id);
|
|
408
|
+
if (rightSims) {
|
|
409
|
+
rightSims.set(left.id, sim);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return { pairwiseSimilarityById };
|
|
414
|
+
}
|
|
415
|
+
function getCachedSimilarity(cache, leftId, rightId) {
|
|
416
|
+
if (leftId === rightId) {
|
|
417
|
+
return 1;
|
|
418
|
+
}
|
|
419
|
+
return cache.pairwiseSimilarityById.get(leftId)?.get(rightId) ?? 0;
|
|
420
|
+
}
|
|
421
|
+
function buildValidationMetrics(current, cache, supportGraph) {
|
|
422
|
+
const currentIds = new Set(current.map((entry) => entry.id));
|
|
423
|
+
const metrics = /* @__PURE__ */ new Map();
|
|
424
|
+
for (const entry of current) {
|
|
425
|
+
const others = current.filter((candidate) => candidate.id !== entry.id);
|
|
426
|
+
const averageSimilarity = others.length > 0 ? others.reduce((sum, candidate) => sum + getCachedSimilarity(cache, entry.id, candidate.id), 0) / others.length : 0;
|
|
427
|
+
const supportCount = Array.from(supportGraph.get(entry.id) ?? []).filter((candidateId) => currentIds.has(candidateId)).length;
|
|
428
|
+
metrics.set(entry.id, {
|
|
429
|
+
supportCount,
|
|
430
|
+
averageSimilarity,
|
|
431
|
+
usageScore: entry.confirmations + entry.recallCount
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
return metrics;
|
|
435
|
+
}
|
|
436
|
+
function compareValidationRank(left, right, metrics) {
|
|
437
|
+
const leftMetrics = metrics.get(left.id);
|
|
438
|
+
const rightMetrics = metrics.get(right.id);
|
|
439
|
+
if (!leftMetrics || !rightMetrics) {
|
|
440
|
+
return left.id.localeCompare(right.id);
|
|
441
|
+
}
|
|
442
|
+
if (leftMetrics.supportCount !== rightMetrics.supportCount) {
|
|
443
|
+
return rightMetrics.supportCount - leftMetrics.supportCount;
|
|
444
|
+
}
|
|
445
|
+
if (Math.abs(leftMetrics.averageSimilarity - rightMetrics.averageSimilarity) > FLOAT_TIE_EPSILON) {
|
|
446
|
+
return rightMetrics.averageSimilarity - leftMetrics.averageSimilarity;
|
|
447
|
+
}
|
|
448
|
+
if (leftMetrics.usageScore !== rightMetrics.usageScore) {
|
|
449
|
+
return rightMetrics.usageScore - leftMetrics.usageScore;
|
|
450
|
+
}
|
|
451
|
+
return left.id.localeCompare(right.id);
|
|
452
|
+
}
|
|
453
|
+
function removeWeakestEntryByRank(current, metrics) {
|
|
454
|
+
const ranked = [...current].sort((left, right) => compareValidationRank(left, right, metrics));
|
|
455
|
+
return ranked.slice(0, Math.max(0, ranked.length - 1));
|
|
456
|
+
}
|
|
457
|
+
function selectWeakerEntryFromPair(left, right, metrics) {
|
|
458
|
+
return compareValidationRank(left, right, metrics) <= 0 ? right : left;
|
|
459
|
+
}
|
|
391
460
|
function validateCluster(group, maxSize, diameterFloor) {
|
|
392
461
|
let current = [...group];
|
|
393
462
|
if (current.length > maxSize) {
|
|
@@ -422,6 +491,35 @@ function validateCluster(group, maxSize, diameterFloor) {
|
|
|
422
491
|
}
|
|
423
492
|
return current;
|
|
424
493
|
}
|
|
494
|
+
function validateClusterWithSupport(group, maxSize, diameterFloor, supportGraph) {
|
|
495
|
+
let current = [...group];
|
|
496
|
+
const similarityCache = buildSimilarityCache(group);
|
|
497
|
+
while (current.length > maxSize) {
|
|
498
|
+
const metrics = buildValidationMetrics(current, similarityCache, supportGraph);
|
|
499
|
+
current = removeWeakestEntryByRank(current, metrics);
|
|
500
|
+
}
|
|
501
|
+
let maxIterations = current.length;
|
|
502
|
+
while (current.length >= 2 && maxIterations-- > 0) {
|
|
503
|
+
let worstPairSim = 1;
|
|
504
|
+
let worstPair = null;
|
|
505
|
+
for (let i = 0; i < current.length; i += 1) {
|
|
506
|
+
for (let j = i + 1; j < current.length; j += 1) {
|
|
507
|
+
const sim = getCachedSimilarity(similarityCache, current[i].id, current[j].id);
|
|
508
|
+
if (sim < worstPairSim) {
|
|
509
|
+
worstPairSim = sim;
|
|
510
|
+
worstPair = [current[i], current[j]];
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
if (worstPairSim >= diameterFloor || !worstPair) {
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
517
|
+
const metrics = buildValidationMetrics(current, similarityCache, supportGraph);
|
|
518
|
+
const weaker = selectWeakerEntryFromPair(worstPair[0], worstPair[1], metrics);
|
|
519
|
+
current = current.filter((entry) => entry.id !== weaker.id);
|
|
520
|
+
}
|
|
521
|
+
return current;
|
|
522
|
+
}
|
|
425
523
|
|
|
426
524
|
// src/app/consolidate/rules.ts
|
|
427
525
|
var EXPIRE_THRESHOLD = 0.05;
|
|
@@ -2109,6 +2207,14 @@ function parseDaysSince(value, now) {
|
|
|
2109
2207
|
}
|
|
2110
2208
|
return (now.getTime() - parsed.getTime()) / MILLISECONDS_PER_DAY;
|
|
2111
2209
|
}
|
|
2210
|
+
function addSupportEdge(graph, leftId, rightId) {
|
|
2211
|
+
const leftNeighbors = graph.get(leftId) ?? /* @__PURE__ */ new Set();
|
|
2212
|
+
leftNeighbors.add(rightId);
|
|
2213
|
+
graph.set(leftId, leftNeighbors);
|
|
2214
|
+
const rightNeighbors = graph.get(rightId) ?? /* @__PURE__ */ new Set();
|
|
2215
|
+
rightNeighbors.add(leftId);
|
|
2216
|
+
graph.set(rightId, rightNeighbors);
|
|
2217
|
+
}
|
|
2112
2218
|
function mapActiveEmbeddedEntry(row) {
|
|
2113
2219
|
const id = toStringValue(row.id);
|
|
2114
2220
|
const embedding = mapBufferToVector(row.embedding);
|
|
@@ -2230,6 +2336,7 @@ async function buildClusters(db, options = {}) {
|
|
|
2230
2336
|
return [];
|
|
2231
2337
|
}
|
|
2232
2338
|
const unionFind = new UnionFind();
|
|
2339
|
+
const supportGraph = /* @__PURE__ */ new Map();
|
|
2233
2340
|
for (const entry of candidates) {
|
|
2234
2341
|
unionFind.add(entry.id);
|
|
2235
2342
|
}
|
|
@@ -2243,6 +2350,7 @@ async function buildClusters(db, options = {}) {
|
|
|
2243
2350
|
}
|
|
2244
2351
|
if (structuredDecision === "same_claim") {
|
|
2245
2352
|
unionFind.union(entry.id, candidate.id);
|
|
2353
|
+
addSupportEdge(supportGraph, entry.id, candidate.id);
|
|
2246
2354
|
continue;
|
|
2247
2355
|
}
|
|
2248
2356
|
const similarity = cosineSim(entry.embedding, candidate.embedding);
|
|
@@ -2250,6 +2358,7 @@ async function buildClusters(db, options = {}) {
|
|
|
2250
2358
|
const sameSubject = normalizeSubject3(entry.subject) === normalizeSubject3(candidate.subject);
|
|
2251
2359
|
if (sameType && similarity >= simThreshold || sameSubject && similarity >= CROSS_TYPE_SUBJECT_THRESHOLD) {
|
|
2252
2360
|
unionFind.union(entry.id, candidate.id);
|
|
2361
|
+
addSupportEdge(supportGraph, entry.id, candidate.id);
|
|
2253
2362
|
}
|
|
2254
2363
|
}
|
|
2255
2364
|
}
|
|
@@ -2270,7 +2379,7 @@ async function buildClusters(db, options = {}) {
|
|
|
2270
2379
|
clusters.push({ entries: group });
|
|
2271
2380
|
continue;
|
|
2272
2381
|
}
|
|
2273
|
-
const validated =
|
|
2382
|
+
const validated = validateClusterWithSupport(group, maxClusterSize, diameterFloor, supportGraph);
|
|
2274
2383
|
if (validated.length < minCluster) {
|
|
2275
2384
|
continue;
|
|
2276
2385
|
}
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
createAppRuntime,
|
|
17
17
|
resolveDefaultAppRuntimeDeps
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-VULDJJZI.js";
|
|
19
19
|
import {
|
|
20
20
|
backupDb,
|
|
21
21
|
buildBackupPath,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
rebuildVectorIndex,
|
|
24
24
|
resetDb,
|
|
25
25
|
walCheckpoint
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-M52AGWZN.js";
|
|
27
27
|
import {
|
|
28
28
|
readConfig,
|
|
29
29
|
resolveConfigDir,
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
} from "./chunk-5645B45W.js";
|
|
5
5
|
import {
|
|
6
6
|
withAppDb
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-VULDJJZI.js";
|
|
8
|
+
import "./chunk-M52AGWZN.js";
|
|
9
9
|
import "./chunk-V5SX4AI7.js";
|
|
10
10
|
import "./chunk-YYZIBBIX.js";
|
|
11
11
|
import {
|
package/dist/cli-main.js
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
resolveRetirementGracePeriod,
|
|
19
19
|
toConflictLogRow,
|
|
20
20
|
toRecord
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-U2XR7TUK.js";
|
|
22
22
|
import {
|
|
23
23
|
resolveDefaultRetireEntriesFn
|
|
24
24
|
} from "./chunk-BX5JHADB.js";
|
|
@@ -76,7 +76,7 @@ import {
|
|
|
76
76
|
sessionStartRecall,
|
|
77
77
|
storeAgentEntries,
|
|
78
78
|
storeEntries
|
|
79
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-HF26SPJ5.js";
|
|
80
80
|
import {
|
|
81
81
|
BLOCKED_SUBJECTS,
|
|
82
82
|
DEFAULT_AROUND_RADIUS_DAYS,
|
|
@@ -106,7 +106,7 @@ import {
|
|
|
106
106
|
validateEmbedding,
|
|
107
107
|
warnIfLocked,
|
|
108
108
|
withStoreSession
|
|
109
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-J7RWXEZR.js";
|
|
110
110
|
import {
|
|
111
111
|
deleteCoRecallEdgesForEntryIds,
|
|
112
112
|
retireEntries
|
|
@@ -140,7 +140,7 @@ import {
|
|
|
140
140
|
runDbStatsCommand,
|
|
141
141
|
runDbVersionCommand,
|
|
142
142
|
runResetCommand
|
|
143
|
-
} from "./chunk-
|
|
143
|
+
} from "./chunk-UT7V3EX6.js";
|
|
144
144
|
import {
|
|
145
145
|
WATCHER_DEMOTED_TAG,
|
|
146
146
|
resolveOpenClawWatcherDemotionConfig
|
|
@@ -177,7 +177,7 @@ import {
|
|
|
177
177
|
resolveAppRuntimeDeps,
|
|
178
178
|
resolveDefaultAppRuntimeDeps,
|
|
179
179
|
runShutdownHandlers
|
|
180
|
-
} from "./chunk-
|
|
180
|
+
} from "./chunk-VULDJJZI.js";
|
|
181
181
|
import {
|
|
182
182
|
isRecord
|
|
183
183
|
} from "./chunk-IVDSYJNR.js";
|
|
@@ -205,7 +205,7 @@ import {
|
|
|
205
205
|
getDb,
|
|
206
206
|
initDb,
|
|
207
207
|
walCheckpoint
|
|
208
|
-
} from "./chunk-
|
|
208
|
+
} from "./chunk-M52AGWZN.js";
|
|
209
209
|
import {
|
|
210
210
|
getRecallMetricsBatch
|
|
211
211
|
} from "./chunk-5JLYIHAQ.js";
|
|
@@ -11378,7 +11378,7 @@ async function runEvalWorkflow(request, deps = {}) {
|
|
|
11378
11378
|
if (request.saveBaseline && request.compare) {
|
|
11379
11379
|
throw new Error("Use either --save-baseline or --compare, not both.");
|
|
11380
11380
|
}
|
|
11381
|
-
const { resolveEvalDefaults } = await import("./eval-defaults-
|
|
11381
|
+
const { resolveEvalDefaults } = await import("./eval-defaults-EKBAJD6S.js");
|
|
11382
11382
|
const defaults = resolveEvalDefaults();
|
|
11383
11383
|
const resolvedDeps = {
|
|
11384
11384
|
readConfigFn: deps.readConfigFn ?? defaults.readConfigFn,
|
|
@@ -22215,12 +22215,12 @@ function registerMaintainCommand(program) {
|
|
|
22215
22215
|
"--only <tasks>",
|
|
22216
22216
|
"Comma-separated task names: quality,conflicts,consolidation,retire-superseded,retirement"
|
|
22217
22217
|
).option("--verbose", "Show detailed per-task output").action(async (opts) => {
|
|
22218
|
-
const { runMaintainCommand } = await import("./maintain-
|
|
22218
|
+
const { runMaintainCommand } = await import("./maintain-KK55GBPA.js");
|
|
22219
22219
|
const result = await runMaintainCommand(opts);
|
|
22220
22220
|
process.exitCode = result.exitCode;
|
|
22221
22221
|
});
|
|
22222
22222
|
maintainCommand.command("history").description("Show past maintenance runs").option("--db <path>", "Database path override").option("--limit <n>", "Max runs to show (default: 10)", parseIntOption).option("--json", "Output as JSON").action(async (opts) => {
|
|
22223
|
-
const { runMaintainHistoryCommand } = await import("./maintain-
|
|
22223
|
+
const { runMaintainHistoryCommand } = await import("./maintain-KK55GBPA.js");
|
|
22224
22224
|
const result = await runMaintainHistoryCommand(opts);
|
|
22225
22225
|
process.exitCode = result.exitCode;
|
|
22226
22226
|
});
|
|
@@ -22230,7 +22230,7 @@ function registerMaintainCommand(program) {
|
|
|
22230
22230
|
function registerMaintenanceCommand(program) {
|
|
22231
22231
|
const maintenanceCommand = program.command("maintenance").description("Run deterministic metadata maintenance tasks");
|
|
22232
22232
|
maintenanceCommand.command("classify-entries").description("Backfill entry kind, temporal class, and tag-derived project metadata").option("--db <path>", "Database path override").option("--dry-run", "Show what would change without writing", false).option("--batch-size <n>", "Entries per batch", parseIntOption, 100).action(async (opts) => {
|
|
22233
|
-
const { runClassifyEntriesCommand } = await import("./classify-entries-
|
|
22233
|
+
const { runClassifyEntriesCommand } = await import("./classify-entries-W6DZOUHK.js");
|
|
22234
22234
|
const result = await runClassifyEntriesCommand(opts);
|
|
22235
22235
|
process.exitCode = result.exitCode;
|
|
22236
22236
|
});
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
resolveRetirementGracePeriod,
|
|
37
37
|
runConsolidationOrchestrator,
|
|
38
38
|
toRecord
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-U2XR7TUK.js";
|
|
40
40
|
import {
|
|
41
41
|
acquireDbLock,
|
|
42
42
|
classifyStructuredConflictPair,
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
releaseDbLock,
|
|
46
46
|
resolveModelForLlmClient,
|
|
47
47
|
runSimpleStream
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-J7RWXEZR.js";
|
|
49
49
|
import {
|
|
50
50
|
deleteCoRecallEdgesForEntryIds
|
|
51
51
|
} from "./chunk-BXN5MMRG.js";
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
} from "./chunk-H34G5ZCO.js";
|
|
65
65
|
import {
|
|
66
66
|
resolveDefaultAppRuntimeDeps
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-VULDJJZI.js";
|
|
68
68
|
import "./chunk-IVDSYJNR.js";
|
|
69
69
|
import "./chunk-PLKJCOGB.js";
|
|
70
70
|
import "./chunk-W776WVZS.js";
|
|
@@ -78,7 +78,7 @@ import {
|
|
|
78
78
|
getVectorIndexShadowStats,
|
|
79
79
|
rebuildVectorIndex,
|
|
80
80
|
walCheckpoint
|
|
81
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-M52AGWZN.js";
|
|
82
82
|
import "./chunk-5JLYIHAQ.js";
|
|
83
83
|
import {
|
|
84
84
|
DEFAULT_TASK_MODEL
|
|
@@ -33,13 +33,13 @@ import {
|
|
|
33
33
|
searchRecall,
|
|
34
34
|
sessionStartRecall,
|
|
35
35
|
setSessionProject
|
|
36
|
-
} from "../chunk-
|
|
36
|
+
} from "../chunk-HF26SPJ5.js";
|
|
37
37
|
import {
|
|
38
38
|
normalizeExpiry,
|
|
39
39
|
parsePositiveInt,
|
|
40
40
|
sanitizeInjectedContextText,
|
|
41
41
|
stripInjectedContext
|
|
42
|
-
} from "../chunk-
|
|
42
|
+
} from "../chunk-J7RWXEZR.js";
|
|
43
43
|
import "../chunk-BXN5MMRG.js";
|
|
44
44
|
import "../chunk-TXJKNB2Y.js";
|
|
45
45
|
import "../chunk-IMKGWRRR.js";
|
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
} from "../chunk-H34G5ZCO.js";
|
|
58
58
|
import {
|
|
59
59
|
createAppDbSession
|
|
60
|
-
} from "../chunk-
|
|
60
|
+
} from "../chunk-VULDJJZI.js";
|
|
61
61
|
import {
|
|
62
62
|
isRecord
|
|
63
63
|
} from "../chunk-IVDSYJNR.js";
|
|
@@ -66,7 +66,7 @@ import "../chunk-W776WVZS.js";
|
|
|
66
66
|
import "../chunk-QDW77NBA.js";
|
|
67
67
|
import {
|
|
68
68
|
createLogger
|
|
69
|
-
} from "../chunk-
|
|
69
|
+
} from "../chunk-M52AGWZN.js";
|
|
70
70
|
import "../chunk-5JLYIHAQ.js";
|
|
71
71
|
import {
|
|
72
72
|
readConfig,
|
|
@@ -8931,7 +8931,7 @@ async function handleBeforeReset(event, ctx, params) {
|
|
|
8931
8931
|
const state = peekMidSessionState(metricsSessionKey);
|
|
8932
8932
|
if (state) {
|
|
8933
8933
|
try {
|
|
8934
|
-
const { appendSessionStoreMetricsRecord } = await import("../workflow-
|
|
8934
|
+
const { appendSessionStoreMetricsRecord } = await import("../workflow-DR7B4JLP.js");
|
|
8935
8935
|
await appendSessionStoreMetricsRecord({
|
|
8936
8936
|
sessionKey,
|
|
8937
8937
|
platform: "openclaw",
|
|
@@ -9175,11 +9175,7 @@ async function runClearSessionProjectTool(sessionKey, pluginConfig) {
|
|
|
9175
9175
|
}
|
|
9176
9176
|
|
|
9177
9177
|
// src/openclaw-plugin/hooks/register-tools.ts
|
|
9178
|
-
var EXPIRY_SCHEMA = Type.
|
|
9179
|
-
Type.Literal("core"),
|
|
9180
|
-
Type.Literal("permanent"),
|
|
9181
|
-
Type.Literal("temporary")
|
|
9182
|
-
]);
|
|
9178
|
+
var EXPIRY_SCHEMA = Type.String({ enum: ["core", "permanent", "temporary"] });
|
|
9183
9179
|
function optionalExpirySchema(description) {
|
|
9184
9180
|
return Type.Optional({
|
|
9185
9181
|
...EXPIRY_SCHEMA,
|
|
@@ -9225,12 +9221,10 @@ function registerAgenrTools(api, params) {
|
|
|
9225
9221
|
parameters: Type.Object({
|
|
9226
9222
|
query: Type.Optional(Type.String({ description: "What to search for." })),
|
|
9227
9223
|
context: Type.Optional(
|
|
9228
|
-
Type.
|
|
9229
|
-
[
|
|
9230
|
-
|
|
9231
|
-
|
|
9232
|
-
}
|
|
9233
|
-
)
|
|
9224
|
+
Type.String({
|
|
9225
|
+
enum: ["default", "session-start", "browse"],
|
|
9226
|
+
description: "Use session-start for fast bootstrap without embedding. Use browse for recency-dominant temporal browsing with secondary importance tie-breaking (no query needed, no semantic search)."
|
|
9227
|
+
})
|
|
9234
9228
|
),
|
|
9235
9229
|
limit: Type.Optional(Type.Number({ description: "Max results (default: 10)." })),
|
|
9236
9230
|
types: Type.Optional(Type.String({ description: "Comma-separated entry types to filter." })),
|
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
readMetricsRecords,
|
|
6
6
|
resolveSessionStoreMetricsLogPath,
|
|
7
7
|
runDbSessionStoreMetrics
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-UT7V3EX6.js";
|
|
9
9
|
import "./chunk-CUCVRI3K.js";
|
|
10
10
|
import "./chunk-P742N37X.js";
|
|
11
11
|
import "./chunk-O72E3MNJ.js";
|
|
12
12
|
import "./chunk-H34G5ZCO.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-VULDJJZI.js";
|
|
14
14
|
import "./chunk-IVDSYJNR.js";
|
|
15
15
|
import "./chunk-PLKJCOGB.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-M52AGWZN.js";
|
|
17
17
|
import "./chunk-5JLYIHAQ.js";
|
|
18
18
|
import "./chunk-V5SX4AI7.js";
|
|
19
19
|
import "./chunk-YYZIBBIX.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agenr",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.3",
|
|
4
4
|
"openclaw": {
|
|
5
5
|
"extensions": [
|
|
6
6
|
"dist/openclaw-plugin/index.js"
|
|
@@ -11,6 +11,21 @@
|
|
|
11
11
|
"bin": {
|
|
12
12
|
"agenr": "dist/cli.js"
|
|
13
13
|
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsup src/cli.ts src/cli-main.ts src/openclaw-plugin/index.ts --format esm --dts --clean && tsup src/openclaw-plugin/index.ts --format esm --dts --no-splitting --outDir dist-plugin",
|
|
16
|
+
"build:plugin": "tsup src/openclaw-plugin/index.ts --format esm --dts --no-splitting --outDir dist-plugin && node scripts/build-plugin-package.js",
|
|
17
|
+
"publish:plugin": "pnpm build:plugin && cd dist-plugin-package && npm publish --access public",
|
|
18
|
+
"check": "pnpm format:check && pnpm lint && pnpm typecheck && pnpm test",
|
|
19
|
+
"dev": "tsup src/cli.ts src/cli-main.ts --format esm --watch",
|
|
20
|
+
"lint": "eslint .",
|
|
21
|
+
"format": "prettier --write .",
|
|
22
|
+
"format:check": "prettier --check .",
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"test:watch": "vitest",
|
|
25
|
+
"typecheck": "tsc --noEmit",
|
|
26
|
+
"verify:dist": "node scripts/verify-dist.js",
|
|
27
|
+
"prepack": "pnpm build && pnpm verify:dist"
|
|
28
|
+
},
|
|
14
29
|
"dependencies": {
|
|
15
30
|
"@clack/prompts": "^1.1.0",
|
|
16
31
|
"@libsql/client": "^0.17.2",
|
|
@@ -59,18 +74,9 @@
|
|
|
59
74
|
"README.md"
|
|
60
75
|
],
|
|
61
76
|
"author": "agenr-ai",
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"check": "pnpm format:check && pnpm lint && pnpm typecheck && pnpm test",
|
|
67
|
-
"dev": "tsup src/cli.ts src/cli-main.ts --format esm --watch",
|
|
68
|
-
"lint": "eslint .",
|
|
69
|
-
"format": "prettier --write .",
|
|
70
|
-
"format:check": "prettier --check .",
|
|
71
|
-
"test": "vitest run",
|
|
72
|
-
"test:watch": "vitest",
|
|
73
|
-
"typecheck": "tsc --noEmit",
|
|
74
|
-
"verify:dist": "node scripts/verify-dist.js"
|
|
77
|
+
"pnpm": {
|
|
78
|
+
"overrides": {
|
|
79
|
+
"fast-xml-parser": "^5.3.6"
|
|
80
|
+
}
|
|
75
81
|
}
|
|
76
|
-
}
|
|
82
|
+
}
|