agentsmesh 0.19.0 → 0.20.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/index.js CHANGED
@@ -1022,7 +1022,7 @@ ${legacy}`, "");
1022
1022
  }
1023
1023
  return result.trim();
1024
1024
  }
1025
- var ROOT_INSTRUCTION_BODY_V1, ROOT_INSTRUCTION_BODY_V2, ROOT_INSTRUCTION_BODY_V3, ROOT_INSTRUCTION_BODY_V4, ROOT_INSTRUCTION_BODY_V5, ROOT_INSTRUCTION_BODY_V6, ROOT_INSTRUCTION_BODY_V7, ROOT_INSTRUCTION_BODY, LEGACY_AGENTSMESH_ROOT_INSTRUCTION_PARAGRAPH, LEGACY_AGENTSMESH_ROOT_INSTRUCTION_SECTION, AGENTSMESH_CONTRACT_WITH_V1_BODY, AGENTSMESH_CONTRACT_WITH_V2_BODY, AGENTSMESH_CONTRACT_WITH_V3_BODY, AGENTSMESH_CONTRACT_WITH_V4_BODY, AGENTSMESH_CONTRACT_WITH_V5_BODY, AGENTSMESH_CONTRACT_WITH_V6_BODY, AGENTSMESH_CONTRACT_WITH_V7_BODY, AGENTSMESH_ROOT_INSTRUCTION_PARAGRAPH, LEGACY_FORMS;
1025
+ var ROOT_INSTRUCTION_BODY_V1, ROOT_INSTRUCTION_BODY_V2, ROOT_INSTRUCTION_BODY_V3, ROOT_INSTRUCTION_BODY_V4, ROOT_INSTRUCTION_BODY_V5, ROOT_INSTRUCTION_BODY_V6, ROOT_INSTRUCTION_BODY_V7, ROOT_INSTRUCTION_BODY_V8, ROOT_INSTRUCTION_BODY, LEGACY_AGENTSMESH_ROOT_INSTRUCTION_PARAGRAPH, LEGACY_AGENTSMESH_ROOT_INSTRUCTION_SECTION, AGENTSMESH_CONTRACT_WITH_V1_BODY, AGENTSMESH_CONTRACT_WITH_V2_BODY, AGENTSMESH_CONTRACT_WITH_V3_BODY, AGENTSMESH_CONTRACT_WITH_V4_BODY, AGENTSMESH_CONTRACT_WITH_V5_BODY, AGENTSMESH_CONTRACT_WITH_V6_BODY, AGENTSMESH_CONTRACT_WITH_V7_BODY, AGENTSMESH_CONTRACT_WITH_V8_BODY, AGENTSMESH_ROOT_INSTRUCTION_PARAGRAPH, LEGACY_FORMS;
1026
1026
  var init_root_instruction_paragraph = __esm({
1027
1027
  "src/targets/projection/root-instruction-paragraph.ts"() {
1028
1028
  init_managed_blocks();
@@ -1033,7 +1033,8 @@ var init_root_instruction_paragraph = __esm({
1033
1033
  ROOT_INSTRUCTION_BODY_V5 = "Use Claude-style Markdown in `.agentsmesh`: `agents/*.md`, `commands/*.md`, and `skills/*/SKILL.md`; keep rules in `rules/*.md`, hooks in `hooks.yaml`, MCP in `mcp.json`, permissions in `permissions.yaml`, and ignore patterns in `ignore`, then run `agentsmesh generate`.";
1034
1034
  ROOT_INSTRUCTION_BODY_V6 = "Create canonical files in `.agentsmesh`: `rules/_root.md` and `rules/*.md` are Markdown rules; `commands/*.md`, `agents/*.md`, and `skills/*/SKILL.md` plus supporting files use Claude-style frontmatter Markdown; `mcp.json` is MCP JSON; `hooks.yaml` and `permissions.yaml` are YAML; `ignore` is gitignore-style text. Then run `agentsmesh generate`.";
1035
1035
  ROOT_INSTRUCTION_BODY_V7 = "`.agentsmesh` is the only folder you edit or add these files in: `rules/_root.md` and `rules/*.md` are Markdown rules; `commands/*.md`, `agents/*.md`, and `skills/*/SKILL.md` plus supporting files use Claude-style frontmatter Markdown; `mcp.json` is MCP JSON; `hooks.yaml` and `permissions.yaml` are YAML; `ignore` is gitignore-style text. Do not edit generated tool files; run `agentsmesh generate`.";
1036
- ROOT_INSTRUCTION_BODY = "`agentsmesh.yaml` selects targets/features (`agentsmesh.local.yaml` overrides locally), and `.agentsmesh` is the only place to add or edit canonical items: `rules/_root.md`, `rules/*.md`, `commands/*.md`, `agents/*.md`, `skills/*/SKILL.md` plus supporting files, `mcp.json`, `hooks.yaml`, `permissions.yaml`, and `ignore`; if missing run `agentsmesh init`, use `agentsmesh import --from <tool>` for native configs, `agentsmesh install <source>` or `install --sync` for reusable packs, then run `agentsmesh generate`. Use `diff`, `lint`, `check`, `watch`, `matrix`, and `merge` as needed; never edit generated tool files.";
1036
+ ROOT_INSTRUCTION_BODY_V8 = "`agentsmesh.yaml` selects targets/features (`agentsmesh.local.yaml` overrides locally), and `.agentsmesh` is the only place to add or edit canonical items: `rules/_root.md`, `rules/*.md`, `commands/*.md`, `agents/*.md`, `skills/*/SKILL.md` plus supporting files, `mcp.json`, `hooks.yaml`, `permissions.yaml`, and `ignore`; if missing run `agentsmesh init`, use `agentsmesh import --from <tool>` for native configs, `agentsmesh install <source>` or `install --sync` for reusable packs, then run `agentsmesh generate`. Use `diff`, `lint`, `check`, `watch`, `matrix`, and `merge` as needed; never edit generated tool files.";
1037
+ ROOT_INSTRUCTION_BODY = "`agentsmesh.yaml` selects targets/features (`agentsmesh.local.yaml` overrides locally), and `.agentsmesh` is the only place to add or edit canonical items: `rules/_root.md`, `rules/*.md`, `commands/*.md`, `agents/*.md`, `skills/*/SKILL.md` plus supporting files, `mcp.json`, `hooks.yaml`, `permissions.yaml`, and `ignore`; if missing run `agentsmesh init`, use `agentsmesh import --from <tool>` for native configs, `agentsmesh install <source>` or `install --sync` for reusable packs, then run `agentsmesh generate`. Use `diff`, `lint`, `check`, `watch`, `matrix`, `merge`, and `refresh` as needed; never edit generated tool files.";
1037
1038
  LEGACY_AGENTSMESH_ROOT_INSTRUCTION_PARAGRAPH = ROOT_INSTRUCTION_BODY_V1;
1038
1039
  LEGACY_AGENTSMESH_ROOT_INSTRUCTION_SECTION = `## Project-Specific Rules
