@amaster.ai/employee-runtime-connector 0.1.1-beta.151 → 0.1.1-beta.152

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.
@@ -5410,6 +5410,10 @@ var companyStageSchema = external_exports.enum(COMPANY_STAGES);
5410
5410
  var coldStartStageSchema = external_exports.enum(COLD_START_STAGES);
5411
5411
  var coldStartExpectedActionSchema = external_exports.enum(COMPANY_COLD_START_ACTIONS);
5412
5412
  var companyColdStartFactSlotSchema = external_exports.enum(COMPANY_COLD_START_FACT_SLOTS);
5413
+ var companyColdStartFactSlotsSchema = external_exports.array(companyColdStartFactSlotSchema).min(1).max(COMPANY_COLD_START_FACT_SLOTS.length).transform((slots) => {
5414
+ const selected = new Set(slots);
5415
+ return COMPANY_COLD_START_FACT_SLOTS.filter((slot) => selected.has(slot));
5416
+ });
5413
5417
  var COLD_START_FACT_COVERAGE_DISPOSITIONS = [
5414
5418
  "established",
5415
5419
  "explicit_unknown",
@@ -11159,6 +11163,14 @@ var issueDeliveryAcceptanceGovernanceFindingSchema = external_exports.object({
11159
11163
  code: external_exports.literal("business_outcome_acceptance_policy_mismatch"),
11160
11164
  message: external_exports.string().min(1)
11161
11165
  }).strict();
11166
+ var issueDeliveryColdStartFactCoverageContextSchema = external_exports.object({
11167
+ worksetId: uuidSchema3,
11168
+ worksetItemId: uuidSchema3,
11169
+ factSlots: external_exports.array(external_exports.object({
11170
+ slot: companyColdStartFactSlotSchema,
11171
+ allowedDispositions: external_exports.array(coldStartFactCoverageDispositionSchema).min(1).max(3)
11172
+ }).strict()).min(1).max(6)
11173
+ }).strict();
11162
11174
  var issueDeliveryAcceptanceReadModelSchema = external_exports.object({
11163
11175
  companyId: uuidSchema3,
11164
11176
  issueId: uuidSchema3,
@@ -11175,7 +11187,8 @@ var issueDeliveryAcceptanceReadModelSchema = external_exports.object({
11175
11187
  }).strict(),
11176
11188
  pendingInteractions: external_exports.array(issueDeliveryAcceptancePendingInteractionSchema),
11177
11189
  forceDone: issueForceDoneEvidenceSchema.nullable(),
11178
- nextOwner: issueDeliveryAcceptanceNextOwnerSchema
11190
+ nextOwner: issueDeliveryAcceptanceNextOwnerSchema,
11191
+ coldStartFactCoverage: issueDeliveryColdStartFactCoverageContextSchema.nullable().default(null)
11179
11192
  }).strict();
11180
11193
 
11181
11194
  // ../shared/src/operating-accounting.ts
@@ -19929,22 +19942,39 @@ function hostFrontmatterField(frontmatter, field) {
19929
19942
  function hostEscapeXml(value) {
19930
19943
  return String(value).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
19931
19944
  }
19945
+ function readManagedPiSkillMetadata(filePath) {
19946
+ const resolvedFilePath = realpathSync2(filePath);
19947
+ const source = readFileSync7(resolvedFilePath, "utf8");
19948
+ const match = source.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
19949
+ if (!match) {
19950
+ return {
19951
+ filePath: resolvedFilePath,
19952
+ hasFrontmatter: false,
19953
+ name: null,
19954
+ description: null,
19955
+ hidden: false
19956
+ };
19957
+ }
19958
+ return {
19959
+ filePath: resolvedFilePath,
19960
+ hasFrontmatter: true,
19961
+ name: hostFrontmatterField(match[1], "name"),
19962
+ description: hostFrontmatterField(match[1], "description"),
19963
+ hidden: hostFrontmatterField(match[1], "disable-model-invocation")?.toLowerCase() === "true"
19964
+ };
19965
+ }
19932
19966
  function measureManagedPiRoleSkillMetadata(expectedSkills) {
19933
19967
  const entries = expectedSkills.map((expected) => {
19934
- const source = readFileSync7(realpathSync2(expected.filePath), "utf8");
19935
- const match = source.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
19936
- if (!match) throw new Error(`managed skill frontmatter missing: ${expected.name}`);
19937
- const name = hostFrontmatterField(match[1], "name");
19938
- const description = hostFrontmatterField(match[1], "description");
19939
- const hidden = hostFrontmatterField(match[1], "disable-model-invocation")?.toLowerCase() === "true";
19940
- if (name !== expected.name || !description || expected.requireHidden !== false && !hidden) {
19968
+ const metadata = readManagedPiSkillMetadata(expected.filePath);
19969
+ if (!metadata.hasFrontmatter) throw new Error(`managed skill frontmatter missing: ${expected.name}`);
19970
+ if (metadata.name !== expected.name || typeof metadata.description !== "string" || !metadata.description.trim() || expected.requireHidden !== false && !metadata.hidden) {
19941
19971
  throw new Error(`managed skill metadata mismatch: ${expected.name}`);
19942
19972
  }
19943
19973
  return [
19944
19974
  " <skill>",
19945
- ` <name>${hostEscapeXml(name)}</name>`,
19946
- ` <description>${hostEscapeXml(description)}</description>`,
19947
- ` <location>${hostEscapeXml(realpathSync2(expected.filePath))}</location>`,
19975
+ ` <name>${hostEscapeXml(metadata.name)}</name>`,
19976
+ ` <description>${hostEscapeXml(metadata.description)}</description>`,
19977
+ ` <location>${hostEscapeXml(metadata.filePath)}</location>`,
19948
19978
  " </skill>"
19949
19979
  ].join("\n");
19950
19980
  }).join("\n");
@@ -20016,7 +20046,10 @@ function readRoleSkill(expected) {
20016
20046
  const name = frontmatterField(match[1], "name");
20017
20047
  const description = frontmatterField(match[1], "description");
20018
20048
  const hidden = frontmatterField(match[1], "disable-model-invocation")?.toLowerCase() === "true";
20019
- if (name !== expected.name || !description || (expected.requireHidden !== false && !hidden)) {
20049
+ if (name !== expected.name
20050
+ || typeof description !== "string"
20051
+ || !description.trim()
20052
+ || (expected.requireHidden !== false && !hidden)) {
20020
20053
  throw new Error("managed skill metadata mismatch: " + expected.name);
20021
20054
  }
20022
20055
  return {
@@ -20214,6 +20247,7 @@ function createManagedPiMcpProfileApi(options = {}) {
20214
20247
  const ownershipStatSyncImpl = typeof options.ownershipStatSync === "function" ? options.ownershipStatSync : statSync4;
20215
20248
  const nowImpl = typeof options.now === "function" ? options.now : Date.now;
20216
20249
  const warnImpl = typeof options.warn === "function" ? options.warn : console.warn;
20250
+ const sourceAcquisitionExtensionDigest = options.sourceAcquisitionExtensionDigest === void 0 ? process.env.AMASTER_SOURCE_ACQUISITION_EXTENSION_DIGEST : options.sourceAcquisitionExtensionDigest;
20217
20251
  const SUPPORTED_SCHEMA_VERSION2 = "amaster.governed-mcp.v1";
20218
20252
  const SUPPORTED_SERVER_NAME2 = "amaster";
20219
20253
  const DIRECT_CATALOG_SCHEMA_VERSION = "amaster.governed-mcp-direct-catalog.v1";
@@ -20406,10 +20440,21 @@ function createManagedPiMcpProfileApi(options = {}) {
20406
20440
  if (mode !== 384) throw new Error(`pi_managed_mcp_permissions_failed: ${filePath} mode=${mode.toString(8)}`);
20407
20441
  }
20408
20442
  function resolveSourceAcquisitionExtension(sharedPiHome, sourceAcquisition) {
20409
- const expectedDigest = sourceAcquisition?.profile?.connectorAdmission?.sourceExtensionDigest;
20410
- if (typeof expectedDigest !== "string" || !/^[a-f0-9]{64}$/i.test(expectedDigest)) {
20443
+ const profileDigestValue = sourceAcquisition?.profile?.connectorAdmission?.sourceExtensionDigest;
20444
+ const runtimeDigestValue = sourceAcquisitionExtensionDigest;
20445
+ const runtimeDigestProvided = runtimeDigestValue !== void 0 && runtimeDigestValue !== null;
20446
+ const profileDigest = typeof profileDigestValue === "string" && /^[a-f0-9]{64}$/i.test(profileDigestValue) ? profileDigestValue.toLowerCase() : null;
20447
+ const runtimeDigest = typeof runtimeDigestValue === "string" && /^[a-f0-9]{64}$/i.test(runtimeDigestValue) ? runtimeDigestValue.toLowerCase() : null;
20448
+ if (profileDigestValue !== void 0 && !profileDigest) {
20449
+ throw new Error("source_acquisition_extension_profile_digest_invalid");
20450
+ }
20451
+ if (!profileDigest && !runtimeDigest) {
20411
20452
  throw new Error("source_acquisition_extension_profile_digest_invalid");
20412
20453
  }
20454
+ if (runtimeDigestProvided && (!runtimeDigest || profileDigest && profileDigest !== runtimeDigest)) {
20455
+ throw new Error("source_acquisition_extension_digest_mismatch");
20456
+ }
20457
+ const expectedDigest = profileDigest ?? runtimeDigest;
20413
20458
  const extensionPath = join7(sharedPiHome, "extensions", "amaster-source-acquisition.js");
20414
20459
  let extensionStat;
20415
20460
  try {
@@ -20428,7 +20473,7 @@ function createManagedPiMcpProfileApi(options = {}) {
20428
20473
  if (error?.code === "ENOENT") throw new Error("source_acquisition_extension_missing");
20429
20474
  throw new Error("source_acquisition_extension_unsafe");
20430
20475
  }
20431
- if (sha2565(extensionBytes) !== expectedDigest.toLowerCase()) {
20476
+ if (sha2565(extensionBytes) !== expectedDigest) {
20432
20477
  throw new Error("source_acquisition_extension_digest_mismatch");
20433
20478
  }
20434
20479
  return extensionBytes;
@@ -21277,10 +21322,29 @@ function createManagedPiMcpProfileApi(options = {}) {
21277
21322
  function readMainSkills(piHome) {
21278
21323
  const skillsRoot = resolve6(piHome, "skills");
21279
21324
  if (!existsSync6(skillsRoot)) return [];
21280
- return readdirSync3(skillsRoot).sort().flatMap((name) => {
21281
- const source = join7(skillsRoot, name);
21282
- return existsSync6(join7(source, "SKILL.md")) ? [{ name, source, requireHidden: false }] : [];
21283
- });
21325
+ const entriesByName = /* @__PURE__ */ new Map();
21326
+ for (const directory of readdirSync3(skillsRoot).sort()) {
21327
+ const source = join7(skillsRoot, directory);
21328
+ const skillFilePath = join7(source, "SKILL.md");
21329
+ if (!existsSync6(skillFilePath)) continue;
21330
+ const metadata = readManagedPiSkillMetadata(skillFilePath);
21331
+ if (!metadata.hasFrontmatter || typeof metadata.name !== "string" || !/^[a-z0-9-]+$/.test(metadata.name) || typeof metadata.description !== "string" || !metadata.description.trim()) {
21332
+ throw new Error(`pi_managed_mcp_main_skill_metadata_invalid:${directory}`);
21333
+ }
21334
+ const existing = entriesByName.get(metadata.name);
21335
+ if (existing) {
21336
+ if (existing.filePath !== metadata.filePath) {
21337
+ throw new Error(`pi_managed_mcp_main_skill_conflict:${metadata.name}`);
21338
+ }
21339
+ continue;
21340
+ }
21341
+ entriesByName.set(metadata.name, {
21342
+ name: metadata.name,
21343
+ filePath: metadata.filePath,
21344
+ requireHidden: false
21345
+ });
21346
+ }
21347
+ return [...entriesByName.values()];
21284
21348
  }
21285
21349
  function resolveManagedRoleSkills(piHome, skillProfiles) {
21286
21350
  const entriesByName = /* @__PURE__ */ new Map();
@@ -21302,11 +21366,19 @@ function createManagedPiMcpProfileApi(options = {}) {
21302
21366
  }
21303
21367
  }
21304
21368
  for (const entry of readMainSkills(piHome)) {
21305
- if (!entriesByName.has(entry.name)) entriesByName.set(entry.name, entry);
21369
+ const existing = entriesByName.get(entry.name);
21370
+ if (existing) {
21371
+ const existingFilePath = realpathSync3(join7(existing.source, "SKILL.md"));
21372
+ if (existingFilePath !== entry.filePath) {
21373
+ throw new Error(`pi_managed_mcp_main_skill_conflict:${entry.name}`);
21374
+ }
21375
+ continue;
21376
+ }
21377
+ entriesByName.set(entry.name, entry);
21306
21378
  }
21307
21379
  const entries = [...entriesByName.values()].map((entry) => ({
21308
21380
  name: entry.name,
21309
- filePath: realpathSync3(join7(entry.source, "SKILL.md")),
21381
+ filePath: entry.filePath ?? realpathSync3(join7(entry.source, "SKILL.md")),
21310
21382
  ...entry.requireHidden === false ? { requireHidden: false } : {}
21311
21383
  }));
21312
21384
  const metadata = measureManagedPiRoleSkillMetadata(entries);
@@ -29840,7 +29912,7 @@ function createSourceCompletionStopPolicy({
29840
29912
  }
29841
29913
 
29842
29914
  // src/amaster-runtime-daemon.mjs
29843
- var CONNECTOR_VERSION = "0.1.1-beta.151";
29915
+ var CONNECTOR_VERSION = "0.1.1-beta.152";
29844
29916
  var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
29845
29917
  var SOURCE_ACQUISITION_CAPABILITY2 = source_acquisition_compatibility_default.profileVersion;
29846
29918
  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.151";
10
+ const CONNECTOR_VERSION = "0.1.1-beta.152";
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.151",
3
+ "version": "0.1.1-beta.152",
4
4
  "description": "MirrorX runtime connector CLI and daemon",
5
5
  "license": "MIT",
6
6
  "type": "module",