@amaster.ai/employee-runtime-connector 0.1.1-beta.25 → 0.1.1-beta.26
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/amaster-runtime-daemon.mjs +61 -116
- package/dist/amaster-runtime.mjs +1 -4
- package/package.json +1 -1
|
@@ -1871,10 +1871,11 @@ import { spawnSync as spawnSync2 } from "node:child_process";
|
|
|
1871
1871
|
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, renameSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
1872
1872
|
import { dirname as dirname2, join as join3 } from "node:path";
|
|
1873
1873
|
var AMASTER_API_KEY_ENV_REFERENCE = "${AMASTER_API_KEY}";
|
|
1874
|
+
var AMASTER_BILLING_TURN_HEADER_ENV_REFERENCE = "${AMASTER_BILLING_TURN_ID}";
|
|
1874
1875
|
var AMASTER_BILLING_HEADER_ENV_REFERENCES = Object.freeze({
|
|
1875
1876
|
"x-pi-agent-oauth-token": "${AMASTER_PLATFORM_OAUTH_TOKEN}",
|
|
1876
1877
|
"x-organization-id": "${AMASTER_PLATFORM_ORGANIZATION_ID}",
|
|
1877
|
-
"x-billing-turn-id":
|
|
1878
|
+
"x-billing-turn-id": AMASTER_BILLING_TURN_HEADER_ENV_REFERENCE
|
|
1878
1879
|
});
|
|
1879
1880
|
var MANAGED_PI_PROVIDER_ENV_NAMES = Object.freeze([
|
|
1880
1881
|
"AMASTER_MODEL_ACCESS_MODE",
|
|
@@ -1933,6 +1934,8 @@ function syncManagedBillingHeaders(value, executorEnv) {
|
|
|
1933
1934
|
const headers = withoutManagedBillingHeaders(value);
|
|
1934
1935
|
if (readString(executorEnv.AMASTER_MODEL_ACCESS_MODE) === "billing_gateway") {
|
|
1935
1936
|
Object.assign(headers, AMASTER_BILLING_HEADER_ENV_REFERENCES);
|
|
1937
|
+
} else if (readString(executorEnv.AMASTER_BILLING_TURN_ID)) {
|
|
1938
|
+
headers["x-billing-turn-id"] = AMASTER_BILLING_TURN_HEADER_ENV_REFERENCE;
|
|
1936
1939
|
}
|
|
1937
1940
|
return Object.keys(headers).length > 0 ? headers : void 0;
|
|
1938
1941
|
}
|
|
@@ -3232,11 +3235,23 @@ function createManagedPiMcpProfileApi(options = {}) {
|
|
|
3232
3235
|
}
|
|
3233
3236
|
return profile;
|
|
3234
3237
|
}
|
|
3235
|
-
function materializeManagedRoleSkills(piHome, skillsDir,
|
|
3236
|
-
const profile = readSkillProfile(piHome, skillProfile);
|
|
3238
|
+
function materializeManagedRoleSkills(piHome, skillsDir, skillProfiles) {
|
|
3237
3239
|
if (existsSync3(skillsDir)) throw new Error("pi_managed_mcp_role_skills_exists");
|
|
3238
3240
|
const enabled = [];
|
|
3239
|
-
|
|
3241
|
+
const entriesByName = /* @__PURE__ */ new Map();
|
|
3242
|
+
for (const skillProfile of skillProfiles) {
|
|
3243
|
+
for (const entry of readSkillProfile(piHome, skillProfile)) {
|
|
3244
|
+
const existing = entriesByName.get(entry.name);
|
|
3245
|
+
if (existing) {
|
|
3246
|
+
if (realpathSync2(existing.source) !== realpathSync2(entry.source)) {
|
|
3247
|
+
throw new Error(`pi_managed_mcp_skill_profile_conflict:${entry.name}`);
|
|
3248
|
+
}
|
|
3249
|
+
continue;
|
|
3250
|
+
}
|
|
3251
|
+
entriesByName.set(entry.name, entry);
|
|
3252
|
+
}
|
|
3253
|
+
}
|
|
3254
|
+
for (const entry of entriesByName.values()) {
|
|
3240
3255
|
const target = join4(skillsDir, entry.name);
|
|
3241
3256
|
copyTreeNoLinks(entry.source, target);
|
|
3242
3257
|
const skillFile = join4(target, "SKILL.md");
|
|
@@ -3247,6 +3262,19 @@ function createManagedPiMcpProfileApi(options = {}) {
|
|
|
3247
3262
|
}
|
|
3248
3263
|
return { skillsDir, enabled };
|
|
3249
3264
|
}
|
|
3265
|
+
function requestedSkillProfiles(input) {
|
|
3266
|
+
return [...new Set([
|
|
3267
|
+
...Array.isArray(input.skillProfiles) ? input.skillProfiles : [],
|
|
3268
|
+
input.skillProfile
|
|
3269
|
+
].filter((value) => typeof value === "string" && value.trim()).map((value) => value.trim()))];
|
|
3270
|
+
}
|
|
3271
|
+
function skillProfileAttestation(skillProfiles, enabledSkills) {
|
|
3272
|
+
if (skillProfiles.length === 0) return {};
|
|
3273
|
+
return {
|
|
3274
|
+
...skillProfiles.length === 1 ? { skillProfile: skillProfiles[0] } : { skillProfiles },
|
|
3275
|
+
enabledSkillsDigest: createHash3("sha256").update(JSON.stringify(enabledSkills)).digest("hex")
|
|
3276
|
+
};
|
|
3277
|
+
}
|
|
3250
3278
|
function seedDelegatedPiRuntime(sourceHome, agentDir) {
|
|
3251
3279
|
const source = resolve3(nonEmpty2(sourceHome, "sourcePiHome"));
|
|
3252
3280
|
const sourceStat = lstatSync3(source);
|
|
@@ -3556,27 +3584,19 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
3556
3584
|
}
|
|
3557
3585
|
const skillArgs = [];
|
|
3558
3586
|
let enabledRoleSkills = null;
|
|
3559
|
-
const
|
|
3560
|
-
if (
|
|
3587
|
+
const skillProfiles = requestedSkillProfiles(input);
|
|
3588
|
+
if (skillProfiles.length > 0) {
|
|
3561
3589
|
const roleSkills = materializeManagedRoleSkills(
|
|
3562
3590
|
sharedRuntime.home,
|
|
3563
3591
|
join4(profileRoot, "role-skills"),
|
|
3564
|
-
|
|
3592
|
+
skillProfiles
|
|
3565
3593
|
);
|
|
3566
3594
|
skillArgs.push("--no-approve", "--skill", roleSkills.skillsDir);
|
|
3567
3595
|
enabledRoleSkills = roleSkills.enabled;
|
|
3568
3596
|
}
|
|
3569
|
-
const providerEnv = {};
|
|
3570
|
-
for (const name of MANAGED_PI_PROVIDER_ENV_NAMES) {
|
|
3571
|
-
const commandValue = input.commandEnv?.[name];
|
|
3572
|
-
if (typeof commandValue === "string" && commandValue) continue;
|
|
3573
|
-
const value = input.baseEnv?.[name];
|
|
3574
|
-
if (typeof value === "string" && value) providerEnv[name] = value;
|
|
3575
|
-
}
|
|
3576
3597
|
const env = {
|
|
3577
3598
|
...sharedRuntime.settingsEnv,
|
|
3578
3599
|
...buildIsolatedEnvironment2(input.baseEnv, input.commandEnv),
|
|
3579
|
-
...providerEnv,
|
|
3580
3600
|
HOME: home,
|
|
3581
3601
|
PI_AGENT_HOME: piAgentHome,
|
|
3582
3602
|
PI_CODING_AGENT_SESSION_DIR: sessionsRoot,
|
|
@@ -3627,10 +3647,7 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
3627
3647
|
commandId: input.commandId,
|
|
3628
3648
|
runId,
|
|
3629
3649
|
sessionId: gateway.sessionId,
|
|
3630
|
-
...
|
|
3631
|
-
skillProfile,
|
|
3632
|
-
enabledSkillsDigest: createHash3("sha256").update(JSON.stringify(enabledRoleSkills)).digest("hex")
|
|
3633
|
-
} : {}
|
|
3650
|
+
...skillProfileAttestation(skillProfiles, enabledRoleSkills)
|
|
3634
3651
|
};
|
|
3635
3652
|
return {
|
|
3636
3653
|
profileRoot,
|
|
@@ -3648,7 +3665,7 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
3648
3665
|
protectedValues: [.../* @__PURE__ */ new Set([
|
|
3649
3666
|
sessionToken,
|
|
3650
3667
|
...sharedRuntime.protectedValues,
|
|
3651
|
-
...MANAGED_PI_PROVIDER_PROTECTED_ENV_NAMES.map((name) => input.commandEnv?.[name]
|
|
3668
|
+
...MANAGED_PI_PROVIDER_PROTECTED_ENV_NAMES.map((name) => input.commandEnv?.[name]).filter((value) => typeof value === "string" && value.length > 0)
|
|
3652
3669
|
])],
|
|
3653
3670
|
attestation: {
|
|
3654
3671
|
...attestationFacts,
|
|
@@ -3722,6 +3739,18 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
3722
3739
|
};
|
|
3723
3740
|
writePrivateFile2(configPath, `${JSON.stringify(config, null, 2)}
|
|
3724
3741
|
`);
|
|
3742
|
+
const skillProfiles = requestedSkillProfiles(input);
|
|
3743
|
+
const skillArgs = [];
|
|
3744
|
+
let enabledRoleSkills = null;
|
|
3745
|
+
if (skillProfiles.length > 0) {
|
|
3746
|
+
const roleSkills = materializeManagedRoleSkills(
|
|
3747
|
+
sourcePiHome,
|
|
3748
|
+
join4(profileRoot, "role-skills"),
|
|
3749
|
+
skillProfiles
|
|
3750
|
+
);
|
|
3751
|
+
skillArgs.push("--no-approve", "--skill", roleSkills.skillsDir);
|
|
3752
|
+
enabledRoleSkills = roleSkills.enabled;
|
|
3753
|
+
}
|
|
3725
3754
|
const env = {
|
|
3726
3755
|
...input.baseEnv,
|
|
3727
3756
|
...record6(input.commandEnv),
|
|
@@ -3750,7 +3779,8 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
3750
3779
|
sessionId: gateway.sessionId,
|
|
3751
3780
|
sourcePiHome,
|
|
3752
3781
|
piCodingAgentDir,
|
|
3753
|
-
configSha256: sha2562(readFileSync3(configPath))
|
|
3782
|
+
configSha256: sha2562(readFileSync3(configPath)),
|
|
3783
|
+
...skillProfileAttestation(skillProfiles, enabledRoleSkills)
|
|
3754
3784
|
};
|
|
3755
3785
|
return {
|
|
3756
3786
|
profileRoot,
|
|
@@ -3760,6 +3790,7 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
3760
3790
|
configPath,
|
|
3761
3791
|
markerPath,
|
|
3762
3792
|
env,
|
|
3793
|
+
skillArgs,
|
|
3763
3794
|
toolAllowlist: null,
|
|
3764
3795
|
protectedValues: [.../* @__PURE__ */ new Set([sessionToken, ...seededRuntime.protectedValues])],
|
|
3765
3796
|
attestation: {
|
|
@@ -6097,11 +6128,6 @@ var CAPABILITIES = [
|
|
|
6097
6128
|
];
|
|
6098
6129
|
var RUNNER_KIND_CLOUD_MANAGED = "cloud_managed";
|
|
6099
6130
|
var RUNNER_KIND_DESKTOP_DELEGATED = "desktop_delegated";
|
|
6100
|
-
var CREDENTIAL_SOURCE_EMPLOYEE_COMMAND_ENV = "employee_command_env";
|
|
6101
|
-
var CREDENTIAL_SOURCE_DESKTOP_PLATFORM_AUTH = "desktop_platform_auth";
|
|
6102
|
-
function credentialSourceForRunnerKind(runnerKind) {
|
|
6103
|
-
return runnerKind === RUNNER_KIND_DESKTOP_DELEGATED ? CREDENTIAL_SOURCE_DESKTOP_PLATFORM_AUTH : CREDENTIAL_SOURCE_EMPLOYEE_COMMAND_ENV;
|
|
6104
|
-
}
|
|
6105
6131
|
function readEnum(value, allowed, fallback, label) {
|
|
6106
6132
|
const text = String(value ?? "").trim();
|
|
6107
6133
|
if (!text) return fallback;
|
|
@@ -6247,7 +6273,6 @@ function buildConfig(env = process.env, flags = {}) {
|
|
|
6247
6273
|
RUNNER_KIND_CLOUD_MANAGED,
|
|
6248
6274
|
"AMASTER_RUNTIME_RUNNER_KIND"
|
|
6249
6275
|
);
|
|
6250
|
-
const credentialSource = credentialSourceForRunnerKind(runnerKind);
|
|
6251
6276
|
const agentInstructionSystemKernelMode = readEnum(
|
|
6252
6277
|
flags.agentInstructionSystemKernelMode ?? env.AMASTER_AGENT_INSTRUCTION_SYSTEM_KERNEL_MODE,
|
|
6253
6278
|
["shadow", "canary"],
|
|
@@ -6288,7 +6313,6 @@ function buildConfig(env = process.env, flags = {}) {
|
|
|
6288
6313
|
piExecutorUid,
|
|
6289
6314
|
piExecutorGid,
|
|
6290
6315
|
runnerKind,
|
|
6291
|
-
credentialSource,
|
|
6292
6316
|
agentInstructionSystemKernel: {
|
|
6293
6317
|
mode: agentInstructionSystemKernelMode,
|
|
6294
6318
|
agentIds: splitList(
|
|
@@ -6301,9 +6325,6 @@ function buildConfig(env = process.env, flags = {}) {
|
|
|
6301
6325
|
flags.agentInstructionSystemKernelSourceSha256Allowlist ?? env.AMASTER_AGENT_INSTRUCTION_SYSTEM_KERNEL_SOURCE_SHA256_ALLOWLIST ?? ""
|
|
6302
6326
|
).map((value) => value.toLowerCase())
|
|
6303
6327
|
},
|
|
6304
|
-
desktopPlatformSystemDataDir: String(
|
|
6305
|
-
flags.desktopPlatformSystemDataDir ?? env.AMASTER_RUNTIME_DESKTOP_PLATFORM_SYSTEM_DATA_DIR ?? ""
|
|
6306
|
-
).trim(),
|
|
6307
6328
|
capabilities: splitList(flags.capabilities ?? env.AMASTER_CAPABILITIES ?? CAPABILITIES.join(",")),
|
|
6308
6329
|
pollIntervalSeconds: Number(flags.pollIntervalSeconds ?? env.AMASTER_POLL_INTERVAL_SECONDS ?? 10),
|
|
6309
6330
|
maxConcurrentCommands: Math.min(
|
|
@@ -9284,7 +9305,7 @@ function assertSourceAcquisitionRuntimeAuthority({
|
|
|
9284
9305
|
}
|
|
9285
9306
|
|
|
9286
9307
|
// src/amaster-runtime-daemon.mjs
|
|
9287
|
-
var CONNECTOR_VERSION = "0.1.1-beta.
|
|
9308
|
+
var CONNECTOR_VERSION = "0.1.1-beta.26";
|
|
9288
9309
|
var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
|
|
9289
9310
|
var SOURCE_ACQUISITION_CAPABILITY = "source_acquisition_v1";
|
|
9290
9311
|
var SOURCE_ACQUISITION_PROFILE_VERSION = "source_acquisition_v1";
|
|
@@ -9858,7 +9879,6 @@ function buildHeartbeatPayload(config, options = {}) {
|
|
|
9858
9879
|
const activeRunCommandList = Array.from(activeRunCommandById.values()).map((entry) => buildActiveRunCommandStatus(config, entry));
|
|
9859
9880
|
const activeRunCount = activeRunCommandList.filter(activeRunCommandCountsAsActive).length;
|
|
9860
9881
|
const executorReadiness = buildExecutorReadiness(config);
|
|
9861
|
-
const desktopPlatformCredential = desktopPlatformCredentialStatus(config);
|
|
9862
9882
|
const sourceAcquisition = sourceAcquisitionRuntimeReadiness(config);
|
|
9863
9883
|
const status = options.status === "offline" ? "offline" : "online";
|
|
9864
9884
|
const daemonStatus = status === "offline" ? "stopping" : "running";
|
|
@@ -9888,8 +9908,6 @@ function buildHeartbeatPayload(config, options = {}) {
|
|
|
9888
9908
|
stateFile: stateFilePath(process.env),
|
|
9889
9909
|
...executorReadiness.length > 0 ? { executorReadiness } : {},
|
|
9890
9910
|
runnerKind: config.runnerKind,
|
|
9891
|
-
credentialSource: config.credentialSource,
|
|
9892
|
-
...desktopPlatformCredential ? { desktopPlatformCredential } : {},
|
|
9893
9911
|
sourceAcquisition,
|
|
9894
9912
|
...versionDrift.versionDrift || versionDrift.bundleDrift ? versionDrift : {}
|
|
9895
9913
|
},
|
|
@@ -9901,52 +9919,6 @@ function buildHeartbeatPayload(config, options = {}) {
|
|
|
9901
9919
|
function desktopDelegatedRunnerEnabled(config) {
|
|
9902
9920
|
return config.runnerKind === RUNNER_KIND_DESKTOP_DELEGATED;
|
|
9903
9921
|
}
|
|
9904
|
-
function desktopPlatformCredentialEnabled(config) {
|
|
9905
|
-
return desktopDelegatedRunnerEnabled(config);
|
|
9906
|
-
}
|
|
9907
|
-
function desktopPlatformSystemDataDir(config) {
|
|
9908
|
-
const configured = readString(config.desktopPlatformSystemDataDir ?? process.env.AMASTER_RUNTIME_DESKTOP_PLATFORM_SYSTEM_DATA_DIR);
|
|
9909
|
-
return configured ? resolve9(expandHomePath(configured)) : null;
|
|
9910
|
-
}
|
|
9911
|
-
function readDesktopPlatformCredential(credentialsDir) {
|
|
9912
|
-
const pointer = readJsonFile2(join12(credentialsDir, "latest.json"));
|
|
9913
|
-
const credentialRef = readString(pointer.credentialRef);
|
|
9914
|
-
if (!credentialRef || !/^[a-f0-9]{64}$/i.test(credentialRef)) return null;
|
|
9915
|
-
const credential = readJsonFile2(join12(credentialsDir, `${credentialRef}.json`));
|
|
9916
|
-
const organizationId = readString(credential.organizationId);
|
|
9917
|
-
const apiKey = readString(credential.apiKey);
|
|
9918
|
-
if (credential.version !== 1 || !organizationId || !apiKey) return null;
|
|
9919
|
-
return {
|
|
9920
|
-
organizationId,
|
|
9921
|
-
apiKey,
|
|
9922
|
-
...readString(credential.baseUrl) ? { baseUrl: readString(credential.baseUrl) } : {}
|
|
9923
|
-
};
|
|
9924
|
-
}
|
|
9925
|
-
function desktopPlatformCredentials(config) {
|
|
9926
|
-
if (!desktopPlatformCredentialEnabled(config)) return [];
|
|
9927
|
-
const systemDataDir = desktopPlatformSystemDataDir(config);
|
|
9928
|
-
if (!systemDataDir) return [];
|
|
9929
|
-
const companiesDir = join12(systemDataDir, "companies");
|
|
9930
|
-
let entries = [];
|
|
9931
|
-
try {
|
|
9932
|
-
entries = readdirSync8(companiesDir, { withFileTypes: true });
|
|
9933
|
-
} catch {
|
|
9934
|
-
return [];
|
|
9935
|
-
}
|
|
9936
|
-
const credentialsByOrganizationId = /* @__PURE__ */ new Map();
|
|
9937
|
-
for (const entry of entries) {
|
|
9938
|
-
if (!entry.isDirectory()) continue;
|
|
9939
|
-
const credential = readDesktopPlatformCredential(join12(companiesDir, entry.name, "model-credentials"));
|
|
9940
|
-
if (credential) credentialsByOrganizationId.set(credential.organizationId, credential);
|
|
9941
|
-
}
|
|
9942
|
-
return [...credentialsByOrganizationId.values()];
|
|
9943
|
-
}
|
|
9944
|
-
function desktopPlatformCredentialStatus(config) {
|
|
9945
|
-
if (!desktopPlatformCredentialEnabled(config)) return null;
|
|
9946
|
-
return {
|
|
9947
|
-
readyOrganizationIds: desktopPlatformCredentials(config).map((credential) => credential.organizationId).sort()
|
|
9948
|
-
};
|
|
9949
|
-
}
|
|
9950
9922
|
function writeLocalRuntimeStatus(config, runtimeStatus) {
|
|
9951
9923
|
const currentState = readState(process.env);
|
|
9952
9924
|
writeState(process.env, {
|
|
@@ -10537,42 +10509,18 @@ function readJsonFile2(filePath) {
|
|
|
10537
10509
|
return {};
|
|
10538
10510
|
}
|
|
10539
10511
|
}
|
|
10540
|
-
function
|
|
10541
|
-
const desktopPlatformCredential = desktopPlatformCredentialForCommand(config, command);
|
|
10542
|
-
if (desktopPlatformCredentialEnabled(config) && !desktopPlatformCredential) {
|
|
10543
|
-
throw new Error("Desktop Platform credential is unavailable for this command organization");
|
|
10544
|
-
}
|
|
10545
|
-
return {
|
|
10546
|
-
providerConfig: desktopPlatformCredential ?? executorEnv,
|
|
10547
|
-
credentialSource: desktopPlatformCredential ? CREDENTIAL_SOURCE_DESKTOP_PLATFORM_AUTH : CREDENTIAL_SOURCE_EMPLOYEE_COMMAND_ENV
|
|
10548
|
-
};
|
|
10549
|
-
}
|
|
10550
|
-
async function syncPiExecutorProviderConfig(config, command, agentDir, resolvedProviderConfig) {
|
|
10512
|
+
async function syncPiExecutorProviderConfig(config, command, agentDir, providerConfig) {
|
|
10551
10513
|
if (!agentDir) return;
|
|
10552
|
-
const { providerConfig, credentialSource } = resolvedProviderConfig;
|
|
10553
10514
|
const { modelsSynced, settingsSynced } = syncAmasterProviderFiles(agentDir, providerConfig);
|
|
10554
10515
|
if (modelsSynced || settingsSynced) {
|
|
10555
10516
|
await ingestLog(config, command, "system", "info", "Synced AMaster provider config for pi executor", {
|
|
10556
10517
|
modelsSynced,
|
|
10557
10518
|
settingsSynced,
|
|
10558
|
-
credentialSource,
|
|
10519
|
+
credentialSource: "server_command_env",
|
|
10559
10520
|
providerBaseUrlConfigured: Boolean(readString(providerConfig.AMASTER_PROVIDER_BASE_URL))
|
|
10560
10521
|
});
|
|
10561
10522
|
}
|
|
10562
10523
|
}
|
|
10563
|
-
function desktopPlatformCredentialForCommand(config, command) {
|
|
10564
|
-
if (!desktopPlatformCredentialEnabled(config)) return null;
|
|
10565
|
-
const executionContext = asRecord(command.executionContext);
|
|
10566
|
-
const runtimeExecutionContext = asRecord(asRecord(command.runtimeAuth).executionContext);
|
|
10567
|
-
const organizationId = readString(executionContext.platformOrganizationId) ?? readString(runtimeExecutionContext.platformOrganizationId);
|
|
10568
|
-
if (!organizationId) return null;
|
|
10569
|
-
const credential = desktopPlatformCredentials(config).find((entry) => entry.organizationId === organizationId);
|
|
10570
|
-
if (!credential) return null;
|
|
10571
|
-
return {
|
|
10572
|
-
AMASTER_API_KEY: credential.apiKey,
|
|
10573
|
-
...credential.baseUrl ? { AMASTER_PROVIDER_BASE_URL: credential.baseUrl } : {}
|
|
10574
|
-
};
|
|
10575
|
-
}
|
|
10576
10524
|
function normalizeWorkspaceContext(workspace) {
|
|
10577
10525
|
if (typeof workspace === "string") {
|
|
10578
10526
|
return {
|
|
@@ -10757,6 +10705,7 @@ function buildExecutorEnv(config, command, workspace) {
|
|
|
10757
10705
|
const issueId = commandIssueId(command) ?? "";
|
|
10758
10706
|
const companyId = readString(runtimeAuth.companyId) ?? readString(asRecord(command.payload).companyId) ?? "";
|
|
10759
10707
|
const baseEnv = { ...process.env };
|
|
10708
|
+
for (const name of MANAGED_PI_PROVIDER_ENV_NAMES) delete baseEnv[name];
|
|
10760
10709
|
const executorPaths = readStringArray(config.executorPaths);
|
|
10761
10710
|
if (executorPaths.length > 0) {
|
|
10762
10711
|
baseEnv.PATH = [...executorPaths, baseEnv.PATH ?? ""].filter(Boolean).join(delimiter3);
|
|
@@ -13806,21 +13755,16 @@ async function executeRunCommand(config, command) {
|
|
|
13806
13755
|
cleanupManagedMcpProfile = cleanupManagedCodexMcpProfile;
|
|
13807
13756
|
}
|
|
13808
13757
|
if (executor.kind === "pi") {
|
|
13809
|
-
|
|
13810
|
-
for (const envName of MANAGED_PI_PROVIDER_ENV_NAMES) {
|
|
13811
|
-
delete executorEnv[envName];
|
|
13812
|
-
}
|
|
13813
|
-
}
|
|
13814
|
-
piResolvedProviderConfig = resolvePiExecutorProviderConfig(config, command, executorEnv);
|
|
13758
|
+
piResolvedProviderConfig = executorEnv;
|
|
13815
13759
|
for (const envName of ["AMASTER_API_KEY", "AMASTER_PLATFORM_OAUTH_TOKEN"]) {
|
|
13816
|
-
const protectedValue = readString(piResolvedProviderConfig
|
|
13760
|
+
const protectedValue = readString(piResolvedProviderConfig[envName]);
|
|
13817
13761
|
if (protectedValue && !providerProtectedValues.includes(protectedValue)) {
|
|
13818
13762
|
providerProtectedValues.push(protectedValue);
|
|
13819
13763
|
}
|
|
13820
13764
|
}
|
|
13821
13765
|
if (Object.keys(governedMcp).length > 0) {
|
|
13822
13766
|
const preparePiMcpProfile = desktopDelegatedRunnerEnabled(config) ? prepareDelegatedPiMcpProfile : prepareManagedPiMcpProfile;
|
|
13823
|
-
const piProfileCommandEnv =
|
|
13767
|
+
const piProfileCommandEnv = commandExecutorEnv(command);
|
|
13824
13768
|
managedMcpProfile = preparePiMcpProfile({
|
|
13825
13769
|
commandId: command.commandId,
|
|
13826
13770
|
runId: commandRunId(command),
|
|
@@ -13836,6 +13780,7 @@ async function executeRunCommand(config, command) {
|
|
|
13836
13780
|
extraArgs: sourceAcquisition ? [] : splitExtraArgs(process.env.AMASTER_PI_EXTRA_ARGS),
|
|
13837
13781
|
sourceAcquisition,
|
|
13838
13782
|
skillProfile: readString(asRecord(command.payload).skillProfile),
|
|
13783
|
+
skillProfiles: readStringArray(asRecord(command.payload).skillProfiles),
|
|
13839
13784
|
...config.piExecutorUid > 0 && !desktopDelegatedRunnerEnabled(config) ? {
|
|
13840
13785
|
prepareExecutorAccess: ({ profileRoot, workspaceRoot }) => preparePiExecutorAccess({
|
|
13841
13786
|
uid: config.piExecutorUid,
|
|
@@ -13886,7 +13831,7 @@ async function executeRunCommand(config, command) {
|
|
|
13886
13831
|
}
|
|
13887
13832
|
if (executor.kind === "pi" && piResolvedProviderConfig) {
|
|
13888
13833
|
const sharedPiHome = readString(process.env.PI_CODING_AGENT_DIR) ?? readString(process.env.PI_AGENT_HOME) ?? null;
|
|
13889
|
-
let agentDir = managedMcpProfile ? readString(managedMcpProfile.env.PI_CODING_AGENT_DIR) ?? readString(managedMcpProfile.env.PI_AGENT_HOME) ?? null :
|
|
13834
|
+
let agentDir = managedMcpProfile ? readString(managedMcpProfile.env.PI_CODING_AGENT_DIR) ?? readString(managedMcpProfile.env.PI_AGENT_HOME) ?? null : desktopDelegatedRunnerEnabled(config) ? readString(executorEnv.PI_AGENT_HOME) ?? readString(executorEnv.PI_CODING_AGENT_DIR) ?? null : readString(executorEnv.PI_CODING_AGENT_DIR) ?? readString(executorEnv.PI_AGENT_HOME) ?? null;
|
|
13890
13835
|
if (agentDir && sharedPiHome && resolve9(agentDir) === resolve9(sharedPiHome)) {
|
|
13891
13836
|
agentDir = null;
|
|
13892
13837
|
}
|
package/dist/amaster-runtime.mjs
CHANGED
|
@@ -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.
|
|
9
|
+
const CONNECTOR_VERSION = "0.1.1-beta.26";
|
|
10
10
|
|
|
11
11
|
const CAPABILITIES = [
|
|
12
12
|
"remote_registration",
|
|
@@ -55,7 +55,6 @@ const CONFIG_KEY_MAP = new Map([
|
|
|
55
55
|
["pi_agent_home", "PI_AGENT_HOME"],
|
|
56
56
|
["pi_agent_node", "PI_AGENT_NODE"],
|
|
57
57
|
["runner_kind", "AMASTER_RUNTIME_RUNNER_KIND"],
|
|
58
|
-
["desktop_platform_system_data_dir", "AMASTER_RUNTIME_DESKTOP_PLATFORM_SYSTEM_DATA_DIR"],
|
|
59
58
|
["heartbeat_log_mode", "AMASTER_HEARTBEAT_LOG_MODE"],
|
|
60
59
|
]);
|
|
61
60
|
|
|
@@ -84,7 +83,6 @@ const ENV_ORDER = [
|
|
|
84
83
|
"PI_AGENT_HOME",
|
|
85
84
|
"PI_AGENT_NODE",
|
|
86
85
|
"AMASTER_RUNTIME_RUNNER_KIND",
|
|
87
|
-
"AMASTER_RUNTIME_DESKTOP_PLATFORM_SYSTEM_DATA_DIR",
|
|
88
86
|
"AMASTER_HEARTBEAT_LOG_MODE",
|
|
89
87
|
];
|
|
90
88
|
|
|
@@ -459,7 +457,6 @@ function printConfig(config) {
|
|
|
459
457
|
["pi_agent_home", merged.PI_AGENT_HOME || "(default)"],
|
|
460
458
|
["pi_agent_node", merged.PI_AGENT_NODE || "(default)"],
|
|
461
459
|
["runner_kind", merged.AMASTER_RUNTIME_RUNNER_KIND || "cloud_managed"],
|
|
462
|
-
["desktop_platform_system_data_dir", merged.AMASTER_RUNTIME_DESKTOP_PLATFORM_SYSTEM_DATA_DIR ? "(configured)" : "(not configured)"],
|
|
463
460
|
["heartbeat_log_mode", merged.AMASTER_HEARTBEAT_LOG_MODE || "(compact)"],
|
|
464
461
|
["network_domains", merged.AMASTER_NETWORK_DOMAINS],
|
|
465
462
|
["capabilities", merged.AMASTER_CAPABILITIES],
|