agentsmesh 0.39.0 → 0.40.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/CHANGELOG.md +18 -0
- package/dist/canonical.js +4 -0
- package/dist/canonical.js.map +1 -1
- package/dist/cli.js +225 -225
- package/dist/engine.js +4 -0
- package/dist/engine.js.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/lessons.js +26 -0
- package/dist/lessons.js.map +1 -1
- package/dist/targets.js +4 -0
- package/dist/targets.js.map +1 -1
- package/package.json +3 -2
package/dist/lessons.js
CHANGED
|
@@ -2409,6 +2409,31 @@ function loadRecallConfig(projectRoot) {
|
|
|
2409
2409
|
}
|
|
2410
2410
|
}
|
|
2411
2411
|
|
|
2412
|
+
// src/lessons/context-key.ts
|
|
2413
|
+
function normalizeCommand(command) {
|
|
2414
|
+
const words = command.trim().split(/\s+/);
|
|
2415
|
+
let start = 0;
|
|
2416
|
+
while (start < words.length && /^[A-Za-z_][A-Za-z0-9_]*=/.test(words[start])) start += 1;
|
|
2417
|
+
const rest = words.slice(start);
|
|
2418
|
+
const programIdx = rest.findIndex(isBareWord);
|
|
2419
|
+
if (programIdx === -1) return rest[0] ?? "";
|
|
2420
|
+
const program = rest[programIdx];
|
|
2421
|
+
const next = rest[programIdx + 1];
|
|
2422
|
+
return next !== void 0 && isBareWord(next) ? `${program} ${next}` : program;
|
|
2423
|
+
}
|
|
2424
|
+
function isBareWord(w) {
|
|
2425
|
+
return w.length > 0 && !w.startsWith("-") && !w.includes("/") && !/^["'`]/.test(w);
|
|
2426
|
+
}
|
|
2427
|
+
function contextKey(input, projectRoot) {
|
|
2428
|
+
if (input.file !== void 0 && input.file.length > 0) {
|
|
2429
|
+
return `file:${normalizeRecallFile(input.file, projectRoot)}`;
|
|
2430
|
+
}
|
|
2431
|
+
if (input.command !== void 0 && input.command.length > 0) {
|
|
2432
|
+
return `cmd:${normalizeCommand(input.command)}`;
|
|
2433
|
+
}
|
|
2434
|
+
return "none";
|
|
2435
|
+
}
|
|
2436
|
+
|
|
2412
2437
|
// src/lessons/recall-telemetry.ts
|
|
2413
2438
|
function recordRecallTelemetry(projectRoot, graph, query, matches, lessons, options = {}) {
|
|
2414
2439
|
if (!isTelemetryEnabled(process.env, projectRoot)) return;
|
|
@@ -2424,6 +2449,7 @@ function recordRecallTelemetry(projectRoot, graph, query, matches, lessons, opti
|
|
|
2424
2449
|
returnedCount: lessons.length,
|
|
2425
2450
|
returnedTokens: lessons.reduce((sum, l) => sum + estTokens(l.lesson.rule), 0),
|
|
2426
2451
|
truncated: matches.length > lessons.length,
|
|
2452
|
+
contextKey: contextKey({ file: query.file, command: query.command }, projectRoot),
|
|
2427
2453
|
matchedByKind: {
|
|
2428
2454
|
file: countVia(byKind.file_glob),
|
|
2429
2455
|
command: countVia(byKind.command_pattern),
|