@amaster.ai/employee-runtime-connector 0.1.1-beta.11 → 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.
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
// src/amaster-runtime-daemon.mjs
|
|
5
5
|
import { createHash as createHash13 } from "node:crypto";
|
|
6
|
-
import { chmodSync as chmodSync6, copyFileSync as copyFileSync3, existsSync as existsSync14, lstatSync as lstatSync7, mkdirSync as mkdirSync9, mkdtempSync, readFileSync as readFileSync11, readdirSync as readdirSync9, realpathSync as realpathSync5, renameSync as renameSync6, rmSync as rmSync7, statSync as
|
|
6
|
+
import { chmodSync as chmodSync6, copyFileSync as copyFileSync3, existsSync as existsSync14, lstatSync as lstatSync7, mkdirSync as mkdirSync9, mkdtempSync, readFileSync as readFileSync11, readdirSync as readdirSync9, realpathSync as realpathSync5, renameSync as renameSync6, rmSync as rmSync7, statSync as statSync8, symlinkSync as symlinkSync4, unlinkSync as unlinkSync2, writeFileSync as writeFileSync9 } from "node:fs";
|
|
7
7
|
import { arch as arch3, homedir as homedir3, hostname as hostname2, platform as platform3, tmpdir } from "node:os";
|
|
8
8
|
import { basename as basename6, delimiter as delimiter3, dirname as dirname9, extname as extname2, isAbsolute as isAbsolute8, join as join15, relative as relative9, resolve as resolve12 } from "node:path";
|
|
9
9
|
import { spawn as spawn2, spawnSync as spawnSync6 } from "node:child_process";
|
|
@@ -3021,6 +3021,7 @@ function createManagedPiMcpProfileApi(options = {}) {
|
|
|
3021
3021
|
throw new Error("pi_managed_mcp_source_acquisition_extension_missing");
|
|
3022
3022
|
}
|
|
3023
3023
|
copyPrivateFile(join4(source, "models.json"), join4(agentDir, "models.json"));
|
|
3024
|
+
copyPrivateFile(join4(source, "SYSTEM.md"), join4(agentDir, "SYSTEM.md"));
|
|
3024
3025
|
const authSource = join4(source, "auth.json");
|
|
3025
3026
|
const protectedValues = [];
|
|
3026
3027
|
if (copyPrivateFile(authSource, join4(agentDir, "auth.json"))) {
|
|
@@ -3035,6 +3036,33 @@ function createManagedPiMcpProfileApi(options = {}) {
|
|
|
3035
3036
|
symlinkSync(npmSource, join4(agentDir, "npm"), "dir");
|
|
3036
3037
|
return { adapterVersion, protectedValues };
|
|
3037
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
|
+
}
|
|
3038
3066
|
function attestPi(executorCommand, env, configPath, expectedConfig) {
|
|
3039
3067
|
const resolvedExecutorCommand = resolvePiExecutablePath(executorCommand, env);
|
|
3040
3068
|
const executorIdentity = piExecutableIdentity(resolvedExecutorCommand);
|
|
@@ -3338,17 +3366,21 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
3338
3366
|
assertInvocationIsolation2(input);
|
|
3339
3367
|
const { gateway, gatewayUrl, sessionToken, headers, runId, mcpToolMode, directCatalog } = validateAuthority2(input);
|
|
3340
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);
|
|
3341
3372
|
const executorHome = resolve2(nonEmpty2(input.executorHome, "executorHome"));
|
|
3342
3373
|
if (!within4(executorHome, join4(runDir, "executors"))) throw new Error("pi_delegated_mcp_owner_mismatch: executorHome is outside the managed run");
|
|
3343
3374
|
const profileRoot = join4(executorHome, "delegated-mcp");
|
|
3344
3375
|
if (existsSync3(profileRoot)) throw new Error(`pi_delegated_mcp_profile_exists: ${profileRoot}`);
|
|
3376
|
+
const piCodingAgentDir = join4(profileRoot, "pi-coding-agent-dir");
|
|
3345
3377
|
const sessionsRoot = join4(profileRoot, "sessions");
|
|
3346
3378
|
const tmp = join4(profileRoot, "tmp");
|
|
3347
|
-
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 });
|
|
3348
3380
|
try {
|
|
3349
3381
|
const markerPath = join4(profileRoot, DELEGATED_PROFILE_MARKER);
|
|
3350
3382
|
const owner = Object.freeze({ commandId: input.commandId, runId });
|
|
3351
|
-
writePrivateFile2(markerPath, `${JSON.stringify({ version: 1, ...owner, profileRoot })}
|
|
3383
|
+
writePrivateFile2(markerPath, `${JSON.stringify({ version: 1, ...owner, profileRoot, piCodingAgentDir })}
|
|
3352
3384
|
`);
|
|
3353
3385
|
const runtimeAuth = record7(input.runtimeAuth);
|
|
3354
3386
|
const authority = Object.freeze({
|
|
@@ -3363,8 +3395,9 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
3363
3395
|
if (!sourceStat.isDirectory() || sourceStat.isSymbolicLink()) {
|
|
3364
3396
|
throw new Error("pi_delegated_mcp_source_config_unsafe: Pi home");
|
|
3365
3397
|
}
|
|
3398
|
+
const seededRuntime = seedDelegatedPiRuntime(sourcePiHome, piCodingAgentDir);
|
|
3366
3399
|
const sourceMcp = readJsonObjectFile(join4(sourcePiHome, "mcp.json"));
|
|
3367
|
-
const configPath = join4(
|
|
3400
|
+
const configPath = join4(piCodingAgentDir, "mcp.json");
|
|
3368
3401
|
const directToolNames = directCatalog?.tools.map((tool) => tool.exposedName) ?? [];
|
|
3369
3402
|
const serverConfig = {
|
|
3370
3403
|
type: "http",
|
|
@@ -3389,6 +3422,9 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
3389
3422
|
const env = {
|
|
3390
3423
|
...input.baseEnv,
|
|
3391
3424
|
...record7(input.commandEnv),
|
|
3425
|
+
PI_AGENT_HOME: sourcePiHome,
|
|
3426
|
+
PI_CODING_AGENT_DIR: piCodingAgentDir,
|
|
3427
|
+
"AMASTER-CLI_CODING_AGENT_DIR": piCodingAgentDir,
|
|
3392
3428
|
PI_AGENT_MCP_SERVERS_FILE: configPath,
|
|
3393
3429
|
PI_CODING_AGENT_SESSION_DIR: sessionsRoot,
|
|
3394
3430
|
"AMASTER-CLI_CODING_AGENT_SESSION_DIR": sessionsRoot,
|
|
@@ -3410,6 +3446,7 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
3410
3446
|
runId,
|
|
3411
3447
|
sessionId: gateway.sessionId,
|
|
3412
3448
|
sourcePiHome,
|
|
3449
|
+
piCodingAgentDir,
|
|
3413
3450
|
configSha256: sha256(readFileSync3(configPath))
|
|
3414
3451
|
};
|
|
3415
3452
|
return {
|
|
@@ -3421,7 +3458,7 @@ ${result3.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
|
|
|
3421
3458
|
markerPath,
|
|
3422
3459
|
env,
|
|
3423
3460
|
toolAllowlist: null,
|
|
3424
|
-
protectedValues: [sessionToken],
|
|
3461
|
+
protectedValues: [.../* @__PURE__ */ new Set([sessionToken, ...seededRuntime.protectedValues])],
|
|
3425
3462
|
attestation: {
|
|
3426
3463
|
...attestationFacts,
|
|
3427
3464
|
attestationId: createHash3("sha256").update(JSON.stringify(attestationFacts)).digest("hex"),
|
|
@@ -7073,13 +7110,27 @@ function createRuntimeArtifactIngestQueue({ ingest, onError }) {
|
|
|
7073
7110
|
|
|
7074
7111
|
// src/amaster-runtime-daemon/workspace-guard.mjs
|
|
7075
7112
|
import { createHash as createHash6 } from "node:crypto";
|
|
7076
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync6, realpathSync as realpathSync4, statSync as
|
|
7113
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync6, realpathSync as realpathSync4, statSync as statSync4 } from "node:fs";
|
|
7077
7114
|
import { basename as basename4, join as join8, isAbsolute as isAbsolute4, relative as relative4, resolve as resolve4 } from "node:path";
|
|
7078
7115
|
|
|
7079
7116
|
// src/amaster-runtime-daemon/workspace-manifest.mjs
|
|
7080
|
-
import { existsSync as existsSync6, readFileSync as readFileSync7, renameSync as renameSync4, rmSync as rmSync4, writeFileSync as writeFileSync6 } from "node:fs";
|
|
7117
|
+
import { chownSync, existsSync as existsSync6, readFileSync as readFileSync7, renameSync as renameSync4, rmSync as rmSync4, statSync as statSync3, writeFileSync as writeFileSync6 } from "node:fs";
|
|
7081
7118
|
import { basename as basename3, dirname as dirname5, join as join7 } from "node:path";
|
|
7082
7119
|
var WORKSPACE_MANIFEST_FILENAME = ".amaster-runtime.json";
|
|
7120
|
+
function syncManifestDirOwnership(manifestPath, deps = {}) {
|
|
7121
|
+
const stat = deps.statSync ?? statSync3;
|
|
7122
|
+
const chown = deps.chownSync ?? chownSync;
|
|
7123
|
+
const geteuid = deps.geteuid ?? (typeof process.geteuid === "function" ? process.geteuid.bind(process) : () => null);
|
|
7124
|
+
try {
|
|
7125
|
+
if (geteuid() !== 0) return false;
|
|
7126
|
+
const dirStat = stat(dirname5(manifestPath));
|
|
7127
|
+
if (dirStat.uid === 0 && dirStat.gid === 0) return false;
|
|
7128
|
+
chown(manifestPath, dirStat.uid, dirStat.gid);
|
|
7129
|
+
return true;
|
|
7130
|
+
} catch {
|
|
7131
|
+
return false;
|
|
7132
|
+
}
|
|
7133
|
+
}
|
|
7083
7134
|
function nowIso() {
|
|
7084
7135
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
7085
7136
|
}
|
|
@@ -7098,7 +7149,7 @@ function readWorkspaceManifest(manifestPath) {
|
|
|
7098
7149
|
return null;
|
|
7099
7150
|
}
|
|
7100
7151
|
}
|
|
7101
|
-
function writeWorkspaceManifest(manifestPath, manifest) {
|
|
7152
|
+
function writeWorkspaceManifest(manifestPath, manifest, deps) {
|
|
7102
7153
|
const tempPath = join7(
|
|
7103
7154
|
dirname5(manifestPath),
|
|
7104
7155
|
`.${basename3(manifestPath)}.tmp-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2)}`
|
|
@@ -7107,6 +7158,7 @@ function writeWorkspaceManifest(manifestPath, manifest) {
|
|
|
7107
7158
|
writeFileSync6(tempPath, `${JSON.stringify(manifest, null, 2)}
|
|
7108
7159
|
`, { mode: 384 });
|
|
7109
7160
|
renameSync4(tempPath, manifestPath);
|
|
7161
|
+
syncManifestDirOwnership(manifestPath, deps);
|
|
7110
7162
|
} catch (err) {
|
|
7111
7163
|
rmSync4(tempPath, { force: true });
|
|
7112
7164
|
throw err;
|
|
@@ -7177,7 +7229,7 @@ function resolveWorkspaceCwd(config, command) {
|
|
|
7177
7229
|
if (!allowed) {
|
|
7178
7230
|
throw new Error(`Workspace path is outside AMASTER_WORKSPACE_ALLOWLIST: ${cwd}`);
|
|
7179
7231
|
}
|
|
7180
|
-
if (!existsSync7(cwd) || !
|
|
7232
|
+
if (!existsSync7(cwd) || !statSync4(cwd).isDirectory()) {
|
|
7181
7233
|
throw new Error(`Workspace path does not exist or is not a directory: ${cwd}`);
|
|
7182
7234
|
}
|
|
7183
7235
|
return cwd;
|
|
@@ -7247,7 +7299,7 @@ function resolveExecutionWorkspace(config, command, opts = {}) {
|
|
|
7247
7299
|
}
|
|
7248
7300
|
|
|
7249
7301
|
// src/amaster-runtime-daemon/workspace-gc.mjs
|
|
7250
|
-
import { existsSync as existsSync8, readdirSync as readdirSync4, statSync as
|
|
7302
|
+
import { existsSync as existsSync8, readdirSync as readdirSync4, statSync as statSync5 } from "node:fs";
|
|
7251
7303
|
import { join as join9, resolve as resolve5 } from "node:path";
|
|
7252
7304
|
function readIsoTime(value) {
|
|
7253
7305
|
if (typeof value !== "string" || !value.trim()) return null;
|
|
@@ -7289,7 +7341,7 @@ function directorySizeBytes(path) {
|
|
|
7289
7341
|
if (!current) continue;
|
|
7290
7342
|
let stat;
|
|
7291
7343
|
try {
|
|
7292
|
-
stat =
|
|
7344
|
+
stat = statSync5(current, { throwIfNoEntry: false });
|
|
7293
7345
|
} catch {
|
|
7294
7346
|
continue;
|
|
7295
7347
|
}
|
|
@@ -7375,7 +7427,7 @@ function planManagedWorkspaceGcDryRun(input) {
|
|
|
7375
7427
|
}
|
|
7376
7428
|
|
|
7377
7429
|
// src/amaster-runtime-daemon/runtime-status-summary.mjs
|
|
7378
|
-
import { existsSync as existsSync9, readdirSync as readdirSync5, statSync as
|
|
7430
|
+
import { existsSync as existsSync9, readdirSync as readdirSync5, statSync as statSync6 } from "node:fs";
|
|
7379
7431
|
import { dirname as dirname6, join as join10, resolve as resolve6 } from "node:path";
|
|
7380
7432
|
function runtimeStatusDirectoryEntries(path) {
|
|
7381
7433
|
try {
|
|
@@ -7392,7 +7444,7 @@ function runtimeStatusDirectorySizeBytes(path) {
|
|
|
7392
7444
|
if (!current) continue;
|
|
7393
7445
|
let stat;
|
|
7394
7446
|
try {
|
|
7395
|
-
stat =
|
|
7447
|
+
stat = statSync6(current, { throwIfNoEntry: false });
|
|
7396
7448
|
} catch {
|
|
7397
7449
|
continue;
|
|
7398
7450
|
}
|
|
@@ -7630,13 +7682,13 @@ function summarizeAmasterRuntimeVersionDrift(input = {}) {
|
|
|
7630
7682
|
import { createHash as createHash7 } from "node:crypto";
|
|
7631
7683
|
import {
|
|
7632
7684
|
chmodSync as chmodSync3,
|
|
7633
|
-
chownSync,
|
|
7685
|
+
chownSync as chownSync2,
|
|
7634
7686
|
lchownSync,
|
|
7635
7687
|
lstatSync as lstatSync4,
|
|
7636
7688
|
readdirSync as readdirSync6
|
|
7637
7689
|
} from "node:fs";
|
|
7638
7690
|
import { resolve as resolve7, sep } from "node:path";
|
|
7639
|
-
var defaultFs = { chmodSync: chmodSync3, chownSync, lchownSync, lstatSync: lstatSync4, readdirSync: readdirSync6 };
|
|
7691
|
+
var defaultFs = { chmodSync: chmodSync3, chownSync: chownSync2, lchownSync, lstatSync: lstatSync4, readdirSync: readdirSync6 };
|
|
7640
7692
|
function defaultHashRunId(runId) {
|
|
7641
7693
|
return Number.parseInt(createHash7("sha256").update(runId).digest("hex").slice(0, 8), 16);
|
|
7642
7694
|
}
|
|
@@ -7765,7 +7817,7 @@ function preparePiChildIsolation(input) {
|
|
|
7765
7817
|
import { createHash as createHash8 } from "node:crypto";
|
|
7766
7818
|
import {
|
|
7767
7819
|
chmodSync as chmodSync4,
|
|
7768
|
-
chownSync as
|
|
7820
|
+
chownSync as chownSync3,
|
|
7769
7821
|
existsSync as existsSync10,
|
|
7770
7822
|
lchownSync as lchownSync2,
|
|
7771
7823
|
lstatSync as lstatSync5,
|
|
@@ -7785,7 +7837,7 @@ var DEFAULT_GID_BASE = 1e5;
|
|
|
7785
7837
|
var DEFAULT_GID_SPAN = 1e6;
|
|
7786
7838
|
var defaultFs2 = {
|
|
7787
7839
|
chmodSync: chmodSync4,
|
|
7788
|
-
chownSync:
|
|
7840
|
+
chownSync: chownSync3,
|
|
7789
7841
|
existsSync: existsSync10,
|
|
7790
7842
|
lchownSync: lchownSync2,
|
|
7791
7843
|
lstatSync: lstatSync5,
|
|
@@ -8528,7 +8580,7 @@ function verifyTrustedPiRuntimeAssertion(input) {
|
|
|
8528
8580
|
// src/amaster-runtime-daemon/workspace-status.mjs
|
|
8529
8581
|
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
8530
8582
|
import { createHash as createHash10 } from "node:crypto";
|
|
8531
|
-
import { existsSync as existsSync12, readdirSync as readdirSync8, readFileSync as readFileSync10, statSync as
|
|
8583
|
+
import { existsSync as existsSync12, readdirSync as readdirSync8, readFileSync as readFileSync10, statSync as statSync7 } from "node:fs";
|
|
8532
8584
|
import { basename as basename5, extname, isAbsolute as isAbsolute7, join as join13, relative as relative7, resolve as resolve10 } from "node:path";
|
|
8533
8585
|
var WORKSPACE_RUNTIME_SERVICES_FILENAME = ".amaster-runtime-services.json";
|
|
8534
8586
|
var ARTIFACT_EXTENSIONS = /* @__PURE__ */ new Map([
|
|
@@ -8661,7 +8713,7 @@ function scanArtifactCandidates(cwd, opts = {}) {
|
|
|
8661
8713
|
const type = ARTIFACT_EXTENSIONS.get(ext) ?? "file";
|
|
8662
8714
|
let stat;
|
|
8663
8715
|
try {
|
|
8664
|
-
stat =
|
|
8716
|
+
stat = statSync7(fullPath);
|
|
8665
8717
|
} catch {
|
|
8666
8718
|
continue;
|
|
8667
8719
|
}
|
|
@@ -9394,7 +9446,7 @@ function assertSourceAcquisitionRuntimeAuthority({
|
|
|
9394
9446
|
}
|
|
9395
9447
|
|
|
9396
9448
|
// src/amaster-runtime-daemon.mjs
|
|
9397
|
-
var CONNECTOR_VERSION = "0.1.1-beta.
|
|
9449
|
+
var CONNECTOR_VERSION = "0.1.1-beta.13";
|
|
9398
9450
|
var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
|
|
9399
9451
|
var SOURCE_ACQUISITION_CAPABILITY = "source_acquisition_v1";
|
|
9400
9452
|
var SOURCE_ACQUISITION_PROFILE_VERSION = "source_acquisition_v1";
|
|
@@ -9681,7 +9733,7 @@ function safeDirectorySummary(pathValue) {
|
|
|
9681
9733
|
return { configured: false, available: false, entryCount: 0 };
|
|
9682
9734
|
}
|
|
9683
9735
|
try {
|
|
9684
|
-
const stat =
|
|
9736
|
+
const stat = statSync8(pathValue);
|
|
9685
9737
|
if (!stat.isDirectory()) {
|
|
9686
9738
|
return { configured: true, available: false, entryCount: 0, reason: "not_directory" };
|
|
9687
9739
|
}
|
|
@@ -9715,7 +9767,7 @@ function safeSkillRootSummary(kind, source, pathValue) {
|
|
|
9715
9767
|
if (name.startsWith(".")) continue;
|
|
9716
9768
|
const skillDir = join15(pathValue, name);
|
|
9717
9769
|
try {
|
|
9718
|
-
if (!
|
|
9770
|
+
if (!statSync8(skillDir).isDirectory()) continue;
|
|
9719
9771
|
if (!existsSync14(join15(skillDir, "SKILL.md"))) continue;
|
|
9720
9772
|
skillCount += 1;
|
|
9721
9773
|
if (skillCount >= MAX_PI_CAPABILITY_SOURCE_ENTRIES) {
|
|
@@ -9744,7 +9796,7 @@ function safeJsonConfigSummary(source, pathValue, counter) {
|
|
|
9744
9796
|
return { source, configured: false, available: false, parseable: false };
|
|
9745
9797
|
}
|
|
9746
9798
|
try {
|
|
9747
|
-
const stat =
|
|
9799
|
+
const stat = statSync8(pathValue);
|
|
9748
9800
|
if (!stat.isFile()) {
|
|
9749
9801
|
return { source, configured: true, available: false, parseable: false, reason: "not_file" };
|
|
9750
9802
|
}
|
|
@@ -13724,7 +13776,7 @@ async function materializeIssueCheckpoint(config, command, workspace) {
|
|
|
13724
13776
|
}
|
|
13725
13777
|
if (!existsSync14(sourceCandidate)) throw new Error(`issue checkpoint file is missing: ${relativePath}`);
|
|
13726
13778
|
const source = realpathSync5(sourceCandidate);
|
|
13727
|
-
if (!pathWithin2(source, filesRoot) || !
|
|
13779
|
+
if (!pathWithin2(source, filesRoot) || !statSync8(source).isFile()) {
|
|
13728
13780
|
throw new Error(`issue checkpoint source escapes its storage root: ${relativePath}`);
|
|
13729
13781
|
}
|
|
13730
13782
|
const expectedSha256 = readString(file.sha256);
|
|
@@ -13732,7 +13784,7 @@ async function materializeIssueCheckpoint(config, command, workspace) {
|
|
|
13732
13784
|
if (!expectedSha256 || expectedByteSize === null || expectedByteSize <= 0) {
|
|
13733
13785
|
throw new Error(`issue checkpoint evidence is incomplete: ${relativePath}`);
|
|
13734
13786
|
}
|
|
13735
|
-
if (hashFileSha256(source) !== expectedSha256 ||
|
|
13787
|
+
if (hashFileSha256(source) !== expectedSha256 || statSync8(source).size !== expectedByteSize) {
|
|
13736
13788
|
throw new Error(`issue checkpoint integrity mismatch: ${relativePath}`);
|
|
13737
13789
|
}
|
|
13738
13790
|
totalBytes += expectedByteSize;
|
|
@@ -13785,12 +13837,12 @@ async function saveIssueCheckpoint(config, command, workspace, candidates) {
|
|
|
13785
13837
|
for (const candidate of candidates.slice(0, 20)) {
|
|
13786
13838
|
const relativePath = safeCheckpointRelativePath(candidate.rawPath);
|
|
13787
13839
|
const source = readString(candidate.filePath);
|
|
13788
|
-
if (!relativePath || !source || !existsSync14(source) || !
|
|
13840
|
+
if (!relativePath || !source || !existsSync14(source) || !statSync8(source).isFile()) continue;
|
|
13789
13841
|
const ownedSource = realpathSync5(source);
|
|
13790
13842
|
if (!pathWithin2(ownedSource, workspaceRoot)) {
|
|
13791
13843
|
throw new Error(`issue checkpoint source escapes its execution workspace: ${relativePath}`);
|
|
13792
13844
|
}
|
|
13793
|
-
const byteSize =
|
|
13845
|
+
const byteSize = statSync8(ownedSource).size;
|
|
13794
13846
|
if (byteSize <= 0 || totalBytes + byteSize > MAX_CHECKPOINT_BYTES) continue;
|
|
13795
13847
|
const target = resolve12(filesDir, relativePath);
|
|
13796
13848
|
if (!pathWithin2(target, filesDir)) continue;
|
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",
|