@amaster.ai/employee-runtime-connector 0.1.1-beta.120 → 0.1.1-beta.121
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 +153 -131
- package/dist/amaster-runtime.mjs +1 -1
- package/package.json +1 -1
|
@@ -17358,14 +17358,16 @@ function reconcileManagedCodexMcpProfiles(rootPath, options = {}) {
|
|
|
17358
17358
|
}
|
|
17359
17359
|
|
|
17360
17360
|
// src/amaster-runtime-daemon/pi-managed-mcp-profile.mjs
|
|
17361
|
-
import { createHash as
|
|
17361
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
17362
17362
|
import {
|
|
17363
17363
|
chmodSync as chmodSync4,
|
|
17364
17364
|
chownSync as chownSync2,
|
|
17365
|
+
closeSync,
|
|
17365
17366
|
copyFileSync,
|
|
17366
17367
|
existsSync as existsSync4,
|
|
17367
17368
|
lstatSync as lstatSync3,
|
|
17368
17369
|
mkdirSync as mkdirSync3,
|
|
17370
|
+
openSync,
|
|
17369
17371
|
readFileSync as readFileSync5,
|
|
17370
17372
|
realpathSync as realpathSync3,
|
|
17371
17373
|
readdirSync as readdirSync3,
|
|
@@ -18732,6 +18734,97 @@ export default function amasterRoleSkillsVisibility(pi) {
|
|
|
18732
18734
|
`;
|
|
18733
18735
|
}
|
|
18734
18736
|
|
|
18737
|
+
// src/amaster-runtime-daemon/source-acquisition-invocation.mjs
|
|
18738
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
18739
|
+
var SOURCE_ACQUISITION_PUBLIC_TOOLS2 = Object.freeze([
|
|
18740
|
+
"source_open",
|
|
18741
|
+
"source_snapshot",
|
|
18742
|
+
"source_screenshot",
|
|
18743
|
+
"source_analyze_screenshot",
|
|
18744
|
+
"source_wait",
|
|
18745
|
+
"runtime_action.submit",
|
|
18746
|
+
"runtime_action.status"
|
|
18747
|
+
]);
|
|
18748
|
+
var SOURCE_ACQUISITION_AUTHENTICATED_TOOLS2 = SOURCE_ACQUISITION_PUBLIC_TOOLS2;
|
|
18749
|
+
var SOURCE_ACQUISITION_PI_EFFECTIVE_TOOLS = Object.freeze([
|
|
18750
|
+
"source_open",
|
|
18751
|
+
"source_snapshot",
|
|
18752
|
+
"source_screenshot",
|
|
18753
|
+
"source_analyze_screenshot",
|
|
18754
|
+
"source_wait",
|
|
18755
|
+
"runtime_action_submit",
|
|
18756
|
+
"runtime_action_status"
|
|
18757
|
+
]);
|
|
18758
|
+
function exactToolsFor(profile) {
|
|
18759
|
+
if (profile?.access?.mode === "public") return SOURCE_ACQUISITION_PUBLIC_TOOLS2;
|
|
18760
|
+
if (profile?.access?.mode === "authenticated") return SOURCE_ACQUISITION_AUTHENTICATED_TOOLS2;
|
|
18761
|
+
throw new Error("source_acquisition_invocation_invalid");
|
|
18762
|
+
}
|
|
18763
|
+
function sourceAcquisitionPiInvocationArgs(profile) {
|
|
18764
|
+
const expected = exactToolsFor(profile);
|
|
18765
|
+
const actual = profile?.tools?.exactAllowlist;
|
|
18766
|
+
if (!Array.isArray(actual) || actual.length !== expected.length || actual.some((tool, index) => tool !== expected[index])) {
|
|
18767
|
+
throw new Error("source_acquisition_tool_allowlist_invalid");
|
|
18768
|
+
}
|
|
18769
|
+
return [
|
|
18770
|
+
"--tools",
|
|
18771
|
+
SOURCE_ACQUISITION_PI_EFFECTIVE_TOOLS.join(","),
|
|
18772
|
+
"--no-builtin-tools",
|
|
18773
|
+
"--no-skills",
|
|
18774
|
+
"--no-context-files",
|
|
18775
|
+
"--no-prompt-templates",
|
|
18776
|
+
"--no-session"
|
|
18777
|
+
];
|
|
18778
|
+
}
|
|
18779
|
+
function serializeSourceAcquisitionProfile(profile) {
|
|
18780
|
+
if (!profile || typeof profile !== "object" || Array.isArray(profile)) return null;
|
|
18781
|
+
const canonicalize = (value) => {
|
|
18782
|
+
if (value === null || typeof value === "boolean" || typeof value === "string") {
|
|
18783
|
+
return JSON.stringify(value);
|
|
18784
|
+
}
|
|
18785
|
+
if (typeof value === "number" && Number.isFinite(value)) return JSON.stringify(value);
|
|
18786
|
+
if (Array.isArray(value)) return `[${value.map(canonicalize).join(",")}]`;
|
|
18787
|
+
if (value && typeof value === "object") {
|
|
18788
|
+
return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${canonicalize(value[key])}`).join(",")}}`;
|
|
18789
|
+
}
|
|
18790
|
+
throw new Error("source_acquisition_profile_canonicalization_failed");
|
|
18791
|
+
};
|
|
18792
|
+
const input = Buffer.from(canonicalize(profile), "utf8");
|
|
18793
|
+
return {
|
|
18794
|
+
input,
|
|
18795
|
+
sha256: createHash4("sha256").update(input).digest("hex")
|
|
18796
|
+
};
|
|
18797
|
+
}
|
|
18798
|
+
function sourceAcquisitionManagedInputs(options) {
|
|
18799
|
+
return [
|
|
18800
|
+
options.sourceProfileInput ? { fd: 4, input: options.sourceProfileInput, code: "source_acquisition_profile" } : null
|
|
18801
|
+
].filter(Boolean);
|
|
18802
|
+
}
|
|
18803
|
+
function sourceAcquisitionManagedStdio(inputs) {
|
|
18804
|
+
const stdio = ["pipe", "pipe", "pipe"];
|
|
18805
|
+
for (const { fd } of inputs) {
|
|
18806
|
+
while (stdio.length <= fd) stdio.push("ignore");
|
|
18807
|
+
stdio[fd] = "pipe";
|
|
18808
|
+
}
|
|
18809
|
+
return stdio;
|
|
18810
|
+
}
|
|
18811
|
+
function deliverSourceAcquisitionManagedInputs(child, inputs, onError) {
|
|
18812
|
+
for (const { fd, input, code } of inputs) {
|
|
18813
|
+
child.stdio[fd].once("error", (error) => onError(code, error));
|
|
18814
|
+
child.stdio[fd].end(input);
|
|
18815
|
+
}
|
|
18816
|
+
}
|
|
18817
|
+
function assertSourceAcquisitionRuntimeAuthority({
|
|
18818
|
+
profile,
|
|
18819
|
+
executorKind,
|
|
18820
|
+
governedMcp
|
|
18821
|
+
}) {
|
|
18822
|
+
if (!profile) return;
|
|
18823
|
+
if (executorKind !== "pi" || !governedMcp || typeof governedMcp !== "object" || Object.keys(governedMcp).length === 0) {
|
|
18824
|
+
throw new Error("source_acquisition_governed_profile_required");
|
|
18825
|
+
}
|
|
18826
|
+
}
|
|
18827
|
+
|
|
18735
18828
|
// src/amaster-runtime-daemon/pi-managed-mcp-profile.mjs
|
|
18736
18829
|
var MANAGED_PI_MCP_TOOL_MODE = "proxy_only";
|
|
18737
18830
|
var MANAGED_PI_DIRECT_TYPED_MCP_TOOL_MODE = "direct_typed";
|
|
@@ -19011,7 +19104,7 @@ function createManagedPiMcpProfileApi(options = {}) {
|
|
|
19011
19104
|
nonEmpty2(session.invocationId, "nativeSession.invocationId");
|
|
19012
19105
|
const sourceWorkspacePath = nonEmpty2(session.cwd, "nativeSession.cwd");
|
|
19013
19106
|
const issueRoot = dirname4(runDir);
|
|
19014
|
-
const managedSourceRunDirName = `${sourceRunId}-${
|
|
19107
|
+
const managedSourceRunDirName = `${sourceRunId}-${createHash5("sha256").update(sourceRunId).digest("hex").slice(0, 8)}`;
|
|
19015
19108
|
const sourceRunDirs = readdirSync3(issueRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !entry.isSymbolicLink() && (entry.name === sourceRunId || entry.name === managedSourceRunDirName)).map((entry) => join5(issueRoot, entry.name));
|
|
19016
19109
|
if (sourceRunDirs.length !== 1) {
|
|
19017
19110
|
throw new Error(`pi_managed_mcp_session_rollout_missing: expected one source run directory for ${sourceRunId}, received ${sourceRunDirs.length}`);
|
|
@@ -19057,12 +19150,12 @@ function createManagedPiMcpProfileApi(options = {}) {
|
|
|
19057
19150
|
return value;
|
|
19058
19151
|
}
|
|
19059
19152
|
function sha2563(value) {
|
|
19060
|
-
return
|
|
19153
|
+
return createHash5("sha256").update(value).digest("hex");
|
|
19061
19154
|
}
|
|
19062
19155
|
function trustedTreeDigest(rootPath, options2 = {}) {
|
|
19063
19156
|
const root = resolve3(rootPath);
|
|
19064
19157
|
const ignoredRootEntries = new Set(Array.isArray(options2.ignoredRootEntries) ? options2.ignoredRootEntries : []);
|
|
19065
|
-
const hash =
|
|
19158
|
+
const hash = createHash5("sha256");
|
|
19066
19159
|
hash.update(`ignored-root:${[...ignoredRootEntries].sort().join(",")}
|
|
19067
19160
|
`);
|
|
19068
19161
|
const pending = [root];
|
|
@@ -19394,8 +19487,8 @@ function createManagedPiMcpProfileApi(options = {}) {
|
|
|
19394
19487
|
if (!executableStat.isFile() || executableStat.isSymbolicLink()) {
|
|
19395
19488
|
throw Object.assign(new Error("Pi executable is not a regular file"), { code: "EUNSAFE" });
|
|
19396
19489
|
}
|
|
19397
|
-
const contentSha256 =
|
|
19398
|
-
return `sha256:${
|
|
19490
|
+
const contentSha256 = createHash5("sha256").update(readFileSync5(realPath)).digest("hex");
|
|
19491
|
+
return `sha256:${createHash5("sha256").update(JSON.stringify({ realPath, contentSha256 })).digest("hex")}`;
|
|
19399
19492
|
} catch (error) {
|
|
19400
19493
|
const errorCode = typeof error?.code === "string" ? error.code : "UNKNOWN";
|
|
19401
19494
|
throw new Error(`pi_managed_mcp_attestation_failed: --version error=${errorCode}`);
|
|
@@ -19738,7 +19831,7 @@ function createManagedPiMcpProfileApi(options = {}) {
|
|
|
19738
19831
|
if (skillProfiles.length === 0) return {};
|
|
19739
19832
|
return {
|
|
19740
19833
|
skillProfiles,
|
|
19741
|
-
enabledSkillsDigest:
|
|
19834
|
+
enabledSkillsDigest: createHash5("sha256").update(JSON.stringify(enabledSkills)).digest("hex"),
|
|
19742
19835
|
enabledSkillMetadataBytes,
|
|
19743
19836
|
enabledSkillMetadataSha256
|
|
19744
19837
|
};
|
|
@@ -19902,30 +19995,37 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
19902
19995
|
completedAttempts = attempt;
|
|
19903
19996
|
writeEffectiveToolsProbePhase(input.phasePath, "spawned", attempt);
|
|
19904
19997
|
const resolvedExecutorCommand = resolveExecutorCommand(executorCommand, env) ?? executorCommand;
|
|
19905
|
-
|
|
19906
|
-
|
|
19907
|
-
"
|
|
19908
|
-
|
|
19909
|
-
|
|
19910
|
-
|
|
19911
|
-
|
|
19912
|
-
|
|
19913
|
-
|
|
19914
|
-
|
|
19915
|
-
|
|
19916
|
-
|
|
19917
|
-
|
|
19918
|
-
|
|
19919
|
-
|
|
19920
|
-
|
|
19921
|
-
|
|
19922
|
-
|
|
19923
|
-
|
|
19924
|
-
|
|
19925
|
-
|
|
19926
|
-
|
|
19927
|
-
|
|
19928
|
-
|
|
19998
|
+
let sourceProfileFd = null;
|
|
19999
|
+
try {
|
|
20000
|
+
sourceProfileFd = input.sourceProfilePath ? openSync(input.sourceProfilePath, "r") : null;
|
|
20001
|
+
result3 = spawnSyncImpl(resolvedExecutorCommand, [
|
|
20002
|
+
"--no-session",
|
|
20003
|
+
"--no-approve",
|
|
20004
|
+
"--no-skills",
|
|
20005
|
+
"--no-context-files",
|
|
20006
|
+
// The enforcement extensions live in the run profile, not an agent dir,
|
|
20007
|
+
// so the probe must load them explicitly to measure the real run surface.
|
|
20008
|
+
...Array.isArray(input.extensionArgs) ? input.extensionArgs : [],
|
|
20009
|
+
"--print",
|
|
20010
|
+
"probe effective tools"
|
|
20011
|
+
], {
|
|
20012
|
+
cwd: env.AMASTER_RUNTIME_EXECUTION_WORKDIR,
|
|
20013
|
+
env: {
|
|
20014
|
+
...env,
|
|
20015
|
+
AMASTER_PI_EFFECTIVE_TOOLS_MODE: "probe",
|
|
20016
|
+
AMASTER_PI_EFFECTIVE_TOOLS_ATTEMPT: String(attempt)
|
|
20017
|
+
},
|
|
20018
|
+
...sourceProfileFd === null ? {} : { stdio: ["ignore", "pipe", "pipe", "ignore", sourceProfileFd] },
|
|
20019
|
+
encoding: "utf8",
|
|
20020
|
+
timeout,
|
|
20021
|
+
killSignal: "SIGKILL",
|
|
20022
|
+
maxBuffer: 1024 * 1024,
|
|
20023
|
+
...isWindowsCommandShim(resolvedExecutorCommand) ? { shell: true } : {},
|
|
20024
|
+
...spawnIdentity ?? {}
|
|
20025
|
+
});
|
|
20026
|
+
} finally {
|
|
20027
|
+
if (sourceProfileFd !== null) closeSync(sourceProfileFd);
|
|
20028
|
+
}
|
|
19929
20029
|
if (result3.error?.code === "ETIMEDOUT" && attempt < attempts.length) continue;
|
|
19930
20030
|
break;
|
|
19931
20031
|
}
|
|
@@ -20121,6 +20221,11 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
20121
20221
|
if (sourceExecutionReceiptPath) {
|
|
20122
20222
|
createSourceAcquisitionExecutionReceipt(sourceExecutionReceiptPath, sourceExecutionIdentity);
|
|
20123
20223
|
}
|
|
20224
|
+
const serializedSourceProfile = input.sourceAcquisition ? serializeSourceAcquisitionProfile(input.sourceAcquisition.profile) : null;
|
|
20225
|
+
const sourceAttestationProfilePath = serializedSourceProfile && directCatalog ? join5(tmp, "source-acquisition-attestation-profile.json") : null;
|
|
20226
|
+
if (sourceAttestationProfilePath) {
|
|
20227
|
+
writePrivateFile2(sourceAttestationProfilePath, serializedSourceProfile.input);
|
|
20228
|
+
}
|
|
20124
20229
|
const adapterVersion = piMcpAdapterVersion(sharedRuntime.home);
|
|
20125
20230
|
if (directCatalog) {
|
|
20126
20231
|
writeProfileExtension(
|
|
@@ -20249,7 +20354,8 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
20249
20354
|
extensionArgs: [...extensionArgs],
|
|
20250
20355
|
finalActiveToolNames: effectiveRunToolAllowlist,
|
|
20251
20356
|
profileToolAllowlist: null,
|
|
20252
|
-
closureProfile
|
|
20357
|
+
closureProfile,
|
|
20358
|
+
...sourceAttestationProfilePath ? { sourceProfilePath: sourceAttestationProfilePath } : {}
|
|
20253
20359
|
};
|
|
20254
20360
|
}
|
|
20255
20361
|
let enabledRoleSkills = null;
|
|
@@ -20287,6 +20393,10 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
20287
20393
|
...sourceExecutionReceiptPath ? {
|
|
20288
20394
|
AMASTER_SOURCE_ACQUISITION_EXECUTION_RECEIPT: sourceExecutionReceiptPath
|
|
20289
20395
|
} : {},
|
|
20396
|
+
...serializedSourceProfile ? {
|
|
20397
|
+
AMASTER_SOURCE_ACQUISITION_PROFILE_FD: "4",
|
|
20398
|
+
AMASTER_SOURCE_ACQUISITION_PROFILE_SHA256: serializedSourceProfile.sha256
|
|
20399
|
+
} : {},
|
|
20290
20400
|
...input.sourceAcquisition ? sourceAcquisitionBrowserEnvironment(input.sourceAcquisition, input.baseEnv) : {}
|
|
20291
20401
|
};
|
|
20292
20402
|
if (directAttestationInput) {
|
|
@@ -20313,6 +20423,9 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
20313
20423
|
spawnIdentity,
|
|
20314
20424
|
effectiveToolsBootstrapCache?.key ?? null
|
|
20315
20425
|
) : {};
|
|
20426
|
+
if (directAttestationInput?.sourceProfilePath) {
|
|
20427
|
+
rmSync3(directAttestationInput.sourceProfilePath, { force: true });
|
|
20428
|
+
}
|
|
20316
20429
|
const effectiveToolProbeBootstrapCache = effectiveToolsBootstrapCache ? publishEffectiveToolsBootstrapCache(effectiveToolsBootstrapCache) : null;
|
|
20317
20430
|
const runExitClosureOwnership = directAttestationInput ? {
|
|
20318
20431
|
cache: ownershipStatSyncImpl(directAttestationInput.cachePath),
|
|
@@ -20399,7 +20512,7 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
20399
20512
|
])],
|
|
20400
20513
|
attestation: {
|
|
20401
20514
|
...attestationFacts,
|
|
20402
|
-
attestationId:
|
|
20515
|
+
attestationId: createHash5("sha256").update(JSON.stringify(attestationFacts)).digest("hex"),
|
|
20403
20516
|
attestedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
20404
20517
|
}
|
|
20405
20518
|
};
|
|
@@ -20677,7 +20790,7 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
20677
20790
|
protectedValues: [.../* @__PURE__ */ new Set([sessionToken, ...seededRuntime.protectedValues])],
|
|
20678
20791
|
attestation: {
|
|
20679
20792
|
...attestationFacts,
|
|
20680
|
-
attestationId:
|
|
20793
|
+
attestationId: createHash5("sha256").update(JSON.stringify(attestationFacts)).digest("hex"),
|
|
20681
20794
|
attestedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
20682
20795
|
}
|
|
20683
20796
|
};
|
|
@@ -21375,7 +21488,7 @@ function inspectSourceAcquisitionProfile(profile, expectedRunId) {
|
|
|
21375
21488
|
import { createHash as createHash7 } from "node:crypto";
|
|
21376
21489
|
|
|
21377
21490
|
// src/amaster-runtime-daemon/current-run-contract.mjs
|
|
21378
|
-
import { createHash as
|
|
21491
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
21379
21492
|
var CONTRACT_VERSION = "mirrorx.current-run-contract.v1";
|
|
21380
21493
|
var REQUIRED_ACTIONS = [
|
|
21381
21494
|
"amaster.read_issue_delivery",
|
|
@@ -21407,7 +21520,7 @@ function canonicalJson(value) {
|
|
|
21407
21520
|
}
|
|
21408
21521
|
function semanticHash(contract) {
|
|
21409
21522
|
const { contractHash: _contractHash, compiledAt: _compiledAt, ...semantic } = contract;
|
|
21410
|
-
return `sha256:${
|
|
21523
|
+
return `sha256:${createHash6("sha256").update(canonicalJson(semantic)).digest("hex")}`;
|
|
21411
21524
|
}
|
|
21412
21525
|
function validateBlockingGaps(value) {
|
|
21413
21526
|
return Array.isArray(value) && value.length === 0;
|
|
@@ -21568,97 +21681,6 @@ function resolveTaskCompanyKnowledgePolicy(context) {
|
|
|
21568
21681
|
};
|
|
21569
21682
|
}
|
|
21570
21683
|
|
|
21571
|
-
// src/amaster-runtime-daemon/source-acquisition-invocation.mjs
|
|
21572
|
-
import { createHash as createHash6 } from "node:crypto";
|
|
21573
|
-
var SOURCE_ACQUISITION_PUBLIC_TOOLS2 = Object.freeze([
|
|
21574
|
-
"source_open",
|
|
21575
|
-
"source_snapshot",
|
|
21576
|
-
"source_screenshot",
|
|
21577
|
-
"source_analyze_screenshot",
|
|
21578
|
-
"source_wait",
|
|
21579
|
-
"runtime_action.submit",
|
|
21580
|
-
"runtime_action.status"
|
|
21581
|
-
]);
|
|
21582
|
-
var SOURCE_ACQUISITION_AUTHENTICATED_TOOLS2 = SOURCE_ACQUISITION_PUBLIC_TOOLS2;
|
|
21583
|
-
var SOURCE_ACQUISITION_PI_EFFECTIVE_TOOLS = Object.freeze([
|
|
21584
|
-
"source_open",
|
|
21585
|
-
"source_snapshot",
|
|
21586
|
-
"source_screenshot",
|
|
21587
|
-
"source_analyze_screenshot",
|
|
21588
|
-
"source_wait",
|
|
21589
|
-
"runtime_action_submit",
|
|
21590
|
-
"runtime_action_status"
|
|
21591
|
-
]);
|
|
21592
|
-
function exactToolsFor(profile) {
|
|
21593
|
-
if (profile?.access?.mode === "public") return SOURCE_ACQUISITION_PUBLIC_TOOLS2;
|
|
21594
|
-
if (profile?.access?.mode === "authenticated") return SOURCE_ACQUISITION_AUTHENTICATED_TOOLS2;
|
|
21595
|
-
throw new Error("source_acquisition_invocation_invalid");
|
|
21596
|
-
}
|
|
21597
|
-
function sourceAcquisitionPiInvocationArgs(profile) {
|
|
21598
|
-
const expected = exactToolsFor(profile);
|
|
21599
|
-
const actual = profile?.tools?.exactAllowlist;
|
|
21600
|
-
if (!Array.isArray(actual) || actual.length !== expected.length || actual.some((tool, index) => tool !== expected[index])) {
|
|
21601
|
-
throw new Error("source_acquisition_tool_allowlist_invalid");
|
|
21602
|
-
}
|
|
21603
|
-
return [
|
|
21604
|
-
"--tools",
|
|
21605
|
-
SOURCE_ACQUISITION_PI_EFFECTIVE_TOOLS.join(","),
|
|
21606
|
-
"--no-builtin-tools",
|
|
21607
|
-
"--no-skills",
|
|
21608
|
-
"--no-context-files",
|
|
21609
|
-
"--no-prompt-templates",
|
|
21610
|
-
"--no-session"
|
|
21611
|
-
];
|
|
21612
|
-
}
|
|
21613
|
-
function serializeSourceAcquisitionProfile(profile) {
|
|
21614
|
-
if (!profile || typeof profile !== "object" || Array.isArray(profile)) return null;
|
|
21615
|
-
const canonicalize = (value) => {
|
|
21616
|
-
if (value === null || typeof value === "boolean" || typeof value === "string") {
|
|
21617
|
-
return JSON.stringify(value);
|
|
21618
|
-
}
|
|
21619
|
-
if (typeof value === "number" && Number.isFinite(value)) return JSON.stringify(value);
|
|
21620
|
-
if (Array.isArray(value)) return `[${value.map(canonicalize).join(",")}]`;
|
|
21621
|
-
if (value && typeof value === "object") {
|
|
21622
|
-
return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${canonicalize(value[key])}`).join(",")}}`;
|
|
21623
|
-
}
|
|
21624
|
-
throw new Error("source_acquisition_profile_canonicalization_failed");
|
|
21625
|
-
};
|
|
21626
|
-
const input = Buffer.from(canonicalize(profile), "utf8");
|
|
21627
|
-
return {
|
|
21628
|
-
input,
|
|
21629
|
-
sha256: createHash6("sha256").update(input).digest("hex")
|
|
21630
|
-
};
|
|
21631
|
-
}
|
|
21632
|
-
function sourceAcquisitionManagedInputs(options) {
|
|
21633
|
-
return [
|
|
21634
|
-
options.sourceProfileInput ? { fd: 4, input: options.sourceProfileInput, code: "source_acquisition_profile" } : null
|
|
21635
|
-
].filter(Boolean);
|
|
21636
|
-
}
|
|
21637
|
-
function sourceAcquisitionManagedStdio(inputs) {
|
|
21638
|
-
const stdio = ["pipe", "pipe", "pipe"];
|
|
21639
|
-
for (const { fd } of inputs) {
|
|
21640
|
-
while (stdio.length <= fd) stdio.push("ignore");
|
|
21641
|
-
stdio[fd] = "pipe";
|
|
21642
|
-
}
|
|
21643
|
-
return stdio;
|
|
21644
|
-
}
|
|
21645
|
-
function deliverSourceAcquisitionManagedInputs(child, inputs, onError) {
|
|
21646
|
-
for (const { fd, input, code } of inputs) {
|
|
21647
|
-
child.stdio[fd].once("error", (error) => onError(code, error));
|
|
21648
|
-
child.stdio[fd].end(input);
|
|
21649
|
-
}
|
|
21650
|
-
}
|
|
21651
|
-
function assertSourceAcquisitionRuntimeAuthority({
|
|
21652
|
-
profile,
|
|
21653
|
-
executorKind,
|
|
21654
|
-
governedMcp
|
|
21655
|
-
}) {
|
|
21656
|
-
if (!profile) return;
|
|
21657
|
-
if (executorKind !== "pi" || !governedMcp || typeof governedMcp !== "object" || Object.keys(governedMcp).length === 0) {
|
|
21658
|
-
throw new Error("source_acquisition_governed_profile_required");
|
|
21659
|
-
}
|
|
21660
|
-
}
|
|
21661
|
-
|
|
21662
21684
|
// src/amaster-runtime-daemon/prompt-compiler.mjs
|
|
21663
21685
|
var DEADLINE_POSTURE_GUARD = "If a named time window or milestone is missed, skip that window and keep the task moving: never lower quality, bypass approvals, fabricate results, or stop the whole task because of the miss. Record a deadline-posture receipt with targetMilestoneRef, posture, onMiss=skip_this_window_and_continue, taskContinuation, and the next owner/action; the receipt is an execution signal, not Server-side proof.";
|
|
21664
21686
|
var MIN_PROMPT_BUDGET_CHARS = 8192;
|
|
@@ -25672,7 +25694,7 @@ var bestEffortPostJson = bestEffortPostRuntimeConnectorJson;
|
|
|
25672
25694
|
|
|
25673
25695
|
// src/amaster-runtime-daemon/runtime-artifact-upload.mjs
|
|
25674
25696
|
import { createHash as createHash9 } from "node:crypto";
|
|
25675
|
-
import { closeSync, constants, fstatSync, lstatSync as lstatSync5, openSync, readFileSync as readFileSync10, realpathSync as realpathSync4 } from "node:fs";
|
|
25697
|
+
import { closeSync as closeSync2, constants, fstatSync, lstatSync as lstatSync5, openSync as openSync2, readFileSync as readFileSync10, realpathSync as realpathSync4 } from "node:fs";
|
|
25676
25698
|
import { isAbsolute as isAbsolute5, relative as relative4, resolve as resolve5 } from "node:path";
|
|
25677
25699
|
var SHA256_PATTERN3 = /^[a-f0-9]{64}$/;
|
|
25678
25700
|
function requiredString(value, name) {
|
|
@@ -25700,7 +25722,7 @@ function readOwnedWorkspaceFile(rootPath, sourceRelativePath, label = "Runtime w
|
|
|
25700
25722
|
throw new Error(`${label} source is not an owned regular file`);
|
|
25701
25723
|
}
|
|
25702
25724
|
const noFollow = typeof constants.O_NOFOLLOW === "number" ? constants.O_NOFOLLOW : 0;
|
|
25703
|
-
const descriptor =
|
|
25725
|
+
const descriptor = openSync2(sourcePath, constants.O_RDONLY | noFollow);
|
|
25704
25726
|
try {
|
|
25705
25727
|
const before = fstatSync(descriptor);
|
|
25706
25728
|
if (!before.isFile() || !sameFileSnapshot(pathStat, before)) {
|
|
@@ -25733,7 +25755,7 @@ function readOwnedWorkspaceFile(rootPath, sourceRelativePath, label = "Runtime w
|
|
|
25733
25755
|
}
|
|
25734
25756
|
return { body, relativePath, stat: after };
|
|
25735
25757
|
} finally {
|
|
25736
|
-
|
|
25758
|
+
closeSync2(descriptor);
|
|
25737
25759
|
}
|
|
25738
25760
|
}
|
|
25739
25761
|
function prepareRuntimeArtifactUploads(cwd, mcpToolResults) {
|
|
@@ -28379,7 +28401,7 @@ function createSourceCompletionStopPolicy({
|
|
|
28379
28401
|
}
|
|
28380
28402
|
|
|
28381
28403
|
// src/amaster-runtime-daemon.mjs
|
|
28382
|
-
var CONNECTOR_VERSION = "0.1.1-beta.
|
|
28404
|
+
var CONNECTOR_VERSION = "0.1.1-beta.121";
|
|
28383
28405
|
var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
|
|
28384
28406
|
var SOURCE_ACQUISITION_CAPABILITY2 = source_acquisition_compatibility_default.profileVersion;
|
|
28385
28407
|
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.121";
|
|
10
10
|
|
|
11
11
|
const CAPABILITIES = [
|
|
12
12
|
"remote_registration",
|