@amaster.ai/employee-runtime-connector 0.1.1-beta.12 → 0.1.1-beta.13
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.
|
@@ -3036,6 +3036,33 @@ function createManagedPiMcpProfileApi(options = {}) {
|
|
|
3036
3036
|
symlinkSync(npmSource, join4(agentDir, "npm"), "dir");
|
|
3037
3037
|
return { adapterVersion, protectedValues };
|
|
3038
3038
|
}
|
|
3039
|
+
function seedDelegatedPiRuntime(sourceHome, agentDir) {
|
|
3040
|
+
const source = resolve2(nonEmpty2(sourceHome, "sourcePiHome"));
|
|
3041
|
+
const sourceStat = lstatSync2(source);
|
|
3042
|
+
if (!sourceStat.isDirectory() || sourceStat.isSymbolicLink()) {
|
|
3043
|
+
throw new Error("pi_delegated_mcp_source_config_unsafe: Pi home");
|
|
3044
|
+
}
|
|
3045
|
+
const protectedValues = [];
|
|
3046
|
+
for (const entry of readdirSync2(source, { withFileTypes: true })) {
|
|
3047
|
+
if (entry.name === "mcp.json" || entry.name === "mcp-cache.json") continue;
|
|
3048
|
+
const sourcePath = join4(source, entry.name);
|
|
3049
|
+
const targetPath = join4(agentDir, entry.name);
|
|
3050
|
+
if (entry.isDirectory()) {
|
|
3051
|
+
symlinkSync(sourcePath, targetPath, platform2() === "win32" ? "junction" : "dir");
|
|
3052
|
+
} else if (entry.isFile()) {
|
|
3053
|
+
copyPrivateFile(sourcePath, targetPath);
|
|
3054
|
+
}
|
|
3055
|
+
}
|
|
3056
|
+
const authSource = join4(source, "auth.json");
|
|
3057
|
+
if (existsSync3(authSource)) {
|
|
3058
|
+
try {
|
|
3059
|
+
collectAuthSecretStrings2(JSON.parse(readFileSync3(authSource, "utf8")), protectedValues);
|
|
3060
|
+
} catch {
|
|
3061
|
+
throw new Error("pi_delegated_mcp_attestation_failed: source Pi auth is invalid");
|
|
3062
|
+
}
|
|
3063
|
+
}
|
|
3064
|
+
return { protectedValues };
|
|
3065
|
+
}
|
|
3039
3066
|
function attestPi(executorCommand, env, configPath, expectedConfig) {
|
|
3040
3067
|
const resolvedExecutorCommand = resolvePiExecutablePath(executorCommand, env);
|
|
3041
3068
|
const executorIdentity = piExecutableIdentity(resolvedExecutorCommand);
|
|
@@ -3339,17 +3366,21 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
3339
3366
|
assertInvocationIsolation2(input);
|
|
3340
3367
|
const { gateway, gatewayUrl, sessionToken, headers, runId, mcpToolMode, directCatalog } = validateAuthority2(input);
|
|
3341
3368
|
const runDir = resolve2(nonEmpty2(input.runDir, "runDir"));
|
|
3369
|
+
const cwd = resolve2(nonEmpty2(input.cwd, "cwd"));
|
|
3370
|
+
if (!within4(cwd, runDir)) throw new Error("pi_delegated_mcp_owner_mismatch: cwd is outside the managed run");
|
|
3371
|
+
assertNoProjectMcpOverride(cwd, runDir);
|
|
3342
3372
|
const executorHome = resolve2(nonEmpty2(input.executorHome, "executorHome"));
|
|
3343
3373
|
if (!within4(executorHome, join4(runDir, "executors"))) throw new Error("pi_delegated_mcp_owner_mismatch: executorHome is outside the managed run");
|
|
3344
3374
|
const profileRoot = join4(executorHome, "delegated-mcp");
|
|
3345
3375
|
if (existsSync3(profileRoot)) throw new Error(`pi_delegated_mcp_profile_exists: ${profileRoot}`);
|
|
3376
|
+
const piCodingAgentDir = join4(profileRoot, "pi-coding-agent-dir");
|
|
3346
3377
|
const sessionsRoot = join4(profileRoot, "sessions");
|
|
3347
3378
|
const tmp = join4(profileRoot, "tmp");
|
|
3348
|
-
for (const directory of [profileRoot, sessionsRoot, tmp]) mkdirSync3(directory, { recursive: true, mode: 448 });
|
|
3379
|
+
for (const directory of [profileRoot, piCodingAgentDir, sessionsRoot, tmp]) mkdirSync3(directory, { recursive: true, mode: 448 });
|
|
3349
3380
|
try {
|
|
3350
3381
|
const markerPath = join4(profileRoot, DELEGATED_PROFILE_MARKER);
|
|
3351
3382
|
const owner = Object.freeze({ commandId: input.commandId, runId });
|
|
3352
|
-
writePrivateFile2(markerPath, `${JSON.stringify({ version: 1, ...owner, profileRoot })}
|
|
3383
|
+
writePrivateFile2(markerPath, `${JSON.stringify({ version: 1, ...owner, profileRoot, piCodingAgentDir })}
|
|
3353
3384
|
`);
|
|
3354
3385
|
const runtimeAuth = record7(input.runtimeAuth);
|
|
3355
3386
|
const authority = Object.freeze({
|
|
@@ -3364,8 +3395,9 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
3364
3395
|
if (!sourceStat.isDirectory() || sourceStat.isSymbolicLink()) {
|
|
3365
3396
|
throw new Error("pi_delegated_mcp_source_config_unsafe: Pi home");
|
|
3366
3397
|
}
|
|
3398
|
+
const seededRuntime = seedDelegatedPiRuntime(sourcePiHome, piCodingAgentDir);
|
|
3367
3399
|
const sourceMcp = readJsonObjectFile(join4(sourcePiHome, "mcp.json"));
|
|
3368
|
-
const configPath = join4(
|
|
3400
|
+
const configPath = join4(piCodingAgentDir, "mcp.json");
|
|
3369
3401
|
const directToolNames = directCatalog?.tools.map((tool) => tool.exposedName) ?? [];
|
|
3370
3402
|
const serverConfig = {
|
|
3371
3403
|
type: "http",
|
|
@@ -3390,6 +3422,9 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
3390
3422
|
const env = {
|
|
3391
3423
|
...input.baseEnv,
|
|
3392
3424
|
...record7(input.commandEnv),
|
|
3425
|
+
PI_AGENT_HOME: sourcePiHome,
|
|
3426
|
+
PI_CODING_AGENT_DIR: piCodingAgentDir,
|
|
3427
|
+
"AMASTER-CLI_CODING_AGENT_DIR": piCodingAgentDir,
|
|
3393
3428
|
PI_AGENT_MCP_SERVERS_FILE: configPath,
|
|
3394
3429
|
PI_CODING_AGENT_SESSION_DIR: sessionsRoot,
|
|
3395
3430
|
"AMASTER-CLI_CODING_AGENT_SESSION_DIR": sessionsRoot,
|
|
@@ -3411,6 +3446,7 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
3411
3446
|
runId,
|
|
3412
3447
|
sessionId: gateway.sessionId,
|
|
3413
3448
|
sourcePiHome,
|
|
3449
|
+
piCodingAgentDir,
|
|
3414
3450
|
configSha256: sha256(readFileSync3(configPath))
|
|
3415
3451
|
};
|
|
3416
3452
|
return {
|
|
@@ -3422,7 +3458,7 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
3422
3458
|
markerPath,
|
|
3423
3459
|
env,
|
|
3424
3460
|
toolAllowlist: null,
|
|
3425
|
-
protectedValues: [sessionToken],
|
|
3461
|
+
protectedValues: [.../* @__PURE__ */ new Set([sessionToken, ...seededRuntime.protectedValues])],
|
|
3426
3462
|
attestation: {
|
|
3427
3463
|
...attestationFacts,
|
|
3428
3464
|
attestationId: createHash3("sha256").update(JSON.stringify(attestationFacts)).digest("hex"),
|
|
@@ -9410,7 +9446,7 @@ function assertSourceAcquisitionRuntimeAuthority({
|
|
|
9410
9446
|
}
|
|
9411
9447
|
|
|
9412
9448
|
// src/amaster-runtime-daemon.mjs
|
|
9413
|
-
var CONNECTOR_VERSION = "0.1.1-beta.
|
|
9449
|
+
var CONNECTOR_VERSION = "0.1.1-beta.13";
|
|
9414
9450
|
var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
|
|
9415
9451
|
var SOURCE_ACQUISITION_CAPABILITY = "source_acquisition_v1";
|
|
9416
9452
|
var SOURCE_ACQUISITION_PROFILE_VERSION = "source_acquisition_v1";
|
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.13";
|
|
10
10
|
|
|
11
11
|
const CAPABILITIES = [
|
|
12
12
|
"remote_registration",
|