@amaster.ai/employee-runtime-connector 0.1.1-beta.63 → 0.1.1-beta.64

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.
@@ -2776,6 +2776,90 @@ export default function amasterEffectiveToolsAttestor(pi) {
2776
2776
  `;
2777
2777
  }
2778
2778
 
2779
+ // src/amaster-runtime-daemon/pi-role-skills-visibility.mjs
2780
+ var MANAGED_PI_ROLE_SKILLS_VISIBILITY_FILENAME = "amaster-role-skills-visibility.js";
2781
+ function managedPiRoleSkillsVisibilityExtensionSource(expectedSkills) {
2782
+ return String.raw`import { realpathSync } from "node:fs";
2783
+
2784
+ const EXPECTED_SKILLS = ${JSON.stringify(expectedSkills)};
2785
+
2786
+ function escapeXml(value) {
2787
+ return String(value)
2788
+ .replace(/&/g, "&")
2789
+ .replace(/</g, "&lt;")
2790
+ .replace(/>/g, "&gt;")
2791
+ .replace(/\"/g, "&quot;")
2792
+ .replace(/'/g, "&apos;");
2793
+ }
2794
+
2795
+ function skillXml(skill) {
2796
+ return [
2797
+ " <skill>",
2798
+ " <name>" + escapeXml(skill.name) + "</name>",
2799
+ " <description>" + escapeXml(skill.description) + "</description>",
2800
+ " <location>" + escapeXml(skill.filePath) + "</location>",
2801
+ " </skill>",
2802
+ ].join("\n");
2803
+ }
2804
+
2805
+ function appendPromotedSkills(systemPrompt, skills) {
2806
+ if (skills.length === 0) return systemPrompt;
2807
+ const entries = skills.map(skillXml).join("\n");
2808
+ const closingTag = "</available_skills>";
2809
+ const closingIndex = systemPrompt.lastIndexOf(closingTag);
2810
+ if (closingIndex >= 0) {
2811
+ return systemPrompt.slice(0, closingIndex) + entries + "\n" + systemPrompt.slice(closingIndex);
2812
+ }
2813
+ return systemPrompt + [
2814
+ "",
2815
+ "",
2816
+ "The following skills provide specialized instructions for specific tasks.",
2817
+ "Use the read tool to load a skill's file when the task matches its description.",
2818
+ "When a skill file references a relative path, resolve it against the skill directory (parent of SKILL.md / dirname of the path) and use that absolute path in tool commands.",
2819
+ "",
2820
+ "<available_skills>",
2821
+ entries,
2822
+ closingTag,
2823
+ ].join("\n");
2824
+ }
2825
+
2826
+ export default function amasterRoleSkillsVisibility(pi) {
2827
+ pi.on("before_agent_start", (event) => {
2828
+ try {
2829
+ if (!Array.isArray(event.systemPromptOptions?.selectedTools)
2830
+ || !event.systemPromptOptions.selectedTools.includes("read")) {
2831
+ throw new Error("role skills require the read tool");
2832
+ }
2833
+ const loadedSkills = Array.isArray(event.systemPromptOptions?.skills)
2834
+ ? event.systemPromptOptions.skills
2835
+ : [];
2836
+ const promotedSkills = [];
2837
+ for (const expected of EXPECTED_SKILLS) {
2838
+ const expectedPath = realpathSync(expected.filePath);
2839
+ const matches = loadedSkills.filter((skill) => {
2840
+ if (skill?.name !== expected.name || typeof skill.filePath !== "string") return false;
2841
+ try {
2842
+ return realpathSync(skill.filePath) === expectedPath;
2843
+ } catch {
2844
+ return false;
2845
+ }
2846
+ });
2847
+ if (matches.length !== 1) {
2848
+ throw new Error("role skill binding mismatch: " + expected.name);
2849
+ }
2850
+ if (matches[0].disableModelInvocation === true) promotedSkills.push(matches[0]);
2851
+ }
2852
+ const systemPrompt = appendPromotedSkills(event.systemPrompt, promotedSkills);
2853
+ return systemPrompt === event.systemPrompt ? undefined : { systemPrompt };
2854
+ } catch {
2855
+ process.stderr.write("pi_role_skills_visibility_rejected\n");
2856
+ process.exit(78);
2857
+ }
2858
+ });
2859
+ }
2860
+ `;
2861
+ }
2862
+
2779
2863
  // src/amaster-runtime-daemon/pi-managed-mcp-profile.mjs
2780
2864
  var MANAGED_PI_MCP_TOOL_MODE = "proxy_only";
2781
2865
  var MANAGED_PI_DIRECT_TYPED_MCP_TOOL_MODE = "direct_typed";
@@ -3425,23 +3509,6 @@ function createManagedPiMcpProfileApi(options = {}) {
3425
3509
  return { home, settingsEnv, protectedValues };
3426
3510
  }
3427
3511
  const SKILL_PROFILE_NAME = /^[a-z0-9-]+$/;
3428
- const DISABLE_MODEL_INVOCATION_LINE = /^[ \t]*disable-model-invocation:[ \t]*true[ \t]*\r?$/m;
3429
- function copyTreeNoLinks(source, target) {
3430
- const stat = lstatSync3(source);
3431
- if (stat.isSymbolicLink()) throw new Error("pi_managed_mcp_source_symlink_blocked");
3432
- if (stat.isDirectory()) {
3433
- mkdirSync3(target, { recursive: true, mode: 448 });
3434
- chmodSync3(target, 448);
3435
- for (const entry of readdirSync3(source)) {
3436
- copyTreeNoLinks(join4(source, entry), join4(target, entry));
3437
- }
3438
- return;
3439
- }
3440
- if (!stat.isFile()) throw new Error("pi_managed_mcp_source_type_blocked");
3441
- mkdirSync3(dirname3(target), { recursive: true, mode: 448 });
3442
- copyFileSync(source, target);
3443
- chmodSync3(target, 384 | stat.mode & 73);
3444
- }
3445
3512
  function readSkillProfile(piHome, skillProfile) {
3446
3513
  const agentsRoot = resolve3(piHome, "agents");
3447
3514
  const agentFile = resolve3(agentsRoot, `${skillProfile}.md`);
@@ -3472,9 +3539,7 @@ function createManagedPiMcpProfileApi(options = {}) {
3472
3539
  }
3473
3540
  return profile;
3474
3541
  }
3475
- function materializeManagedRoleSkills(piHome, skillsDir, skillProfiles) {
3476
- if (existsSync3(skillsDir)) throw new Error("pi_managed_mcp_role_skills_exists");
3477
- const enabled = [];
3542
+ function resolveManagedRoleSkills(piHome, skillProfiles) {
3478
3543
  const entriesByName = /* @__PURE__ */ new Map();
3479
3544
  for (const skillProfile of skillProfiles) {
3480
3545
  for (const entry of readSkillProfile(piHome, skillProfile)) {
@@ -3488,16 +3553,14 @@ function createManagedPiMcpProfileApi(options = {}) {
3488
3553
  entriesByName.set(entry.name, entry);
3489
3554
  }
3490
3555
  }
3491
- for (const entry of entriesByName.values()) {
3492
- const target = join4(skillsDir, entry.name);
3493
- copyTreeNoLinks(entry.source, target);
3494
- const skillFile = join4(target, "SKILL.md");
3495
- writeFileSync3(skillFile, readFileSync3(skillFile, "utf8").replace(DISABLE_MODEL_INVOCATION_LINE, ""), {
3496
- mode: 384
3497
- });
3498
- enabled.push(entry.name);
3499
- }
3500
- return { skillsDir, enabled };
3556
+ const entries = [...entriesByName.values()].map((entry) => ({
3557
+ name: entry.name,
3558
+ filePath: realpathSync2(join4(entry.source, "SKILL.md"))
3559
+ }));
3560
+ return {
3561
+ enabled: entries.map((entry) => entry.name),
3562
+ entries
3563
+ };
3501
3564
  }
3502
3565
  function requestedSkillProfiles(input) {
3503
3566
  return [...new Set(
@@ -3840,16 +3903,14 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
3840
3903
  extensionArgs: [...extensionArgs]
3841
3904
  };
3842
3905
  }
3843
- const skillArgs = ["--no-approve"];
3844
3906
  let enabledRoleSkills = null;
3845
3907
  const skillProfiles = requestedSkillProfiles(input);
3846
3908
  if (skillProfiles.length > 0) {
3847
- const roleSkills = materializeManagedRoleSkills(
3848
- sharedRuntime.home,
3849
- join4(profileRoot, "role-skills"),
3850
- skillProfiles
3909
+ const roleSkills = resolveManagedRoleSkills(sharedRuntime.home, skillProfiles);
3910
+ writeProfileExtension(
3911
+ MANAGED_PI_ROLE_SKILLS_VISIBILITY_FILENAME,
3912
+ managedPiRoleSkillsVisibilityExtensionSource(roleSkills.entries)
3851
3913
  );
3852
- skillArgs.push("--skill", roleSkills.skillsDir);
3853
3914
  enabledRoleSkills = roleSkills.enabled;
3854
3915
  }
3855
3916
  const env = {
@@ -3916,7 +3977,6 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
3916
3977
  markerPath,
3917
3978
  env,
3918
3979
  extensionArgs,
3919
- skillArgs,
3920
3980
  spawnIdentity,
3921
3981
  workspaceMcpConfigPath,
3922
3982
  ...directAttestationInput ? {
@@ -4107,16 +4167,19 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
4107
4167
  };
4108
4168
  writePrivateFile2(configPath, `${JSON.stringify(config, null, 2)}
4109
4169
  `);
4170
+ const extensionArgs = [];
4110
4171
  const skillProfiles = requestedSkillProfiles(input);
4111
- const skillArgs = ["--no-approve"];
4112
4172
  let enabledRoleSkills = null;
4113
4173
  if (skillProfiles.length > 0) {
4114
- const roleSkills = materializeManagedRoleSkills(
4115
- sourcePiHome,
4116
- join4(profileRoot, "role-skills"),
4117
- skillProfiles
4174
+ const roleSkills = resolveManagedRoleSkills(sourcePiHome, skillProfiles);
4175
+ const extensionsDir = join4(profileRoot, "extensions");
4176
+ const extensionPath = join4(extensionsDir, MANAGED_PI_ROLE_SKILLS_VISIBILITY_FILENAME);
4177
+ mkdirSync3(extensionsDir, { recursive: true, mode: 448 });
4178
+ writePrivateFile2(
4179
+ extensionPath,
4180
+ managedPiRoleSkillsVisibilityExtensionSource(roleSkills.entries)
4118
4181
  );
4119
- skillArgs.push("--skill", roleSkills.skillsDir);
4182
+ extensionArgs.push("--extension", extensionPath);
4120
4183
  enabledRoleSkills = roleSkills.enabled;
4121
4184
  }
4122
4185
  const env = {
@@ -4158,7 +4221,7 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
4158
4221
  configPath,
4159
4222
  markerPath,
4160
4223
  env,
4161
- skillArgs,
4224
+ extensionArgs,
4162
4225
  toolAllowlist: null,
4163
4226
  protectedValues: [.../* @__PURE__ */ new Set([sessionToken, ...seededRuntime.protectedValues])],
4164
4227
  attestation: {
@@ -10438,7 +10501,7 @@ var source_acquisition_compatibility_default = {
10438
10501
  };
10439
10502
 
10440
10503
  // src/amaster-runtime-daemon.mjs
10441
- var CONNECTOR_VERSION = "0.1.1-beta.63";
10504
+ var CONNECTOR_VERSION = "0.1.1-beta.64";
10442
10505
  var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
10443
10506
  var SOURCE_ACQUISITION_CAPABILITY = source_acquisition_compatibility_default.profileVersion;
10444
10507
  var SOURCE_ACQUISITION_PROFILE_VERSION = source_acquisition_compatibility_default.profileVersion;
@@ -15181,8 +15244,8 @@ async function executeRunCommand(config, command) {
15181
15244
  if (executor.kind === "pi" && Array.isArray(managedMcpProfile.extensionArgs) && managedMcpProfile.extensionArgs.length > 0) {
15182
15245
  invocation.args = [...invocation.args, ...managedMcpProfile.extensionArgs];
15183
15246
  }
15184
- if (executor.kind === "pi" && Array.isArray(managedMcpProfile.skillArgs) && managedMcpProfile.skillArgs.length > 0) {
15185
- invocation.args = [...invocation.args, ...managedMcpProfile.skillArgs];
15247
+ if (executor.kind === "pi") {
15248
+ invocation.args = [...invocation.args, "--no-approve"];
15186
15249
  }
15187
15250
  await ingestLog(config, command, "system", "info", desktopDelegatedRunnerEnabled(config) && executor.kind === "pi" ? "Prepared desktop delegated Pi runtime action bridge" : `Attested isolated ${executor.kind} managed MCP profile`, {
15188
15251
  presentationKind: "managed_mcp_attestation",
@@ -6,7 +6,7 @@ import { basename, dirname, join, resolve } from "node:path";
6
6
  import { homedir, hostname } from "node:os";
7
7
  import { fileURLToPath } from "node:url";
8
8
 
9
- const CONNECTOR_VERSION = "0.1.1-beta.63";
9
+ const CONNECTOR_VERSION = "0.1.1-beta.64";
10
10
 
11
11
  const CAPABILITIES = [
12
12
  "remote_registration",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amaster.ai/employee-runtime-connector",
3
- "version": "0.1.1-beta.63",
3
+ "version": "0.1.1-beta.64",
4
4
  "description": "MirrorX runtime connector CLI and daemon",
5
5
  "license": "MIT",
6
6
  "type": "module",