agentsmesh 0.27.0 → 0.29.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 +24 -0
- package/README.md +60 -11
- package/dist/canonical.d.ts +2 -2
- package/dist/canonical.js +63 -4
- package/dist/canonical.js.map +1 -1
- package/dist/cli.js +181 -181
- package/dist/engine.d.ts +2 -2
- package/dist/engine.js +75 -5
- package/dist/engine.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +95 -17
- package/dist/index.js.map +1 -1
- package/dist/lessons.js +18 -10
- package/dist/lessons.js.map +1 -1
- package/dist/{schema-CzaoYJlG.d.ts → schema-CH_JJep8.d.ts} +5 -0
- package/dist/{target-descriptor-ItDY3NR0.d.ts → target-descriptor-CaLUz7SR.d.ts} +1 -1
- package/dist/targets.d.ts +3 -3
- package/package.json +1 -1
- package/schemas/agentsmesh.json +11 -0
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ export { AgentsMeshError, AgentsMeshErrorCode, CheckLockSyncOptions, ComputeDiff
|
|
|
2
2
|
export { LoadCanonicalOptions, loadCanonical, loadCanonicalFiles } from './canonical.js';
|
|
3
3
|
export { getAllDescriptors, getDescriptor, getTargetCatalog, registerTargetDescriptor } from './targets.js';
|
|
4
4
|
export { A as AddLessonInput, a as AddLessonOptions, b as AddLessonResult, c as AddLessonTriggers, D as DEFAULT_RECALL_LIMIT, I as ImportLegacyOptions, d as ImportLegacyReport, L as LESSONS_PROCEDURAL_RULE, e as Lesson, f as LessonStatus, g as LessonsGraph, h as LessonsGraphSchema, i as LessonsPaths, j as LessonsQuery, M as MatchedLesson, k as MergeLessonsOptions, l as MergeLessonsResult, m as MutateOptions, R as RankOptions, n as RankReason, o as RankedLesson, S as ScaffoldLessonsResult, p as StripMarkersOptions, q as StripMarkersReport, T as Topic, r as Trigger, s as TriggerKind, U as UnknownTopicError, V as ValidationFinding, t as ValidationLevel, u as ValidationReport, v as acquireLessonsLock, w as addLesson, x as graphFilePath, y as importLegacyLessons, z as lessonsPaths, B as loadLessonsGraph, C as mergeLessons, E as mutateLessonsGraph, F as parseGraph, G as queryLessons, H as rankLessons, J as scaffoldLessons, K as serializeGraph, N as stripLegacyMarkers, O as stripMarkersInGraph, P as toRelPath, Q as tryLoadLessonsGraph, W as validateLessonsGraph } from './init-B0aI-g8W.js';
|
|
5
|
-
export { C as CanonicalAgent, a as CanonicalCommand, b as CanonicalFiles, c as CanonicalRule, d as CanonicalSkill, H as HookEntry, e as Hooks, I as IgnorePatterns, M as McpConfig, f as McpServer, P as Permissions, S as SkillSupportingFile, g as StdioMcpServer, U as UrlMcpServer, V as ValidatedConfig } from './schema-
|
|
6
|
-
export { E as ExtraRuleOutputContext, a as ExtraRuleOutputResolver, F as FeatureLinter, G as GenerateResult, b as GeneratedOutputMerger, c as GlobalTargetSupport, I as ImportPathBuilder, d as ImportResult, L as LintDiagnostic, R as RuleLinter, S as ScopeExtrasFn, T as TargetCapabilities, e as TargetDescriptor, f as TargetGenerators, g as TargetLayout, h as TargetLayoutScope, i as TargetLintHooks, j as TargetManagedOutputs, k as TargetOutputFamily, l as TargetPathResolvers } from './target-descriptor-
|
|
5
|
+
export { C as CanonicalAgent, a as CanonicalCommand, b as CanonicalFiles, c as CanonicalRule, d as CanonicalSkill, H as HookEntry, e as Hooks, I as IgnorePatterns, M as McpConfig, f as McpServer, P as Permissions, S as SkillSupportingFile, g as StdioMcpServer, U as UrlMcpServer, V as ValidatedConfig } from './schema-CH_JJep8.js';
|
|
6
|
+
export { E as ExtraRuleOutputContext, a as ExtraRuleOutputResolver, F as FeatureLinter, G as GenerateResult, b as GeneratedOutputMerger, c as GlobalTargetSupport, I as ImportPathBuilder, d as ImportResult, L as LintDiagnostic, R as RuleLinter, S as ScopeExtrasFn, T as TargetCapabilities, e as TargetDescriptor, f as TargetGenerators, g as TargetLayout, h as TargetLayoutScope, i as TargetLintHooks, j as TargetManagedOutputs, k as TargetOutputFamily, l as TargetPathResolvers } from './target-descriptor-CaLUz7SR.js';
|
|
7
7
|
import 'zod';
|
package/dist/index.js
CHANGED
|
@@ -21595,7 +21595,14 @@ var extendSourceSchema = z.object({
|
|
|
21595
21595
|
features: z.array(featureSchema),
|
|
21596
21596
|
/** Repo-relative POSIX path for discovery (skill packs, nested .agentsmesh). */
|
|
21597
21597
|
path: z.string().optional(),
|
|
21598
|
-
pick: extendPickSchema.optional()
|
|
21598
|
+
pick: extendPickSchema.optional(),
|
|
21599
|
+
/**
|
|
21600
|
+
* Per-entry consent for "elevated" artifacts (`hooks`, `permissions`, `mcp`)
|
|
21601
|
+
* from a remote source. These control local code execution at generate time,
|
|
21602
|
+
* so for non-local extends they are stripped by default and only merged for
|
|
21603
|
+
* the artifacts listed here. Local extends are trusted and ignore this field.
|
|
21604
|
+
*/
|
|
21605
|
+
accept: z.array(z.enum(["hooks", "permissions", "mcp"])).optional()
|
|
21599
21606
|
});
|
|
21600
21607
|
var collaborationSchema = z.object({
|
|
21601
21608
|
strategy: z.enum(["merge", "lock", "last-wins"]).default("merge"),
|
|
@@ -22304,7 +22311,9 @@ async function resolveExtendPaths(config, configDir, options = {}) {
|
|
|
22304
22311
|
as: ext.as,
|
|
22305
22312
|
version: fetched.version,
|
|
22306
22313
|
path: ext.path,
|
|
22307
|
-
pick: ext.pick
|
|
22314
|
+
pick: ext.pick,
|
|
22315
|
+
isRemote: true,
|
|
22316
|
+
accept: ext.accept
|
|
22308
22317
|
});
|
|
22309
22318
|
continue;
|
|
22310
22319
|
}
|
|
@@ -22321,7 +22330,9 @@ async function resolveExtendPaths(config, configDir, options = {}) {
|
|
|
22321
22330
|
target: ext.target,
|
|
22322
22331
|
as: ext.as,
|
|
22323
22332
|
path: ext.path,
|
|
22324
|
-
pick: ext.pick
|
|
22333
|
+
pick: ext.pick,
|
|
22334
|
+
isRemote: false,
|
|
22335
|
+
accept: ext.accept
|
|
22325
22336
|
});
|
|
22326
22337
|
}
|
|
22327
22338
|
return result;
|
|
@@ -23770,6 +23781,47 @@ function applyExtendPick(canonical, features, pick, extendName) {
|
|
|
23770
23781
|
return next;
|
|
23771
23782
|
}
|
|
23772
23783
|
|
|
23784
|
+
// src/install/core/elevated-artifacts.ts
|
|
23785
|
+
function stripUntrustedElevatedArtifacts(canonical, options) {
|
|
23786
|
+
if (options.sourceKind === "local") {
|
|
23787
|
+
return { canonical, stripped: [] };
|
|
23788
|
+
}
|
|
23789
|
+
const stripped = [];
|
|
23790
|
+
let hooks = canonical.hooks;
|
|
23791
|
+
let permissions = canonical.permissions;
|
|
23792
|
+
let mcp = canonical.mcp;
|
|
23793
|
+
if (hooks !== null && !options.acceptHooks) {
|
|
23794
|
+
hooks = null;
|
|
23795
|
+
stripped.push("hooks");
|
|
23796
|
+
}
|
|
23797
|
+
if (permissions !== null && !options.acceptPermissions) {
|
|
23798
|
+
permissions = null;
|
|
23799
|
+
stripped.push("permissions");
|
|
23800
|
+
}
|
|
23801
|
+
if (mcp !== null && !options.acceptMcp) {
|
|
23802
|
+
mcp = null;
|
|
23803
|
+
stripped.push("mcp");
|
|
23804
|
+
}
|
|
23805
|
+
if (stripped.length === 0) {
|
|
23806
|
+
return { canonical, stripped: [] };
|
|
23807
|
+
}
|
|
23808
|
+
return {
|
|
23809
|
+
canonical: { ...canonical, hooks, permissions, mcp },
|
|
23810
|
+
stripped
|
|
23811
|
+
};
|
|
23812
|
+
}
|
|
23813
|
+
|
|
23814
|
+
// src/canonical/extends/extend-elevated.ts
|
|
23815
|
+
function gateExtendElevatedArtifacts(canonical, ext) {
|
|
23816
|
+
const accept = ext.accept ?? [];
|
|
23817
|
+
return stripUntrustedElevatedArtifacts(canonical, {
|
|
23818
|
+
sourceKind: ext.isRemote ? "git" : "local",
|
|
23819
|
+
acceptHooks: accept.includes("hooks"),
|
|
23820
|
+
acceptPermissions: accept.includes("permissions"),
|
|
23821
|
+
acceptMcp: accept.includes("mcp")
|
|
23822
|
+
});
|
|
23823
|
+
}
|
|
23824
|
+
|
|
23773
23825
|
// src/install/pack/pack-reader.ts
|
|
23774
23826
|
init_fs();
|
|
23775
23827
|
var MANUAL_INSTALL_AS = ["rules", "commands", "agents", "skills"];
|
|
@@ -23919,7 +23971,14 @@ async function loadCanonicalWithExtends(config, configDir, options = {}, canonic
|
|
|
23919
23971
|
for (const ext of resolvedExtends) {
|
|
23920
23972
|
const extCanonical = await loadCanonicalForExtend(ext);
|
|
23921
23973
|
const filtered = filterCanonicalByFeatures(extCanonical, ext.features);
|
|
23922
|
-
const
|
|
23974
|
+
const gated = gateExtendElevatedArtifacts(filtered, ext);
|
|
23975
|
+
if (gated.stripped.length > 0) {
|
|
23976
|
+
const list = gated.stripped.join(", ");
|
|
23977
|
+
logger.warn(
|
|
23978
|
+
`[agentsmesh] Extend "${ext.name}": stripped elevated artifacts from a remote source: ${list}. Add \`accept: [${list}]\` to this extends entry in agentsmesh.yaml to keep them.`
|
|
23979
|
+
);
|
|
23980
|
+
}
|
|
23981
|
+
const picked = applyExtendPick(gated.canonical, ext.features, ext.pick, ext.name);
|
|
23923
23982
|
merged = mergeCanonicalFiles(merged, picked);
|
|
23924
23983
|
}
|
|
23925
23984
|
const packsCanonical = await loadPacksCanonical(canonicalDir);
|
|
@@ -23955,7 +24014,18 @@ function canonicalize(path) {
|
|
|
23955
24014
|
try {
|
|
23956
24015
|
return realpathSync(path);
|
|
23957
24016
|
} catch {
|
|
23958
|
-
|
|
24017
|
+
let current = resolve(path);
|
|
24018
|
+
const tail = [];
|
|
24019
|
+
for (; ; ) {
|
|
24020
|
+
const parent = dirname(current);
|
|
24021
|
+
if (parent === current) return resolve(path);
|
|
24022
|
+
tail.unshift(basename(current));
|
|
24023
|
+
try {
|
|
24024
|
+
return join(realpathSync(parent), ...tail);
|
|
24025
|
+
} catch {
|
|
24026
|
+
current = parent;
|
|
24027
|
+
}
|
|
24028
|
+
}
|
|
23959
24029
|
}
|
|
23960
24030
|
}
|
|
23961
24031
|
function assertSourceInsideProjectRoot(resolvedPath, projectRoot) {
|
|
@@ -25817,8 +25887,8 @@ function isBroadGlob(pattern) {
|
|
|
25817
25887
|
const p = pattern.trim();
|
|
25818
25888
|
if (p === "*" || p === "**") return true;
|
|
25819
25889
|
if (!p.includes("**")) return false;
|
|
25820
|
-
const
|
|
25821
|
-
return
|
|
25890
|
+
const basename71 = p.slice(p.lastIndexOf("/") + 1);
|
|
25891
|
+
return basename71.startsWith("*");
|
|
25822
25892
|
}
|
|
25823
25893
|
function inspectCapturedLesson(graph, lessonId, knownPaths) {
|
|
25824
25894
|
const lesson = graph.lessons[lessonId];
|
|
@@ -26702,23 +26772,31 @@ async function stripMarkersInGraph(projectRoot, options = {}) {
|
|
|
26702
26772
|
}
|
|
26703
26773
|
var RECALL_HOOK_COMMAND = "agentsmesh lessons hook";
|
|
26704
26774
|
var RECALL_HOOK_MATCHER = "Edit|Write|Bash";
|
|
26705
|
-
|
|
26706
|
-
|
|
26707
|
-
|
|
26708
|
-
const
|
|
26709
|
-
const
|
|
26710
|
-
const post = existing instanceof YAMLSeq ? existing : new YAMLSeq();
|
|
26711
|
-
const present = post.items.some(
|
|
26775
|
+
var RECALL_EVENTS = ["PreToolUse", "PostToolUse"];
|
|
26776
|
+
function injectEvent(doc, event) {
|
|
26777
|
+
const existing = doc.get(event);
|
|
26778
|
+
const seq = existing instanceof YAMLSeq ? existing : new YAMLSeq();
|
|
26779
|
+
const present = seq.items.some(
|
|
26712
26780
|
(item) => item instanceof YAMLMap && item.get("command") === RECALL_HOOK_COMMAND
|
|
26713
26781
|
);
|
|
26714
26782
|
if (present) return false;
|
|
26715
|
-
|
|
26783
|
+
seq.add(
|
|
26716
26784
|
doc.createNode({ matcher: RECALL_HOOK_MATCHER, type: "command", command: RECALL_HOOK_COMMAND })
|
|
26717
26785
|
);
|
|
26718
|
-
doc.set(
|
|
26719
|
-
writeFileSync(path, String(doc), "utf8");
|
|
26786
|
+
doc.set(event, seq);
|
|
26720
26787
|
return true;
|
|
26721
26788
|
}
|
|
26789
|
+
function injectRecallHook(projectRoot) {
|
|
26790
|
+
const path = join(projectRoot, ".agentsmesh", "hooks.yaml");
|
|
26791
|
+
if (!existsSync(path)) return false;
|
|
26792
|
+
const doc = parseDocument(readFileSync(path, "utf8"));
|
|
26793
|
+
let changed = false;
|
|
26794
|
+
for (const event of RECALL_EVENTS) {
|
|
26795
|
+
if (injectEvent(doc, event)) changed = true;
|
|
26796
|
+
}
|
|
26797
|
+
if (changed) writeFileSync(path, String(doc), "utf8");
|
|
26798
|
+
return changed;
|
|
26799
|
+
}
|
|
26722
26800
|
|
|
26723
26801
|
// src/utils/filesystem/gitignore.ts
|
|
26724
26802
|
init_fs();
|