1039
1040
 
@@ -1059,12 +1060,16 @@ ${ROOT_INSTRUCTION_BODY_V6}`;
1059
1060
  AGENTSMESH_CONTRACT_WITH_V7_BODY = `## AgentsMesh Generation Contract
1060
1061
 
1061
1062
  ${ROOT_INSTRUCTION_BODY_V7}`;
1063
+ AGENTSMESH_CONTRACT_WITH_V8_BODY = `## AgentsMesh Generation Contract
1064
+
1065
+ ${ROOT_INSTRUCTION_BODY_V8}`;
1062
1066
  AGENTSMESH_ROOT_INSTRUCTION_PARAGRAPH = `${ROOT_CONTRACT_START}
1063
1067
  ## AgentsMesh Generation Contract
1064
1068
 
1065
1069
  ${ROOT_INSTRUCTION_BODY}
1066
1070
  ${ROOT_CONTRACT_END}`;
1067
1071
  LEGACY_FORMS = [
1072
+ AGENTSMESH_CONTRACT_WITH_V8_BODY,
1068
1073
  AGENTSMESH_CONTRACT_WITH_V7_BODY,
1069
1074
  AGENTSMESH_CONTRACT_WITH_V6_BODY,
1070
1075
  AGENTSMESH_CONTRACT_WITH_V5_BODY,
@@ -20018,10 +20023,12 @@ async function loadConfig(configPath) {
20018
20023
  }
20019
20024
  return result.data;
20020
20025
  }
20026
+ var PROTOTYPE_POLLUTION_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
20021
20027
  function deepMergeObjects(base, overrides2) {
20022
20028
  const result = { ...base };
20023
20029
  for (const [k, v] of Object.entries(overrides2)) {
20024
20030
  if (v === null || v === void 0) continue;
20031
+ if (PROTOTYPE_POLLUTION_KEYS.has(k)) continue;
20025
20032
  const baseVal = result[k];
20026
20033
  if (typeof v === "object" && !Array.isArray(v) && v !== null && typeof baseVal === "object" && baseVal !== null && !Array.isArray(baseVal)) {
20027
20034
  result[k] = deepMergeObjects(
@@ -20458,7 +20465,9 @@ function parseGitSource(source) {
20458
20465
  } catch {
20459
20466
  return null;
20460
20467
  }
20461
- if (!["https:", "http:", "ssh:", "file:"].includes(parsedUrl.protocol)) {
20468
+ const allowInsecure = process.env.AGENTSMESH_ALLOW_INSECURE_GIT === "1" || process.env.AGENTSMESH_ALLOW_INSECURE_GIT === "true";
20469
+ const allowedProtocols = allowInsecure ? ["https:", "http:", "ssh:", "file:"] : ["https:", "ssh:", "file:"];
20470
+ if (!allowedProtocols.includes(parsedUrl.protocol)) {
20462
20471
  return null;
20463
20472
  }
20464
20473
  return { url, ref };
@@ -22246,15 +22255,30 @@ function isLocalSource(source) {
22246
22255
  // these on win32, and they must not be misinterpreted as bare npm package names.
22247
22256
  /^[A-Za-z]:[/\\]/.test(source);
22248
22257
  }
22258
+ function canonicalize(path) {
22259
+ try {
22260
+ return realpathSync(path);
22261
+ } catch {
22262
+ return path;
22263
+ }
22264
+ }
22265
+ function assertSourceInsideProjectRoot(resolvedPath, projectRoot) {
22266
+ const rootAbs = canonicalize(resolve(projectRoot));
22267
+ const sourceAbs = canonicalize(resolvedPath);
22268
+ if (sourceAbs === rootAbs || sourceAbs.startsWith(`${rootAbs}${sep}`)) return;
22269
+ throw new Error(`Plugin source resolves outside project root (escapes ${rootAbs}): ${sourceAbs}`);
22270
+ }
22249
22271
  async function importPluginModule(entry, projectRoot) {
22250
22272
  const { source } = entry;
22251
22273
  let importTarget;
22252
22274
  if (isLocalSource(source)) {
22253
22275
  const raw = source.startsWith("file:") ? fileURLToPath(source) : source;
22254
22276
  const resolved = resolve(projectRoot, raw);
22277
+ assertSourceInsideProjectRoot(resolved, projectRoot);
22255
22278
  importTarget = pathToFileURL(resolved).href;
22256
22279
  } else {
22257
22280
  const resolved = resolveNpmSpecifier(source, projectRoot);
22281
+ assertSourceInsideProjectRoot(resolved, projectRoot);
22258
22282
  importTarget = pathToFileURL(resolved).href;
22259
22283
  }
22260
22284
  const mod = await import(importTarget);