agentsmesh 0.28.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/dist/engine.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { V as ValidatedConfig, b as CanonicalFiles } from './schema-CzaoYJlG.js';
2
- import { G as GenerateResult, h as TargetLayoutScope, L as LintDiagnostic, d as ImportResult } from './target-descriptor-ItDY3NR0.js';
1
+ import { V as ValidatedConfig, b as CanonicalFiles } from './schema-CH_JJep8.js';
2
+ import { G as GenerateResult, h as TargetLayoutScope, L as LintDiagnostic, d as ImportResult } from './target-descriptor-CaLUz7SR.js';
3
3
  import 'zod';
4
4
 
5
5
  /**
package/dist/engine.js CHANGED
@@ -21593,7 +21593,14 @@ var extendSourceSchema = z.object({
21593
21593
  features: z.array(featureSchema),
21594
21594
  /** Repo-relative POSIX path for discovery (skill packs, nested .agentsmesh). */
21595
21595
  path: z.string().optional(),
21596
- pick: extendPickSchema.optional()
21596
+ pick: extendPickSchema.optional(),
21597
+ /**
21598
+ * Per-entry consent for "elevated" artifacts (`hooks`, `permissions`, `mcp`)
21599
+ * from a remote source. These control local code execution at generate time,
21600
+ * so for non-local extends they are stripped by default and only merged for
21601
+ * the artifacts listed here. Local extends are trusted and ignore this field.
21602
+ */
21603
+ accept: z.array(z.enum(["hooks", "permissions", "mcp"])).optional()
21597
21604
  });
21598
21605
  var collaborationSchema = z.object({
21599
21606
  strategy: z.enum(["merge", "lock", "last-wins"]).default("merge"),
@@ -22302,7 +22309,9 @@ async function resolveExtendPaths(config, configDir, options = {}) {
22302
22309
  as: ext.as,
22303
22310
  version: fetched.version,
22304
22311
  path: ext.path,
22305
- pick: ext.pick
22312
+ pick: ext.pick,
22313
+ isRemote: true,
22314
+ accept: ext.accept
22306
22315
  });
22307
22316
  continue;
22308
22317
  }
@@ -22319,7 +22328,9 @@ async function resolveExtendPaths(config, configDir, options = {}) {
22319
22328
  target: ext.target,
22320
22329
  as: ext.as,
22321
22330
  path: ext.path,
22322
- pick: ext.pick
22331
+ pick: ext.pick,
22332
+ isRemote: false,
22333
+ accept: ext.accept
22323
22334
  });
22324
22335
  }
22325
22336
  return result;
@@ -23768,6 +23779,47 @@ function applyExtendPick(canonical, features, pick, extendName) {
23768
23779
  return next;
23769
23780
  }
23770
23781
 
23782
+ // src/install/core/elevated-artifacts.ts
23783
+ function stripUntrustedElevatedArtifacts(canonical, options) {
23784
+ if (options.sourceKind === "local") {
23785
+ return { canonical, stripped: [] };
23786
+ }
23787
+ const stripped = [];
23788
+ let hooks = canonical.hooks;
23789
+ let permissions = canonical.permissions;
23790
+ let mcp = canonical.mcp;
23791
+ if (hooks !== null && !options.acceptHooks) {
23792
+ hooks = null;
23793
+ stripped.push("hooks");
23794
+ }
23795
+ if (permissions !== null && !options.acceptPermissions) {
23796
+ permissions = null;
23797
+ stripped.push("permissions");
23798
+ }
23799
+ if (mcp !== null && !options.acceptMcp) {
23800
+ mcp = null;
23801
+ stripped.push("mcp");
23802
+ }
23803
+ if (stripped.length === 0) {
23804
+ return { canonical, stripped: [] };
23805
+ }
23806
+ return {
23807
+ canonical: { ...canonical, hooks, permissions, mcp },
23808
+ stripped
23809
+ };
23810
+ }
23811
+
23812
+ // src/canonical/extends/extend-elevated.ts
23813
+ function gateExtendElevatedArtifacts(canonical, ext) {
23814
+ const accept = ext.accept ?? [];
23815
+ return stripUntrustedElevatedArtifacts(canonical, {
23816
+ sourceKind: ext.isRemote ? "git" : "local",
23817
+ acceptHooks: accept.includes("hooks"),
23818
+ acceptPermissions: accept.includes("permissions"),
23819
+ acceptMcp: accept.includes("mcp")
23820
+ });
23821
+ }
23822
+
23771
23823
  // src/install/pack/pack-reader.ts
23772
23824
  init_fs();
23773
23825
  var MANUAL_INSTALL_AS = ["rules", "commands", "agents", "skills"];
@@ -23917,7 +23969,14 @@ async function loadCanonicalWithExtends(config, configDir, options = {}, canonic
23917
23969
  for (const ext of resolvedExtends) {
23918
23970
  const extCanonical = await loadCanonicalForExtend(ext);
23919
23971
  const filtered = filterCanonicalByFeatures(extCanonical, ext.features);
23920
- const picked = applyExtendPick(filtered, ext.features, ext.pick, ext.name);
23972
+ const gated = gateExtendElevatedArtifacts(filtered, ext);
23973
+ if (gated.stripped.length > 0) {
23974
+ const list = gated.stripped.join(", ");
23975
+ logger.warn(
23976
+ `[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.`
23977
+ );
23978
+ }
23979
+ const picked = applyExtendPick(gated.canonical, ext.features, ext.pick, ext.name);
23921
23980
  merged = mergeCanonicalFiles(merged, picked);
23922
23981
  }
23923
23982
  const packsCanonical = await loadPacksCanonical(canonicalDir);
@@ -23953,7 +24012,18 @@ function canonicalize(path) {
23953
24012
  try {
23954
24013
  return realpathSync(path);
23955
24014
  } catch {
23956
- return path;
24015
+ let current = resolve(path);
24016
+ const tail = [];
24017
+ for (; ; ) {
24018
+ const parent = dirname(current);
24019
+ if (parent === current) return resolve(path);
24020
+ tail.unshift(basename(current));
24021
+ try {
24022
+ return join(realpathSync(parent), ...tail);
24023
+ } catch {
24024
+ current = parent;
24025
+ }
24026
+ }
23957
24027
  }
23958
24028
  }
23959
24029
  function assertSourceInsideProjectRoot(resolvedPath, projectRoot) {