@amaster.ai/employee-runtime-connector 0.1.1-beta.16 → 0.1.1-beta.17
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.
|
@@ -2481,29 +2481,6 @@ function createManagedPiMcpProfileApi(options = {}) {
|
|
|
2481
2481
|
const MINIMUM_MCP_ADAPTER_VERSION = [2, 6, 1];
|
|
2482
2482
|
const MANAGED_BROWSER_USE_PACKAGE = "@amaster.ai/pi-browser-use";
|
|
2483
2483
|
const MANAGED_BROWSER_USE_PLUGIN = "browser-use";
|
|
2484
|
-
const MANAGED_WEB_ACCESS_PACKAGE = "@amaster.ai/pi-web-access";
|
|
2485
|
-
const MANAGED_TELEMETRY_PACKAGE = "@amaster.ai/pi-telemetry";
|
|
2486
|
-
const MANAGED_TELEMETRY_ENV_NAMES = [
|
|
2487
|
-
"PI_TELEMETRY_TASK_RUN_ID",
|
|
2488
|
-
"PI_TELEMETRY_SERVICE_NAME",
|
|
2489
|
-
"PI_TELEMETRY_SERVICE_VERSION",
|
|
2490
|
-
"PI_TELEMETRY_INCLUDE_PAYLOADS",
|
|
2491
|
-
"PI_TELEMETRY_LANGFUSE_ENABLED",
|
|
2492
|
-
"PI_TELEMETRY_LANGFUSE_PUBLIC_KEY",
|
|
2493
|
-
"PI_TELEMETRY_LANGFUSE_SECRET_KEY",
|
|
2494
|
-
"PI_TELEMETRY_LANGFUSE_BASE_URL",
|
|
2495
|
-
"PI_TELEMETRY_LANGFUSE_FLUSH_AT",
|
|
2496
|
-
"PI_TELEMETRY_LANGFUSE_FLUSH_INTERVAL_MS",
|
|
2497
|
-
"PI_TELEMETRY_OTEL_ENABLED",
|
|
2498
|
-
"PI_TELEMETRY_OTEL_ENDPOINT",
|
|
2499
|
-
"PI_TELEMETRY_OTEL_HEADERS",
|
|
2500
|
-
"PI_TELEMETRY_OTEL_FLUSH_AT",
|
|
2501
|
-
"PI_TELEMETRY_OTEL_FLUSH_INTERVAL_MS"
|
|
2502
|
-
];
|
|
2503
|
-
const MANAGED_TELEMETRY_PROTECTED_ENV_NAMES = [
|
|
2504
|
-
"PI_TELEMETRY_LANGFUSE_SECRET_KEY",
|
|
2505
|
-
"PI_TELEMETRY_OTEL_HEADERS"
|
|
2506
|
-
];
|
|
2507
2484
|
const MANAGED_BROWSER_USE_BOOLEAN_SETTINGS = [
|
|
2508
2485
|
"headless",
|
|
2509
2486
|
"categoryNetwork",
|
|
@@ -2530,6 +2507,12 @@ function createManagedPiMcpProfileApi(options = {}) {
|
|
|
2530
2507
|
"AMASTER-CLI_CODING_AGENT_SESSION_DIR",
|
|
2531
2508
|
"PI_AGENT_MCP_SERVERS_FILE"
|
|
2532
2509
|
]);
|
|
2510
|
+
const RUN_OWNED_SETTINGS_ENV = /* @__PURE__ */ new Set([
|
|
2511
|
+
...FORBIDDEN_COMMAND_ENV2,
|
|
2512
|
+
"MCP_DIRECT_TOOLS",
|
|
2513
|
+
"PAPERCLIP_API_KEY",
|
|
2514
|
+
"AMASTER_BOARD_API_KEY"
|
|
2515
|
+
]);
|
|
2533
2516
|
const ALLOWED_COMMAND_ENV2 = new Set(MANAGED_PI_PROVIDER_ENV_NAMES);
|
|
2534
2517
|
const SAFE_INHERITED_ENV2 = /* @__PURE__ */ new Set([
|
|
2535
2518
|
"PATH",
|
|
@@ -2555,8 +2538,7 @@ function createManagedPiMcpProfileApi(options = {}) {
|
|
|
2555
2538
|
"PAPERCLIP_TASK_ID",
|
|
2556
2539
|
"PAPERCLIP_AGENT_ID",
|
|
2557
2540
|
"PAPERCLIP_COMPANY_ID",
|
|
2558
|
-
"AMASTER_EMPLOYEE_COMPANY_ID"
|
|
2559
|
-
...MANAGED_TELEMETRY_ENV_NAMES
|
|
2541
|
+
"AMASTER_EMPLOYEE_COMPANY_ID"
|
|
2560
2542
|
]);
|
|
2561
2543
|
const FORBIDDEN_ARGV = /* @__PURE__ */ new Set([
|
|
2562
2544
|
"--no-tools",
|
|
@@ -2877,13 +2859,38 @@ function createManagedPiMcpProfileApi(options = {}) {
|
|
|
2877
2859
|
return /^(?:(?:access|refresh|id)_)?token$/.test(normalized) || normalized.includes("api_key") || normalized.includes("secret") || normalized.includes("password") || normalized.includes("credential") || normalized.includes("authorization") || normalized.includes("cookie");
|
|
2878
2860
|
}
|
|
2879
2861
|
function collectAuthSecretStrings2(value, output = []) {
|
|
2880
|
-
if (!value || typeof value !== "object"
|
|
2862
|
+
if (!value || typeof value !== "object") return output;
|
|
2863
|
+
if (Array.isArray(value)) {
|
|
2864
|
+
for (const entry of value) collectAuthSecretStrings2(entry, output);
|
|
2865
|
+
return output;
|
|
2866
|
+
}
|
|
2881
2867
|
for (const [key, entry] of Object.entries(value)) {
|
|
2882
2868
|
if (typeof entry === "string" && entry && isSensitiveAuthKey2(key)) output.push(entry);
|
|
2883
|
-
else if (entry && typeof entry === "object"
|
|
2869
|
+
else if (entry && typeof entry === "object") collectAuthSecretStrings2(entry, output);
|
|
2884
2870
|
}
|
|
2885
2871
|
return output;
|
|
2886
2872
|
}
|
|
2873
|
+
function referencedSettingsEnvironment(settings, baseEnv) {
|
|
2874
|
+
const names = /* @__PURE__ */ new Set();
|
|
2875
|
+
const visit = (value) => {
|
|
2876
|
+
if (typeof value === "string") {
|
|
2877
|
+
for (const match of value.matchAll(/\$(?:\{([A-Za-z_][A-Za-z0-9_]*)(?::-[^}]*)?\}|([A-Za-z_][A-Za-z0-9_]*))/g)) {
|
|
2878
|
+
names.add(match[1] ?? match[2]);
|
|
2879
|
+
}
|
|
2880
|
+
} else if (Array.isArray(value)) {
|
|
2881
|
+
for (const entry of value) visit(entry);
|
|
2882
|
+
} else if (value && typeof value === "object") {
|
|
2883
|
+
for (const entry of Object.values(value)) visit(entry);
|
|
2884
|
+
}
|
|
2885
|
+
};
|
|
2886
|
+
visit(settings);
|
|
2887
|
+
const env = {};
|
|
2888
|
+
for (const name of names) {
|
|
2889
|
+
if (RUN_OWNED_SETTINGS_ENV.has(name)) continue;
|
|
2890
|
+
if (typeof baseEnv?.[name] === "string" && baseEnv[name]) env[name] = baseEnv[name];
|
|
2891
|
+
}
|
|
2892
|
+
return env;
|
|
2893
|
+
}
|
|
2887
2894
|
function assertInvocationIsolation2(input) {
|
|
2888
2895
|
for (const name of Object.keys(record8(input.commandEnv))) {
|
|
2889
2896
|
if (FORBIDDEN_COMMAND_ENV2.has(name)) throw new Error(`pi_managed_mcp_env_override_blocked: ${name}`);
|
|
@@ -2993,49 +3000,7 @@ function createManagedPiMcpProfileApi(options = {}) {
|
|
|
2993
3000
|
}
|
|
2994
3001
|
};
|
|
2995
3002
|
}
|
|
2996
|
-
function
|
|
2997
|
-
const packageSpec = Array.isArray(sourceSettings.packages) ? sourceSettings.packages.find((entry) => npmPackageName(entry) === MANAGED_WEB_ACCESS_PACKAGE) : null;
|
|
2998
|
-
if (typeof packageSpec !== "string") return null;
|
|
2999
|
-
const packagePath = join4(npmSource, "node_modules", ...MANAGED_WEB_ACCESS_PACKAGE.split("/"), "package.json");
|
|
3000
|
-
if (!existsSync3(packagePath) || lstatSync2(packagePath).isSymbolicLink() || !lstatSync2(packagePath).isFile()) {
|
|
3001
|
-
throw new Error(`pi_managed_mcp_attestation_failed: configured ${MANAGED_WEB_ACCESS_PACKAGE} package is unavailable`);
|
|
3002
|
-
}
|
|
3003
|
-
let packageMetadata;
|
|
3004
|
-
try {
|
|
3005
|
-
packageMetadata = JSON.parse(readFileSync3(packagePath, "utf8"));
|
|
3006
|
-
} catch {
|
|
3007
|
-
throw new Error(`pi_managed_mcp_attestation_failed: configured ${MANAGED_WEB_ACCESS_PACKAGE} package metadata is invalid`);
|
|
3008
|
-
}
|
|
3009
|
-
if (!packageMetadata || packageMetadata.name !== MANAGED_WEB_ACCESS_PACKAGE) {
|
|
3010
|
-
throw new Error(`pi_managed_mcp_attestation_failed: configured ${MANAGED_WEB_ACCESS_PACKAGE} package identity mismatch`);
|
|
3011
|
-
}
|
|
3012
|
-
return {
|
|
3013
|
-
packageSpec,
|
|
3014
|
-
config: record8(sourceSettings["pi-web-access"])
|
|
3015
|
-
};
|
|
3016
|
-
}
|
|
3017
|
-
function selectManagedTelemetry(sourceSettings, npmSource) {
|
|
3018
|
-
const packageSpec = Array.isArray(sourceSettings.packages) ? sourceSettings.packages.find((entry) => npmPackageName(entry) === MANAGED_TELEMETRY_PACKAGE) : null;
|
|
3019
|
-
if (typeof packageSpec !== "string") return null;
|
|
3020
|
-
const packagePath = join4(npmSource, "node_modules", ...MANAGED_TELEMETRY_PACKAGE.split("/"), "package.json");
|
|
3021
|
-
if (!existsSync3(packagePath) || lstatSync2(packagePath).isSymbolicLink() || !lstatSync2(packagePath).isFile()) {
|
|
3022
|
-
throw new Error(`pi_managed_mcp_attestation_failed: configured ${MANAGED_TELEMETRY_PACKAGE} package is unavailable`);
|
|
3023
|
-
}
|
|
3024
|
-
let packageMetadata;
|
|
3025
|
-
try {
|
|
3026
|
-
packageMetadata = JSON.parse(readFileSync3(packagePath, "utf8"));
|
|
3027
|
-
} catch {
|
|
3028
|
-
throw new Error(`pi_managed_mcp_attestation_failed: configured ${MANAGED_TELEMETRY_PACKAGE} package metadata is invalid`);
|
|
3029
|
-
}
|
|
3030
|
-
if (packageMetadata.name !== MANAGED_TELEMETRY_PACKAGE) {
|
|
3031
|
-
throw new Error(`pi_managed_mcp_attestation_failed: configured ${MANAGED_TELEMETRY_PACKAGE} package identity mismatch`);
|
|
3032
|
-
}
|
|
3033
|
-
return {
|
|
3034
|
-
packageSpec,
|
|
3035
|
-
config: record8(sourceSettings["pi-telemetry"])
|
|
3036
|
-
};
|
|
3037
|
-
}
|
|
3038
|
-
function seedPiRuntime(sourceHome, agentDir, sourceAcquisition = null, mcpToolMode = MANAGED_PI_MCP_TOOL_MODE) {
|
|
3003
|
+
function seedPiRuntime(sourceHome, agentDir, sourceAcquisition = null, mcpToolMode = MANAGED_PI_MCP_TOOL_MODE, baseEnv = {}) {
|
|
3039
3004
|
const source = resolve2(nonEmpty2(sourceHome, "sourcePiHome"));
|
|
3040
3005
|
const sourceStat = lstatSync2(source);
|
|
3041
3006
|
if (!sourceStat.isDirectory() || sourceStat.isSymbolicLink()) {
|
|
@@ -3063,30 +3028,20 @@ function createManagedPiMcpProfileApi(options = {}) {
|
|
|
3063
3028
|
throw new Error("pi_managed_mcp_attestation_failed: source Pi settings are invalid");
|
|
3064
3029
|
}
|
|
3065
3030
|
}
|
|
3066
|
-
const browserUse = selectManagedBrowserUse(sourceSettings, npmSource);
|
|
3067
|
-
const webAccess = sourceAcquisition ? null : selectManagedWebAccess(sourceSettings, npmSource);
|
|
3068
|
-
const telemetry = selectManagedTelemetry(sourceSettings, npmSource);
|
|
3031
|
+
const browserUse = sourceAcquisition ? selectManagedBrowserUse(sourceSettings, npmSource) : null;
|
|
3069
3032
|
if (sourceAcquisition && !browserUse) {
|
|
3070
3033
|
throw new Error("pi_managed_mcp_source_acquisition_packages_missing");
|
|
3071
3034
|
}
|
|
3072
|
-
const
|
|
3035
|
+
const sourcePackages = Array.isArray(sourceSettings.packages) ? [...sourceSettings.packages] : [];
|
|
3036
|
+
const settings = sourceAcquisition ? {
|
|
3073
3037
|
...typeof sourceSettings.defaultProvider === "string" ? { defaultProvider: sourceSettings.defaultProvider } : {},
|
|
3074
3038
|
...typeof sourceSettings.defaultModel === "string" ? { defaultModel: sourceSettings.defaultModel } : {},
|
|
3075
|
-
packages: [
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
...!sourceAcquisition && browserUse ? [browserUse.packageSpec] : []
|
|
3080
|
-
],
|
|
3081
|
-
...telemetry ? { "pi-telemetry": telemetry.config } : {},
|
|
3082
|
-
...webAccess ? { "pi-web-access": webAccess.config } : {},
|
|
3083
|
-
...!sourceAcquisition && browserUse ? {
|
|
3084
|
-
plugins: {
|
|
3085
|
-
[MANAGED_BROWSER_USE_PLUGIN]: browserUse.plugin
|
|
3086
|
-
},
|
|
3087
|
-
"pi-browser-use": browserUse.config
|
|
3088
|
-
} : {}
|
|
3039
|
+
packages: ["npm:pi-mcp-adapter"]
|
|
3040
|
+
} : {
|
|
3041
|
+
...sourceSettings,
|
|
3042
|
+
packages: sourcePackages.some((entry) => npmPackageName(entry) === "pi-mcp-adapter") ? sourcePackages : ["npm:pi-mcp-adapter", ...sourcePackages]
|
|
3089
3043
|
};
|
|
3044
|
+
const settingsEnv = sourceAcquisition ? {} : referencedSettingsEnvironment(settings, baseEnv);
|
|
3090
3045
|
writePrivateFile2(join4(agentDir, "settings.json"), `${JSON.stringify(settings, null, 2)}
|
|
3091
3046
|
`);
|
|
3092
3047
|
const extensionsDir = join4(agentDir, "extensions");
|
|
@@ -3112,7 +3067,10 @@ function createManagedPiMcpProfileApi(options = {}) {
|
|
|
3112
3067
|
copyPrivateFile(join4(source, "models.json"), join4(agentDir, "models.json"));
|
|
3113
3068
|
copyPrivateFile(join4(source, "SYSTEM.md"), join4(agentDir, "SYSTEM.md"));
|
|
3114
3069
|
const authSource = join4(source, "auth.json");
|
|
3115
|
-
const protectedValues =
|
|
3070
|
+
const protectedValues = collectAuthSecretStrings2(settings);
|
|
3071
|
+
for (const [name, value] of Object.entries(settingsEnv)) {
|
|
3072
|
+
if (isSensitiveAuthKey2(name)) protectedValues.push(value);
|
|
3073
|
+
}
|
|
3116
3074
|
if (copyPrivateFile(authSource, join4(agentDir, "auth.json"))) {
|
|
3117
3075
|
try {
|
|
3118
3076
|
collectAuthSecretStrings2(JSON.parse(readFileSync3(authSource, "utf8")), protectedValues);
|
|
@@ -3123,7 +3081,7 @@ function createManagedPiMcpProfileApi(options = {}) {
|
|
|
3123
3081
|
const npmStat = lstatSync2(npmSource);
|
|
3124
3082
|
if (!npmStat.isDirectory() || npmStat.isSymbolicLink()) throw new Error("pi_managed_mcp_source_config_unsafe: Pi npm root");
|
|
3125
3083
|
symlinkSync(npmSource, join4(agentDir, "npm"), "dir");
|
|
3126
|
-
return { adapterVersion, protectedValues };
|
|
3084
|
+
return { adapterVersion, protectedValues, settingsEnv };
|
|
3127
3085
|
}
|
|
3128
3086
|
function seedDelegatedPiRuntime(sourceHome, agentDir) {
|
|
3129
3087
|
const source = resolve2(nonEmpty2(sourceHome, "sourcePiHome"));
|
|
@@ -3309,7 +3267,13 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
3309
3267
|
commandId: input.commandId
|
|
3310
3268
|
});
|
|
3311
3269
|
const sourcePiHome = nonEmpty2(input.baseEnv?.PI_CODING_AGENT_DIR ?? input.baseEnv?.PI_AGENT_HOME, "sourcePiHome");
|
|
3312
|
-
const seededRuntime = seedPiRuntime(
|
|
3270
|
+
const seededRuntime = seedPiRuntime(
|
|
3271
|
+
sourcePiHome,
|
|
3272
|
+
piCodingAgentDir,
|
|
3273
|
+
input.sourceAcquisition,
|
|
3274
|
+
mcpToolMode,
|
|
3275
|
+
input.baseEnv
|
|
3276
|
+
);
|
|
3313
3277
|
const restoredNativeSession = restoreManagedPiSessionRollout(input, sessionsRoot, runDir, executorHome, authority);
|
|
3314
3278
|
const configPath = join4(piCodingAgentDir, "mcp.json");
|
|
3315
3279
|
const directToolNames = directCatalog?.tools.map((tool) => tool.exposedName) ?? [];
|
|
@@ -3388,6 +3352,7 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
3388
3352
|
};
|
|
3389
3353
|
}
|
|
3390
3354
|
const env = {
|
|
3355
|
+
...seededRuntime.settingsEnv,
|
|
3391
3356
|
...buildIsolatedEnvironment2(input.baseEnv, input.commandEnv),
|
|
3392
3357
|
HOME: home,
|
|
3393
3358
|
PI_AGENT_HOME: piAgentHome,
|
|
@@ -3442,7 +3407,6 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
3442
3407
|
protectedValues: [.../* @__PURE__ */ new Set([
|
|
3443
3408
|
sessionToken,
|
|
3444
3409
|
...seededRuntime.protectedValues,
|
|
3445
|
-
...MANAGED_TELEMETRY_PROTECTED_ENV_NAMES.map((name) => input.baseEnv?.[name]).filter((value) => typeof value === "string" && value.length > 0),
|
|
3446
3410
|
...MANAGED_PI_PROVIDER_PROTECTED_ENV_NAMES.map((name) => input.commandEnv?.[name]).filter((value) => typeof value === "string" && value.length > 0)
|
|
3447
3411
|
])],
|
|
3448
3412
|
attestation: {
|
|
@@ -9680,7 +9644,7 @@ function assertSourceAcquisitionRuntimeAuthority({
|
|
|
9680
9644
|
}
|
|
9681
9645
|
|
|
9682
9646
|
// src/amaster-runtime-daemon.mjs
|
|
9683
|
-
var CONNECTOR_VERSION = "0.1.1-beta.
|
|
9647
|
+
var CONNECTOR_VERSION = "0.1.1-beta.17";
|
|
9684
9648
|
var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
|
|
9685
9649
|
var SOURCE_ACQUISITION_CAPABILITY = "source_acquisition_v1";
|
|
9686
9650
|
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.17";
|
|
10
10
|
|
|
11
11
|
const CAPABILITIES = [
|
|
12
12
|
"remote_registration",
|