@amaster.ai/employee-runtime-connector 0.1.1-beta.150 → 0.1.1-beta.151
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.
|
@@ -19933,12 +19933,12 @@ function measureManagedPiRoleSkillMetadata(expectedSkills) {
|
|
|
19933
19933
|
const entries = expectedSkills.map((expected) => {
|
|
19934
19934
|
const source = readFileSync7(realpathSync2(expected.filePath), "utf8");
|
|
19935
19935
|
const match = source.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
|
|
19936
|
-
if (!match) throw new Error(`
|
|
19936
|
+
if (!match) throw new Error(`managed skill frontmatter missing: ${expected.name}`);
|
|
19937
19937
|
const name = hostFrontmatterField(match[1], "name");
|
|
19938
19938
|
const description = hostFrontmatterField(match[1], "description");
|
|
19939
19939
|
const hidden = hostFrontmatterField(match[1], "disable-model-invocation")?.toLowerCase() === "true";
|
|
19940
|
-
if (name !== expected.name || !description || !hidden) {
|
|
19941
|
-
throw new Error(`
|
|
19940
|
+
if (name !== expected.name || !description || expected.requireHidden !== false && !hidden) {
|
|
19941
|
+
throw new Error(`managed skill metadata mismatch: ${expected.name}`);
|
|
19942
19942
|
}
|
|
19943
19943
|
return [
|
|
19944
19944
|
" <skill>",
|
|
@@ -20012,12 +20012,12 @@ function readRoleSkill(expected) {
|
|
|
20012
20012
|
const filePath = realpathSync(expected.filePath);
|
|
20013
20013
|
const source = readFileSync(filePath, "utf8");
|
|
20014
20014
|
const match = source.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
|
|
20015
|
-
if (!match) throw new Error("
|
|
20015
|
+
if (!match) throw new Error("managed skill frontmatter missing: " + expected.name);
|
|
20016
20016
|
const name = frontmatterField(match[1], "name");
|
|
20017
20017
|
const description = frontmatterField(match[1], "description");
|
|
20018
20018
|
const hidden = frontmatterField(match[1], "disable-model-invocation")?.toLowerCase() === "true";
|
|
20019
|
-
if (name !== expected.name || !description || !hidden) {
|
|
20020
|
-
throw new Error("
|
|
20019
|
+
if (name !== expected.name || !description || (expected.requireHidden !== false && !hidden)) {
|
|
20020
|
+
throw new Error("managed skill metadata mismatch: " + expected.name);
|
|
20021
20021
|
}
|
|
20022
20022
|
return {
|
|
20023
20023
|
name,
|
|
@@ -21274,6 +21274,14 @@ function createManagedPiMcpProfileApi(options = {}) {
|
|
|
21274
21274
|
return existsSync6(join7(source, "SKILL.md")) ? [{ name, source }] : [];
|
|
21275
21275
|
});
|
|
21276
21276
|
}
|
|
21277
|
+
function readMainSkills(piHome) {
|
|
21278
|
+
const skillsRoot = resolve6(piHome, "skills");
|
|
21279
|
+
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
|
+
});
|
|
21284
|
+
}
|
|
21277
21285
|
function resolveManagedRoleSkills(piHome, skillProfiles) {
|
|
21278
21286
|
const entriesByName = /* @__PURE__ */ new Map();
|
|
21279
21287
|
for (const skillProfile of skillProfiles) {
|
|
@@ -21288,12 +21296,18 @@ function createManagedPiMcpProfileApi(options = {}) {
|
|
|
21288
21296
|
entriesByName.set(entry.name, entry);
|
|
21289
21297
|
}
|
|
21290
21298
|
}
|
|
21291
|
-
|
|
21299
|
+
if (skillProfiles.length > 0) {
|
|
21300
|
+
for (const entry of readCommonRoleSkills(piHome)) {
|
|
21301
|
+
if (!entriesByName.has(entry.name)) entriesByName.set(entry.name, entry);
|
|
21302
|
+
}
|
|
21303
|
+
}
|
|
21304
|
+
for (const entry of readMainSkills(piHome)) {
|
|
21292
21305
|
if (!entriesByName.has(entry.name)) entriesByName.set(entry.name, entry);
|
|
21293
21306
|
}
|
|
21294
21307
|
const entries = [...entriesByName.values()].map((entry) => ({
|
|
21295
21308
|
name: entry.name,
|
|
21296
|
-
filePath: realpathSync3(join7(entry.source, "SKILL.md"))
|
|
21309
|
+
filePath: realpathSync3(join7(entry.source, "SKILL.md")),
|
|
21310
|
+
...entry.requireHidden === false ? { requireHidden: false } : {}
|
|
21297
21311
|
}));
|
|
21298
21312
|
const metadata = measureManagedPiRoleSkillMetadata(entries);
|
|
21299
21313
|
return {
|
|
@@ -21317,9 +21331,9 @@ function createManagedPiMcpProfileApi(options = {}) {
|
|
|
21317
21331
|
return [];
|
|
21318
21332
|
}
|
|
21319
21333
|
function skillProfilesAttestation(skillProfiles, enabledSkills, enabledSkillMetadataBytes, enabledSkillMetadataSha256) {
|
|
21320
|
-
if (
|
|
21334
|
+
if (!Array.isArray(enabledSkills) || enabledSkills.length === 0) return {};
|
|
21321
21335
|
return {
|
|
21322
|
-
skillProfiles,
|
|
21336
|
+
...skillProfiles.length > 0 ? { skillProfiles } : {},
|
|
21323
21337
|
enabledSkillsDigest: createHash8("sha256").update(JSON.stringify(enabledSkills)).digest("hex"),
|
|
21324
21338
|
enabledSkillMetadataBytes,
|
|
21325
21339
|
enabledSkillMetadataSha256
|
|
@@ -21873,15 +21887,17 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
21873
21887
|
let enabledRoleSkillMetadataBytes = 0;
|
|
21874
21888
|
let enabledRoleSkillMetadataSha256 = null;
|
|
21875
21889
|
const skillProfiles = roleSkillProfilesForRun(input);
|
|
21876
|
-
if (
|
|
21890
|
+
if (!input.sourceAcquisition) {
|
|
21877
21891
|
const roleSkills = resolveManagedRoleSkills(sharedRuntime.home, skillProfiles);
|
|
21878
|
-
|
|
21879
|
-
|
|
21880
|
-
|
|
21881
|
-
|
|
21882
|
-
|
|
21883
|
-
|
|
21884
|
-
|
|
21892
|
+
if (roleSkills.entries.length > 0) {
|
|
21893
|
+
writeProfileExtension(
|
|
21894
|
+
MANAGED_PI_ROLE_SKILLS_VISIBILITY_FILENAME,
|
|
21895
|
+
managedPiRoleSkillsVisibilityExtensionSource(roleSkills.entries)
|
|
21896
|
+
);
|
|
21897
|
+
enabledRoleSkills = roleSkills.enabled;
|
|
21898
|
+
enabledRoleSkillMetadataBytes = roleSkills.serializedMetadataBytes;
|
|
21899
|
+
enabledRoleSkillMetadataSha256 = roleSkills.serializedMetadataSha256;
|
|
21900
|
+
}
|
|
21885
21901
|
}
|
|
21886
21902
|
if (input.sourceAcquisition && effectiveToolsAttestorExtensionPath) {
|
|
21887
21903
|
const attestorPathIndex = extensionArgs.indexOf(effectiveToolsAttestorExtensionPath);
|
|
@@ -22263,19 +22279,21 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
22263
22279
|
let enabledRoleSkills = null;
|
|
22264
22280
|
let enabledRoleSkillMetadataBytes = 0;
|
|
22265
22281
|
let enabledRoleSkillMetadataSha256 = null;
|
|
22266
|
-
if (
|
|
22282
|
+
if (!input.sourceAcquisition) {
|
|
22267
22283
|
const roleSkills = resolveManagedRoleSkills(sourcePiHome, skillProfiles);
|
|
22268
|
-
|
|
22269
|
-
|
|
22270
|
-
|
|
22271
|
-
|
|
22272
|
-
|
|
22273
|
-
|
|
22274
|
-
|
|
22275
|
-
|
|
22276
|
-
|
|
22277
|
-
|
|
22278
|
-
|
|
22284
|
+
if (roleSkills.entries.length > 0) {
|
|
22285
|
+
const extensionsDir = join7(profileRoot, "extensions");
|
|
22286
|
+
const extensionPath = join7(extensionsDir, MANAGED_PI_ROLE_SKILLS_VISIBILITY_FILENAME);
|
|
22287
|
+
mkdirSync3(extensionsDir, { recursive: true, mode: 448 });
|
|
22288
|
+
writePrivateFile2(
|
|
22289
|
+
extensionPath,
|
|
22290
|
+
managedPiRoleSkillsVisibilityExtensionSource(roleSkills.entries)
|
|
22291
|
+
);
|
|
22292
|
+
extensionArgs.push("--extension", extensionPath);
|
|
22293
|
+
enabledRoleSkills = roleSkills.enabled;
|
|
22294
|
+
enabledRoleSkillMetadataBytes = roleSkills.serializedMetadataBytes;
|
|
22295
|
+
enabledRoleSkillMetadataSha256 = roleSkills.serializedMetadataSha256;
|
|
22296
|
+
}
|
|
22279
22297
|
}
|
|
22280
22298
|
const env = {
|
|
22281
22299
|
...input.baseEnv,
|
|
@@ -23430,6 +23448,8 @@ function taskAcceptanceContractSection(context, input) {
|
|
|
23430
23448
|
const requirementCompletion = asRecord(requirements.completion);
|
|
23431
23449
|
const delivery = asRecord(contract.delivery);
|
|
23432
23450
|
const acceptance = asRecord(contract.acceptance);
|
|
23451
|
+
const outcomeAuthority = asRecord(contract.outcome_authority);
|
|
23452
|
+
const completionReview = asRecord(contract.completion_review);
|
|
23433
23453
|
const criteria = Array.isArray(contract.acceptance_criteria) ? contract.acceptance_criteria.map(asRecord) : [];
|
|
23434
23454
|
const allowedKinds = Array.isArray(delivery.allowed_kinds) ? delivery.allowed_kinds.map(readString).filter(Boolean) : [];
|
|
23435
23455
|
const acceptanceContracts = Array.isArray(delivery.acceptance_contracts) ? delivery.acceptance_contracts : [];
|
|
@@ -23440,7 +23460,7 @@ function taskAcceptanceContractSection(context, input) {
|
|
|
23440
23460
|
const sourceRef = readString(contract.source_ref);
|
|
23441
23461
|
const validCriteria = criteria.length > 0 && criteria.every((criterion) => readString(criterion.ref) && readString(criterion.text));
|
|
23442
23462
|
const validEnrollmentIdentity = schemaVersion === "mirrorx.task-acceptance-contract.v1" && readString(enrollment.id) && Number.isInteger(enrollment.revision) && enrollmentRequirementRevision && readString(enrollment.request_hash) && sourceRef === `business_task_enrollment:${readString(enrollment.id)}@${enrollmentRequirementRevision}`;
|
|
23443
|
-
const validParentGovernedChildIdentity = schemaVersion === "mirrorx.task-acceptance-contract.
|
|
23463
|
+
const validParentGovernedChildIdentity = schemaVersion === "mirrorx.task-acceptance-contract.v3" && Object.keys(enrollment).length === 0 && Object.keys(acceptance).length === 0 && readString(authority.kind) === "parent_governed_child" && parentRequirementRevision && readString(authority.requirements_hash) === canonicalSha256(requirements) && ["required_execution", "final_aggregation"].includes(readString(authority.completion_role)) && ["none", "package", "own_deliverable", "delegated_final_aggregation"].includes(readString(authority.review_authority)) && sourceRef === `parent_governed_child:${readString(contract.issue_id)}@${parentRequirementRevision}`;
|
|
23444
23464
|
const validIdentity2 = readString(contract.company_id) && readString(contract.issue_id) && Number.isInteger(contract.execution_epoch) && readString(contract.observed_at) && requirementRevision && Boolean(validEnrollmentIdentity || validParentGovernedChildIdentity);
|
|
23445
23465
|
const noManifestDelivery = delivery.contract_state === "not_required";
|
|
23446
23466
|
const uniqueAllowedKinds = new Set(allowedKinds).size === allowedKinds.length;
|
|
@@ -23448,9 +23468,17 @@ function taskAcceptanceContractSection(context, input) {
|
|
|
23448
23468
|
const validManifestDelivery = allowedKinds.length > 0 && (delivery.contract_state === "explicit_typed" || delivery.contract_state === "acceptance_refs_only") && (delivery.contract_state !== "explicit_typed" || acceptanceContracts.length > 0);
|
|
23449
23469
|
const validDelivery = uniqueAllowedKinds && (validNoManifestDelivery || validManifestDelivery);
|
|
23450
23470
|
const validOwnedAcceptance = readString(acceptance.owner_agent_id) && Object.keys(asRecord(acceptance.policy)).length > 0 && readString(acceptance.expected_outcome_at);
|
|
23451
|
-
const
|
|
23452
|
-
const
|
|
23453
|
-
|
|
23471
|
+
const validParentDelegatedOutcomeAuthority = validParentGovernedChildIdentity && readString(requirementIntent.reason) === "parent_governed_child" && ["required_execution", "final_aggregation"].includes(readString(requirementCompletion.role)) && readString(requirementOutcome.mode) === "none" && readString(outcomeAuthority.mode) === "delegated_to_parent" && outcomeAuthority.owner_agent_id === null && outcomeAuthority.policy === null && outcomeAuthority.expected_outcome_at === null;
|
|
23472
|
+
const validIndependentOutcomeAuthority = validParentGovernedChildIdentity && readString(outcomeAuthority.mode) === "independent" && readString(outcomeAuthority.owner_agent_id) && Object.keys(asRecord(outcomeAuthority.policy)).length > 0 && readString(outcomeAuthority.expected_outcome_at);
|
|
23473
|
+
const expectedCompletionReview = {
|
|
23474
|
+
none: { required_before_done: false, request_owner: "none", decision_owner: "none" },
|
|
23475
|
+
package: { required_before_done: true, request_owner: "this_issue_agent", decision_owner: "board" },
|
|
23476
|
+
own_deliverable: { required_before_done: false, request_owner: "this_issue_agent", decision_owner: "board" },
|
|
23477
|
+
delegated_final_aggregation: { required_before_done: false, request_owner: "final_aggregation_child", decision_owner: "board" }
|
|
23478
|
+
}[readString(authority.review_authority)];
|
|
23479
|
+
const validCompletionReview = validParentGovernedChildIdentity && expectedCompletionReview && sameCanonicalJson(completionReview, expectedCompletionReview);
|
|
23480
|
+
const validAcceptanceAuthority = validEnrollmentIdentity ? validOwnedAcceptance : validParentDelegatedOutcomeAuthority || validIndependentOutcomeAuthority;
|
|
23481
|
+
if (!validIdentity2 || !validCriteria || !validDelivery || !validAcceptanceAuthority || validParentGovernedChildIdentity && !validCompletionReview) {
|
|
23454
23482
|
throw taskAcceptanceContractError(
|
|
23455
23483
|
"task_acceptance_contract_invalid",
|
|
23456
23484
|
"Task Acceptance Contract is incomplete or internally inconsistent"
|
|
@@ -23469,7 +23497,8 @@ function taskAcceptanceContractSection(context, input) {
|
|
|
23469
23497
|
...validParentGovernedChildIdentity ? [asRecord(requirementIntent.source), asRecord(requirementCompletion.source)] : []
|
|
23470
23498
|
].every((source) => readString(source.revision) === requirementRevision);
|
|
23471
23499
|
const parentAuthorityMatches = !validParentGovernedChildIdentity || readString(authority.completion_role) === readString(requirementCompletion.role) && readString(authority.review_authority) === readString(requirementCompletion.reviewAuthority);
|
|
23472
|
-
|
|
23500
|
+
const parentOutcomeAuthorityMatches = !validParentGovernedChildIdentity || validParentDelegatedOutcomeAuthority || readString(requirementOutcome.mode) === "required" && readString(requirementOutcome.acceptanceOwnerAgentId) === readString(outcomeAuthority.owner_agent_id) && readString(requirementOutcome.expectedOutcomeAt) === readString(outcomeAuthority.expected_outcome_at) && sameCanonicalJson(requirementOutcome.acceptancePolicy, outcomeAuthority.policy);
|
|
23501
|
+
if (!revisionsMatch || !parentAuthorityMatches || (noManifestDelivery ? readString(requirementDelivery.mode) !== "none" || requirementAcceptanceRefs.length > 0 : !sameCanonicalJson(criterionRefs, requirementAcceptanceRefs)) || validParentGovernedChildIdentity && !sameCanonicalJson(criteria, requirementCriteria) || !sameCanonicalJson(allowedKinds, requirementAllowedKinds) || !sameCanonicalJson(acceptanceContracts, requirementContracts) || !parentOutcomeAuthorityMatches || validEnrollmentIdentity && (readString(requirementOutcome.acceptanceOwnerAgentId) !== readString(acceptance.owner_agent_id) || readString(requirementOutcome.expectedOutcomeAt) !== readString(acceptance.expected_outcome_at) || !sameCanonicalJson(requirementOutcome.acceptancePolicy, acceptance.policy))) {
|
|
23473
23502
|
throw taskAcceptanceContractError(
|
|
23474
23503
|
"task_acceptance_contract_invalid",
|
|
23475
23504
|
"Task Acceptance Contract does not match the active Task requirement projection"
|
|
@@ -29811,7 +29840,7 @@ function createSourceCompletionStopPolicy({
|
|
|
29811
29840
|
}
|
|
29812
29841
|
|
|
29813
29842
|
// src/amaster-runtime-daemon.mjs
|
|
29814
|
-
var CONNECTOR_VERSION = "0.1.1-beta.
|
|
29843
|
+
var CONNECTOR_VERSION = "0.1.1-beta.151";
|
|
29815
29844
|
var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
|
|
29816
29845
|
var SOURCE_ACQUISITION_CAPABILITY2 = source_acquisition_compatibility_default.profileVersion;
|
|
29817
29846
|
var daemonRequire = createRequire(import.meta.url);
|
package/dist/amaster-runtime.mjs
CHANGED
|
@@ -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.
|
|
10
|
+
const CONNECTOR_VERSION = "0.1.1-beta.151";
|
|
11
11
|
|
|
12
12
|
const CONFIG_KEY_MAP = new Map([
|
|
13
13
|
["server_url", "AMASTER_EMPLOYEE_SERVER_URL"],
|