@amaster.ai/employee-runtime-connector 0.1.1-beta.154 → 0.1.1-beta.155

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.
@@ -19966,22 +19966,39 @@ function hostFrontmatterField(frontmatter, field) {
19966
19966
  function hostEscapeXml(value) {
19967
19967
  return String(value).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
19968
19968
  }
19969
+ function readManagedPiSkillMetadata(filePath) {
19970
+ const resolvedFilePath = realpathSync2(filePath);
19971
+ const source = readFileSync7(resolvedFilePath, "utf8");
19972
+ const match = source.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
19973
+ if (!match) {
19974
+ return {
19975
+ filePath: resolvedFilePath,
19976
+ hasFrontmatter: false,
19977
+ name: null,
19978
+ description: null,
19979
+ hidden: false
19980
+ };
19981
+ }
19982
+ return {
19983
+ filePath: resolvedFilePath,
19984
+ hasFrontmatter: true,
19985
+ name: hostFrontmatterField(match[1], "name"),
19986
+ description: hostFrontmatterField(match[1], "description"),
19987
+ hidden: hostFrontmatterField(match[1], "disable-model-invocation")?.toLowerCase() === "true"
19988
+ };
19989
+ }
19969
19990
  function measureManagedPiRoleSkillMetadata(expectedSkills) {
19970
19991
  const entries = expectedSkills.map((expected) => {
19971
- const source = readFileSync7(realpathSync2(expected.filePath), "utf8");
19972
- const match = source.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
19973
- if (!match) throw new Error(`managed skill frontmatter missing: ${expected.name}`);
19974
- const name = hostFrontmatterField(match[1], "name");
19975
- const description = hostFrontmatterField(match[1], "description");
19976
- const hidden = hostFrontmatterField(match[1], "disable-model-invocation")?.toLowerCase() === "true";
19977
- if (name !== expected.name || !description || expected.requireHidden !== false && !hidden) {
19992
+ const metadata = readManagedPiSkillMetadata(expected.filePath);
19993
+ if (!metadata.hasFrontmatter) throw new Error(`managed skill frontmatter missing: ${expected.name}`);
19994
+ if (metadata.name !== expected.name || typeof metadata.description !== "string" || !metadata.description.trim() || expected.requireHidden !== false && !metadata.hidden) {
19978
19995
  throw new Error(`managed skill metadata mismatch: ${expected.name}`);
19979
19996
  }
19980
19997
  return [
19981
19998
  " <skill>",
19982
- ` <name>${hostEscapeXml(name)}</name>`,
19983
- ` <description>${hostEscapeXml(description)}</description>`,
19984
- ` <location>${hostEscapeXml(realpathSync2(expected.filePath))}</location>`,
19999
+ ` <name>${hostEscapeXml(metadata.name)}</name>`,
20000
+ ` <description>${hostEscapeXml(metadata.description)}</description>`,
20001
+ ` <location>${hostEscapeXml(metadata.filePath)}</location>`,
19985
20002
  " </skill>"
19986
20003
  ].join("\n");
19987
20004
  }).join("\n");
@@ -20053,7 +20070,10 @@ function readRoleSkill(expected) {
20053
20070
  const name = frontmatterField(match[1], "name");
20054
20071
  const description = frontmatterField(match[1], "description");
20055
20072
  const hidden = frontmatterField(match[1], "disable-model-invocation")?.toLowerCase() === "true";
20056
- if (name !== expected.name || !description || (expected.requireHidden !== false && !hidden)) {
20073
+ if (name !== expected.name
20074
+ || typeof description !== "string"
20075
+ || !description.trim()
20076
+ || (expected.requireHidden !== false && !hidden)) {
20057
20077
  throw new Error("managed skill metadata mismatch: " + expected.name);
20058
20078
  }
20059
20079
  return {
@@ -21326,10 +21346,29 @@ function createManagedPiMcpProfileApi(options = {}) {
21326
21346
  function readMainSkills(piHome) {
21327
21347
  const skillsRoot = resolve6(piHome, "skills");
21328
21348
  if (!existsSync6(skillsRoot)) return [];
21329
- return readdirSync3(skillsRoot).sort().flatMap((name) => {
21330
- const source = join7(skillsRoot, name);
21331
- return existsSync6(join7(source, "SKILL.md")) ? [{ name, source, requireHidden: false }] : [];
21332
- });
21349
+ const entriesByName = /* @__PURE__ */ new Map();
21350
+ for (const directory of readdirSync3(skillsRoot).sort()) {
21351
+ const source = join7(skillsRoot, directory);
21352
+ const skillFilePath = join7(source, "SKILL.md");
21353
+ if (!existsSync6(skillFilePath)) continue;
21354
+ const metadata = readManagedPiSkillMetadata(skillFilePath);
21355
+ if (!metadata.hasFrontmatter || typeof metadata.name !== "string" || !/^[a-z0-9-]+$/.test(metadata.name) || typeof metadata.description !== "string" || !metadata.description.trim()) {
21356
+ throw new Error(`pi_managed_mcp_main_skill_metadata_invalid:${directory}`);
21357
+ }
21358
+ const existing = entriesByName.get(metadata.name);
21359
+ if (existing) {
21360
+ if (existing.filePath !== metadata.filePath) {
21361
+ throw new Error(`pi_managed_mcp_main_skill_conflict:${metadata.name}`);
21362
+ }
21363
+ continue;
21364
+ }
21365
+ entriesByName.set(metadata.name, {
21366
+ name: metadata.name,
21367
+ filePath: metadata.filePath,
21368
+ requireHidden: false
21369
+ });
21370
+ }
21371
+ return [...entriesByName.values()];
21333
21372
  }
21334
21373
  function resolveManagedRoleSkills(piHome, skillProfiles) {
21335
21374
  const entriesByName = /* @__PURE__ */ new Map();
@@ -21351,11 +21390,19 @@ function createManagedPiMcpProfileApi(options = {}) {
21351
21390
  }
21352
21391
  }
21353
21392
  for (const entry of readMainSkills(piHome)) {
21354
- if (!entriesByName.has(entry.name)) entriesByName.set(entry.name, entry);
21393
+ const existing = entriesByName.get(entry.name);
21394
+ if (existing) {
21395
+ const existingFilePath = realpathSync3(join7(existing.source, "SKILL.md"));
21396
+ if (existingFilePath !== entry.filePath) {
21397
+ throw new Error(`pi_managed_mcp_main_skill_conflict:${entry.name}`);
21398
+ }
21399
+ continue;
21400
+ }
21401
+ entriesByName.set(entry.name, entry);
21355
21402
  }
21356
21403
  const entries = [...entriesByName.values()].map((entry) => ({
21357
21404
  name: entry.name,
21358
- filePath: realpathSync3(join7(entry.source, "SKILL.md")),
21405
+ filePath: entry.filePath ?? realpathSync3(join7(entry.source, "SKILL.md")),
21359
21406
  ...entry.requireHidden === false ? { requireHidden: false } : {}
21360
21407
  }));
21361
21408
  const metadata = measureManagedPiRoleSkillMetadata(entries);
@@ -29893,7 +29940,7 @@ function createSourceCompletionStopPolicy({
29893
29940
  }
29894
29941
 
29895
29942
  // src/amaster-runtime-daemon.mjs
29896
- var CONNECTOR_VERSION = "0.1.1-beta.154";
29943
+ var CONNECTOR_VERSION = "0.1.1-beta.155";
29897
29944
  var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
29898
29945
  var SOURCE_ACQUISITION_CAPABILITY2 = source_acquisition_compatibility_default.profileVersion;
29899
29946
  var daemonRequire = createRequire(import.meta.url);
@@ -7,7 +7,7 @@ import { homedir, hostname } from "node:os";
7
7
  import { fileURLToPath } from "node:url";
8
8
  import { BUILD_SUPPORTED_CAPABILITIES } from "./amaster-runtime-daemon/capability-registry.mjs";
9
9
 
10
- const CONNECTOR_VERSION = "0.1.1-beta.154";
10
+ const CONNECTOR_VERSION = "0.1.1-beta.155";
11
11
 
12
12
  const CONFIG_KEY_MAP = new Map([
13
13
  ["server_url", "AMASTER_EMPLOYEE_SERVER_URL"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amaster.ai/employee-runtime-connector",
3
- "version": "0.1.1-beta.154",
3
+ "version": "0.1.1-beta.155",
4
4
  "description": "MirrorX runtime connector CLI and daemon",
5
5
  "license": "MIT",
6
6
  "type": "module",