@amaster.ai/employee-runtime-connector 0.1.1-beta.123 → 0.1.1-beta.124
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/README.md +1 -1
- package/dist/amaster-runtime-daemon.mjs +119 -3
- package/dist/amaster-runtime.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ Runtime code belongs in the container image. Persist only connector state, the r
|
|
|
37
37
|
|
|
38
38
|
The Server requires `final_model_context_attestation_v1` for governed Pi runs because that path disables ambient context discovery and injects a run-owned compiled instruction bundle. This is a Pi delivery contract, not a connector-wide requirement: an explicitly selected self-hosted Codex runtime continues through its own Runtime Actions V2 and native-session contracts and cannot borrow the Pi attestation claim. Adding the same final-context guarantee to another executor requires executor-specific proof for scoped project-instruction semantics, the normalized final active tool schemas, the selected model's context/output limits, automatically visible skill metadata, resumed-session history, and the enforced output reserve.
|
|
39
39
|
|
|
40
|
-
For admitted Pi runs, the daemon compiles source-repository `AGENTS.md` and `AGENTS.override.md` topology into one root `AGENTS.md` with explicit relative scopes, same-scope override semantics, and a higher-authority MirrorX platform block. Governed Pi disables ambient extension, skill, and context-file discovery and injects that exact compiled file through a run-owned final-system-prompt extension. A last-ordered `before_provider_request` hook then validates every provider call, including later calls after tool results: exactly one system message contains the compiled instructions, visible role-skill metadata and the normalized active tool set match their prior attestations, the provider model/output ceiling match the run contract, and the complete serialized payload plus output reserve fits the context window. Each call appends metadata-only hashes and sizes to a bounded chained receipt; a missing, broken, or oversized chain fails the run.
|
|
40
|
+
For admitted Pi runs, the daemon compiles source-repository `AGENTS.md` and `AGENTS.override.md` topology into one root `AGENTS.md` with explicit relative scopes, same-scope override semantics, and a higher-authority MirrorX platform block. Governed Pi disables ambient extension, skill, and context-file discovery and injects that exact compiled file through a run-owned final-system-prompt extension. When the operator-owned Pi settings declare `@amaster.ai/pi-telemetry`, the daemon resolves only that package-owned entry, requires the runtime npm manifest to pin its exact installed version, verifies its name, path, and tree digest, passes it as an explicit extension, and preserves the authoritative runtime run id for trace correlation; every other ambient package extension remains disabled. A last-ordered `before_provider_request` hook then validates every provider call, including later calls after tool results: exactly one system message contains the compiled instructions, visible role-skill metadata and the normalized active tool set match their prior attestations, the provider model/output ceiling match the run contract, and the complete serialized payload plus output reserve fits the context window. Each call appends metadata-only hashes and sizes to a bounded chained receipt; a missing, broken, or oversized chain fails the run.
|
|
41
41
|
|
|
42
42
|
Pi 0.80.10's internal compaction summarizer calls the provider outside `before_provider_request`. The Enabled profile therefore records and cancels every `session_before_compact` attempt and fails immediately if `session_compact` is nevertheless observed. No model-generated compaction summary is accepted until that provider path has equivalent final-context attestation. The Server also enumerates Pi and Codex as the only supported governed executors at configuration and heartbeat dispatch boundaries; missing or unknown executor kinds fail closed.
|
|
43
43
|
|
|
@@ -18870,6 +18870,8 @@ var MANAGED_PI_DIRECT_TYPED_MCP_TOOL_MODE = "direct_typed";
|
|
|
18870
18870
|
var MANAGED_PI_MCP_ARGS_NORMALIZATION = "json_string_control_characters_v1";
|
|
18871
18871
|
var MANAGED_PI_MCP_ARGS_NORMALIZER_FILENAME = "amaster-mcp-args-normalizer.js";
|
|
18872
18872
|
var MANAGED_PI_CONFIG_MODE_SHARED = "shared_agent_dir_workspace_mcp_file";
|
|
18873
|
+
var MANAGED_PI_TELEMETRY_PACKAGE = "@amaster.ai/pi-telemetry";
|
|
18874
|
+
var MANAGED_PI_TELEMETRY_PACKAGE_SOURCE = "npm:@amaster.ai/pi-telemetry";
|
|
18873
18875
|
function applyManagedPiToolAllowlist(args, profile) {
|
|
18874
18876
|
const toolAllowlist = Array.isArray(profile?.toolAllowlist) ? profile.toolAllowlist.filter((name) => typeof name === "string" && name) : [];
|
|
18875
18877
|
if (toolAllowlist.length === 0) return [...args];
|
|
@@ -19031,6 +19033,10 @@ function createManagedPiMcpProfileApi(options = {}) {
|
|
|
19031
19033
|
"PAPERCLIP_AGENT_ID",
|
|
19032
19034
|
"PAPERCLIP_COMPANY_ID",
|
|
19033
19035
|
"AMASTER_EMPLOYEE_COMPANY_ID",
|
|
19036
|
+
// Runtime telemetry is a governed audit channel. The daemon assigns this
|
|
19037
|
+
// correlation id from the authoritative run and the managed profile must
|
|
19038
|
+
// preserve it when rebuilding the child environment.
|
|
19039
|
+
"PI_TELEMETRY_TASK_RUN_ID",
|
|
19034
19040
|
// The agent dir is operator-owned configuration: governed runs inherit the
|
|
19035
19041
|
// daemon's single value verbatim. commandEnv cannot inject it
|
|
19036
19042
|
// (FORBIDDEN_COMMAND_ENV).
|
|
@@ -19441,6 +19447,98 @@ function createManagedPiMcpProfileApi(options = {}) {
|
|
|
19441
19447
|
}
|
|
19442
19448
|
return version;
|
|
19443
19449
|
}
|
|
19450
|
+
function managedPiTelemetryExtension(sharedRuntime) {
|
|
19451
|
+
const settings = record8(sharedRuntime.settings);
|
|
19452
|
+
const packages = Array.isArray(settings.packages) ? settings.packages : [];
|
|
19453
|
+
const configuredSources = packages.filter((source) => typeof source === "string" && (source === MANAGED_PI_TELEMETRY_PACKAGE_SOURCE || source.startsWith(`${MANAGED_PI_TELEMETRY_PACKAGE_SOURCE}@`)));
|
|
19454
|
+
if (configuredSources.length === 0) return null;
|
|
19455
|
+
if (configuredSources.length !== 1) {
|
|
19456
|
+
throw new Error("pi_managed_mcp_telemetry_package_source_invalid");
|
|
19457
|
+
}
|
|
19458
|
+
const configuredSource = configuredSources[0];
|
|
19459
|
+
const settingsVersion = configuredSource.startsWith(`${MANAGED_PI_TELEMETRY_PACKAGE_SOURCE}@`) ? configuredSource.slice(MANAGED_PI_TELEMETRY_PACKAGE_SOURCE.length + 1) : null;
|
|
19460
|
+
if (settingsVersion !== null && !/^\d+\.\d+\.\d+(?:[-+].+)?$/.test(settingsVersion)) {
|
|
19461
|
+
throw new Error("pi_managed_mcp_telemetry_package_source_unpinned");
|
|
19462
|
+
}
|
|
19463
|
+
const runtimeManifestPath = join5(sharedRuntime.home, "npm", "package.json");
|
|
19464
|
+
let runtimeManifest;
|
|
19465
|
+
try {
|
|
19466
|
+
const runtimeManifestStat = lstatSync3(runtimeManifestPath);
|
|
19467
|
+
if (!runtimeManifestStat.isFile() || runtimeManifestStat.isSymbolicLink()) {
|
|
19468
|
+
throw new Error("unsafe runtime package manifest");
|
|
19469
|
+
}
|
|
19470
|
+
runtimeManifest = record8(JSON.parse(readFileSync5(runtimeManifestPath, "utf8")));
|
|
19471
|
+
} catch {
|
|
19472
|
+
throw new Error("pi_managed_mcp_telemetry_runtime_manifest_unavailable");
|
|
19473
|
+
}
|
|
19474
|
+
const pinnedVersion = typeof record8(runtimeManifest.dependencies)[MANAGED_PI_TELEMETRY_PACKAGE] === "string" ? record8(runtimeManifest.dependencies)[MANAGED_PI_TELEMETRY_PACKAGE].trim() : "";
|
|
19475
|
+
if (!/^\d+\.\d+\.\d+(?:[-+].+)?$/.test(pinnedVersion)) {
|
|
19476
|
+
throw new Error("pi_managed_mcp_telemetry_runtime_manifest_unpinned");
|
|
19477
|
+
}
|
|
19478
|
+
if (settingsVersion !== null && settingsVersion !== pinnedVersion) {
|
|
19479
|
+
throw new Error("pi_managed_mcp_telemetry_package_source_version_mismatch");
|
|
19480
|
+
}
|
|
19481
|
+
const packageRoot = resolve3(
|
|
19482
|
+
sharedRuntime.home,
|
|
19483
|
+
"npm",
|
|
19484
|
+
"node_modules",
|
|
19485
|
+
"@amaster.ai",
|
|
19486
|
+
"pi-telemetry"
|
|
19487
|
+
);
|
|
19488
|
+
const packageJsonPath = join5(packageRoot, "package.json");
|
|
19489
|
+
let packageJson;
|
|
19490
|
+
try {
|
|
19491
|
+
const packageStat = lstatSync3(packageRoot);
|
|
19492
|
+
if (!packageStat.isDirectory() || packageStat.isSymbolicLink()) throw new Error("unsafe package root");
|
|
19493
|
+
const packageJsonStat = lstatSync3(packageJsonPath);
|
|
19494
|
+
if (!packageJsonStat.isFile() || packageJsonStat.isSymbolicLink()) throw new Error("unsafe package manifest");
|
|
19495
|
+
packageJson = record8(JSON.parse(readFileSync5(packageJsonPath, "utf8")));
|
|
19496
|
+
} catch {
|
|
19497
|
+
throw new Error("pi_managed_mcp_telemetry_package_unavailable");
|
|
19498
|
+
}
|
|
19499
|
+
if (packageJson.name !== MANAGED_PI_TELEMETRY_PACKAGE) {
|
|
19500
|
+
throw new Error("pi_managed_mcp_telemetry_package_invalid");
|
|
19501
|
+
}
|
|
19502
|
+
const version = typeof packageJson.version === "string" ? packageJson.version.trim() : "";
|
|
19503
|
+
if (!/^\d+\.\d+\.\d+(?:[-+].+)?$/.test(version)) {
|
|
19504
|
+
throw new Error("pi_managed_mcp_telemetry_package_version_invalid");
|
|
19505
|
+
}
|
|
19506
|
+
if (version !== pinnedVersion) {
|
|
19507
|
+
throw new Error("pi_managed_mcp_telemetry_package_version_mismatch");
|
|
19508
|
+
}
|
|
19509
|
+
const declaredExtensions = Array.isArray(record8(packageJson.pi).extensions) ? record8(packageJson.pi).extensions : [];
|
|
19510
|
+
if (declaredExtensions.length !== 1 || typeof declaredExtensions[0] !== "string") {
|
|
19511
|
+
throw new Error("pi_managed_mcp_telemetry_extension_invalid");
|
|
19512
|
+
}
|
|
19513
|
+
const extensionPath = resolve3(packageRoot, declaredExtensions[0]);
|
|
19514
|
+
if (!within2(extensionPath, packageRoot)) {
|
|
19515
|
+
throw new Error("pi_managed_mcp_telemetry_extension_unsafe");
|
|
19516
|
+
}
|
|
19517
|
+
try {
|
|
19518
|
+
const extensionStat = lstatSync3(extensionPath);
|
|
19519
|
+
if (!extensionStat.isFile() || extensionStat.isSymbolicLink()) throw new Error("unsafe extension entry");
|
|
19520
|
+
const realPackageRoot = realpathSync3(packageRoot);
|
|
19521
|
+
const realExtensionPath = realpathSync3(extensionPath);
|
|
19522
|
+
if (!within2(realExtensionPath, realPackageRoot)) throw new Error("extension escaped package root");
|
|
19523
|
+
} catch {
|
|
19524
|
+
throw new Error("pi_managed_mcp_telemetry_extension_unsafe");
|
|
19525
|
+
}
|
|
19526
|
+
let packageTreeSha256;
|
|
19527
|
+
try {
|
|
19528
|
+
packageTreeSha256 = trustedTreeDigest(packageRoot, { ignoredRootEntries: ["node_modules"] });
|
|
19529
|
+
} catch {
|
|
19530
|
+
throw new Error("pi_managed_mcp_telemetry_package_unsafe");
|
|
19531
|
+
}
|
|
19532
|
+
return {
|
|
19533
|
+
packageName: MANAGED_PI_TELEMETRY_PACKAGE,
|
|
19534
|
+
packageVersion: version,
|
|
19535
|
+
packageVersionSource: "runtime_npm_manifest",
|
|
19536
|
+
extensionPath,
|
|
19537
|
+
extensionSha256: sha2563(readFileSync5(extensionPath)),
|
|
19538
|
+
packageTreeSha256,
|
|
19539
|
+
langfuseEnabled: record8(record8(settings["pi-telemetry"]).langfuse).enabled === true
|
|
19540
|
+
};
|
|
19541
|
+
}
|
|
19444
19542
|
function adapterServerConfigHash(definition, adapterVersion) {
|
|
19445
19543
|
const identity2 = piMcpAdapterServerConfigIdentity(definition, adapterVersion);
|
|
19446
19544
|
return sha2563(stablePiJson(identity2));
|
|
@@ -19809,7 +19907,7 @@ function createManagedPiMcpProfileApi(options = {}) {
|
|
|
19809
19907
|
for (const [name, value] of Object.entries(settingsEnv)) {
|
|
19810
19908
|
if (isSensitiveAuthKey2(name)) protectedValues.push(value);
|
|
19811
19909
|
}
|
|
19812
|
-
return { home, settingsEnv, protectedValues };
|
|
19910
|
+
return { home, settings, settingsEnv, protectedValues };
|
|
19813
19911
|
}
|
|
19814
19912
|
const SKILL_PROFILE_NAME = /^[a-z0-9-]+$/;
|
|
19815
19913
|
function readSkillProfile(piHome, skillProfile) {
|
|
@@ -20431,6 +20529,10 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
20431
20529
|
...sourceAttestationProfilePath ? { sourceProfilePath: sourceAttestationProfilePath } : {}
|
|
20432
20530
|
};
|
|
20433
20531
|
}
|
|
20532
|
+
const telemetryExtension = managedPiTelemetryExtension(sharedRuntime);
|
|
20533
|
+
if (telemetryExtension) {
|
|
20534
|
+
extensionArgs.push("--extension", telemetryExtension.extensionPath);
|
|
20535
|
+
}
|
|
20434
20536
|
let enabledRoleSkills = null;
|
|
20435
20537
|
let enabledRoleSkillMetadataBytes = 0;
|
|
20436
20538
|
let enabledRoleSkillMetadataSha256 = null;
|
|
@@ -20448,6 +20550,9 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
20448
20550
|
const env = {
|
|
20449
20551
|
...sharedRuntime.settingsEnv,
|
|
20450
20552
|
...buildIsolatedEnvironment2(input.baseEnv, input.commandEnv),
|
|
20553
|
+
// The profile owns the final child environment. Never rely on a caller
|
|
20554
|
+
// supplied correlation value when governed telemetry is active.
|
|
20555
|
+
...telemetryExtension ? { PI_TELEMETRY_TASK_RUN_ID: runId } : {},
|
|
20451
20556
|
HOME: home,
|
|
20452
20557
|
PI_AGENT_HOME: piAgentHome,
|
|
20453
20558
|
PI_CODING_AGENT_SESSION_DIR: sessionsRoot,
|
|
@@ -20531,7 +20636,18 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
20531
20636
|
enabledRoleSkills,
|
|
20532
20637
|
enabledRoleSkillMetadataBytes,
|
|
20533
20638
|
enabledRoleSkillMetadataSha256
|
|
20534
|
-
)
|
|
20639
|
+
),
|
|
20640
|
+
telemetryExtensionStatus: telemetryExtension ? "attested" : "not_configured",
|
|
20641
|
+
...telemetryExtension ? {
|
|
20642
|
+
telemetryPackageName: telemetryExtension.packageName,
|
|
20643
|
+
telemetryPackageVersion: telemetryExtension.packageVersion,
|
|
20644
|
+
telemetryPackageVersionSource: telemetryExtension.packageVersionSource,
|
|
20645
|
+
telemetryExtensionPath: telemetryExtension.extensionPath,
|
|
20646
|
+
telemetryExtensionSha256: telemetryExtension.extensionSha256,
|
|
20647
|
+
telemetryPackageTreeSha256: telemetryExtension.packageTreeSha256,
|
|
20648
|
+
telemetryLangfuseEnabled: telemetryExtension.langfuseEnabled,
|
|
20649
|
+
telemetryRunCorrelationStatus: "authoritative"
|
|
20650
|
+
} : {}
|
|
20535
20651
|
};
|
|
20536
20652
|
return {
|
|
20537
20653
|
profileRoot,
|
|
@@ -28497,7 +28613,7 @@ function createSourceCompletionStopPolicy({
|
|
|
28497
28613
|
}
|
|
28498
28614
|
|
|
28499
28615
|
// src/amaster-runtime-daemon.mjs
|
|
28500
|
-
var CONNECTOR_VERSION = "0.1.1-beta.
|
|
28616
|
+
var CONNECTOR_VERSION = "0.1.1-beta.124";
|
|
28501
28617
|
var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
|
|
28502
28618
|
var SOURCE_ACQUISITION_CAPABILITY2 = source_acquisition_compatibility_default.profileVersion;
|
|
28503
28619
|
var daemonRequire = createRequire(import.meta.url);
|
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.124";
|
|
10
10
|
|
|
11
11
|
const CAPABILITIES = [
|
|
12
12
|
"remote_registration",
|