@amaster.ai/employee-runtime-connector 0.1.12 → 0.1.13-beta.0
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.
|
@@ -24,9 +24,15 @@ export const BUILD_SUPPORTED_CAPABILITIES = Object.freeze([
|
|
|
24
24
|
"mirrorx_initialization_completion_v1",
|
|
25
25
|
"native_session_checkpoint_v1",
|
|
26
26
|
"pi_web_public_search_v1",
|
|
27
|
+
"pi_web_public_fetch_v1",
|
|
27
28
|
]);
|
|
28
29
|
|
|
29
30
|
const DYNAMIC_READINESS = Object.freeze({
|
|
31
|
+
pi_web_public_fetch_v1: {
|
|
32
|
+
reasonCode: "pi_web_fetch_extension_unavailable",
|
|
33
|
+
ready: (input) => input.executors.some((executor) => executor.kind === "pi")
|
|
34
|
+
&& input.piWebFetchReady === true,
|
|
35
|
+
},
|
|
30
36
|
pi_web_public_search_v1: {
|
|
31
37
|
reasonCode: "pi_web_search_extension_unavailable",
|
|
32
38
|
ready: (input) => input.executors.some((executor) => executor.kind === "pi")
|
|
@@ -4946,7 +4946,8 @@ var AMASTER_RUNTIME_CONNECTOR_CAPABILITIES = [
|
|
|
4946
4946
|
"mirrorx_initialization_context_v1",
|
|
4947
4947
|
"mirrorx_initialization_completion_v1",
|
|
4948
4948
|
"native_session_checkpoint_v1",
|
|
4949
|
-
"pi_web_public_search_v1"
|
|
4949
|
+
"pi_web_public_search_v1",
|
|
4950
|
+
"pi_web_public_fetch_v1"
|
|
4950
4951
|
];
|
|
4951
4952
|
var RUNTIME_EXECUTION_LANES = ["business", "conversation"];
|
|
4952
4953
|
var runtimeExecutionLaneSchema = external_exports.enum(RUNTIME_EXECUTION_LANES);
|
|
@@ -5462,10 +5463,20 @@ var EXTERNAL_WAIT_REASON_CODES = {
|
|
|
5462
5463
|
externalInputPending: "external_input_pending",
|
|
5463
5464
|
externalApprovalPending: "external_approval_pending",
|
|
5464
5465
|
externalDependencyPending: "external_dependency_pending",
|
|
5466
|
+
externalServiceUnavailable: "external_service_unavailable",
|
|
5465
5467
|
heligeGenerationInProgress: "helige_generation_in_progress",
|
|
5466
5468
|
heligeNewTurnNotObserved: "helige_new_turn_not_observed",
|
|
5467
5469
|
heligeGenerationStatusUnavailable: "helige_generation_status_unavailable"
|
|
5468
5470
|
};
|
|
5471
|
+
var EXTERNAL_WAIT_NEW_WRITE_REASON_CODES = [
|
|
5472
|
+
EXTERNAL_WAIT_REASON_CODES.browserHumanSessionHandoffRequired,
|
|
5473
|
+
EXTERNAL_WAIT_REASON_CODES.externalDependencyPending,
|
|
5474
|
+
EXTERNAL_WAIT_REASON_CODES.externalServiceUnavailable,
|
|
5475
|
+
EXTERNAL_WAIT_REASON_CODES.wikiOperationContextMissing,
|
|
5476
|
+
EXTERNAL_WAIT_REASON_CODES.agentInsufficientBalance,
|
|
5477
|
+
EXTERNAL_WAIT_REASON_CODES.heligeInsufficientBalance,
|
|
5478
|
+
EXTERNAL_WAIT_REASON_CODES.businessDataSourceUnavailable
|
|
5479
|
+
];
|
|
5469
5480
|
var LEGACY_BROWSER_HANDOFF_REASON_CODES = [
|
|
5470
5481
|
EXTERNAL_WAIT_REASON_CODES.browserMfaRequired,
|
|
5471
5482
|
EXTERNAL_WAIT_REASON_CODES.browserCaptchaRequired,
|
|
@@ -9701,6 +9712,32 @@ var createTaskResourceAttachmentRequestSchema = external_exports.object({ attach
|
|
|
9701
9712
|
// ../shared/src/mirrorx-discovery-governance.ts
|
|
9702
9713
|
var sha256Schema6 = external_exports.string().regex(/^sha256:[a-f0-9]{64}$/);
|
|
9703
9714
|
var positiveBoundedInteger = (max) => external_exports.number().int().positive().max(max);
|
|
9715
|
+
var selectMirrorXInternalDiscoveryTargetSchema = external_exports.object({
|
|
9716
|
+
routineId: external_exports.string().uuid(),
|
|
9717
|
+
criterionId: external_exports.string().uuid(),
|
|
9718
|
+
gapId: external_exports.string().uuid(),
|
|
9719
|
+
expectedGapContractId: external_exports.string().uuid(),
|
|
9720
|
+
expectedGapAuthorityRevision: external_exports.number().int().positive()
|
|
9721
|
+
}).strict();
|
|
9722
|
+
var mirrorXInternalDiscoveryTargetSelectionSchema = external_exports.object({
|
|
9723
|
+
id: external_exports.string().uuid(),
|
|
9724
|
+
companyId: external_exports.string().uuid(),
|
|
9725
|
+
routineId: external_exports.string().uuid(),
|
|
9726
|
+
goalId: external_exports.string().uuid(),
|
|
9727
|
+
criterionId: external_exports.string().uuid(),
|
|
9728
|
+
gapId: external_exports.string().uuid(),
|
|
9729
|
+
gapContractId: external_exports.string().uuid(),
|
|
9730
|
+
gapAuthorityRevision: external_exports.number().int().positive(),
|
|
9731
|
+
targetKey: external_exports.string().min(1),
|
|
9732
|
+
sourceSelectorRevision: external_exports.string().min(1),
|
|
9733
|
+
projectionPolicyRevision: external_exports.number().int().positive(),
|
|
9734
|
+
comparePolicyRevision: external_exports.number().int().positive(),
|
|
9735
|
+
freezeSeq: external_exports.string().regex(/^\d+$/),
|
|
9736
|
+
selectionRevision: external_exports.number().int().positive(),
|
|
9737
|
+
status: external_exports.enum(["current", "superseded"]),
|
|
9738
|
+
createdAt: external_exports.string().datetime({ offset: true }),
|
|
9739
|
+
supersededAt: external_exports.string().datetime({ offset: true }).nullable()
|
|
9740
|
+
}).strict();
|
|
9704
9741
|
var mirrorxDiscoveryPromotionModeSchema = external_exports.enum(["shadow", "board_gated"]);
|
|
9705
9742
|
var customerFeedbackSourceBindingV1Schema = external_exports.object({
|
|
9706
9743
|
version: external_exports.literal(1),
|
|
@@ -19179,7 +19216,7 @@ var MIRRORX_DRIVE_AGENT_RULES = [
|
|
|
19179
19216
|
// src/amaster-runtime-daemon.mjs
|
|
19180
19217
|
import { chmodSync as chmodSync8, copyFileSync as copyFileSync2, existsSync as existsSync18, lstatSync as lstatSync15, mkdirSync as mkdirSync13, mkdtempSync as mkdtempSync5, readFileSync as readFileSync20, readdirSync as readdirSync13, realpathSync as realpathSync12, renameSync as renameSync11, rmSync as rmSync12, statSync as statSync12, symlinkSync as symlinkSync2, unlinkSync as unlinkSync3, writeFileSync as writeFileSync14 } from "node:fs";
|
|
19181
19218
|
import { arch as arch4, homedir as homedir7, hostname as hostname2, platform as platform4, tmpdir } from "node:os";
|
|
19182
|
-
import { basename as basename8, delimiter as delimiter3, dirname as
|
|
19219
|
+
import { basename as basename8, delimiter as delimiter3, dirname as dirname13, extname as extname3, isAbsolute as isAbsolute13, join as join25, relative as relative9, resolve as resolve19 } from "node:path";
|
|
19183
19220
|
import { spawn, spawnSync as spawnSync5 } from "node:child_process";
|
|
19184
19221
|
|
|
19185
19222
|
// src/amaster-runtime-daemon/common.mjs
|
|
@@ -29118,11 +29155,17 @@ function piRuntimeWebEvidence(event) {
|
|
|
29118
29155
|
return [];
|
|
29119
29156
|
}
|
|
29120
29157
|
}
|
|
29158
|
+
const directToolEndResult = readString(event?.type) === "tool_execution_end" ? {
|
|
29159
|
+
...asRecord(event?.result),
|
|
29160
|
+
role: "toolResult",
|
|
29161
|
+
toolName: readString(event?.toolName) ?? readString(asRecord(event?.result).toolName),
|
|
29162
|
+
toolCallId: readString(event?.toolCallId) ?? readString(asRecord(event?.result).toolCallId)
|
|
29163
|
+
} : null;
|
|
29121
29164
|
const toolResults = [
|
|
29122
29165
|
event?.message,
|
|
29123
29166
|
...Array.isArray(event?.messages) ? event.messages : [],
|
|
29124
29167
|
...Array.isArray(event?.toolResults) ? event.toolResults : [],
|
|
29125
|
-
...
|
|
29168
|
+
...directToolEndResult ? [directToolEndResult] : []
|
|
29126
29169
|
];
|
|
29127
29170
|
const evidence = [];
|
|
29128
29171
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -32735,9 +32778,14 @@ var BUILD_SUPPORTED_CAPABILITIES = Object.freeze([
|
|
|
32735
32778
|
"mirrorx_initialization_context_v1",
|
|
32736
32779
|
"mirrorx_initialization_completion_v1",
|
|
32737
32780
|
"native_session_checkpoint_v1",
|
|
32738
|
-
"pi_web_public_search_v1"
|
|
32781
|
+
"pi_web_public_search_v1",
|
|
32782
|
+
"pi_web_public_fetch_v1"
|
|
32739
32783
|
]);
|
|
32740
32784
|
var DYNAMIC_READINESS = Object.freeze({
|
|
32785
|
+
pi_web_public_fetch_v1: {
|
|
32786
|
+
reasonCode: "pi_web_fetch_extension_unavailable",
|
|
32787
|
+
ready: (input) => input.executors.some((executor) => executor.kind === "pi") && input.piWebFetchReady === true
|
|
32788
|
+
},
|
|
32741
32789
|
pi_web_public_search_v1: {
|
|
32742
32790
|
reasonCode: "pi_web_search_extension_unavailable",
|
|
32743
32791
|
ready: (input) => input.executors.some((executor) => executor.kind === "pi") && input.piWebSearchReady === true
|
|
@@ -33236,20 +33284,35 @@ function exactRequest(value, challenge) {
|
|
|
33236
33284
|
if (!["username", "password"].includes(value.credentialRole) || !semanticMatches(value.credentialRole, semantic)) return null;
|
|
33237
33285
|
return { ...value, credentialKey: value.credentialKey.trim(), targetOrigin, authenticationOrigin, controlSemantic: semantic };
|
|
33238
33286
|
}
|
|
33239
|
-
function createBrowserCredentialChannel({ consume }) {
|
|
33287
|
+
function createBrowserCredentialChannel({ consume, onFailure }) {
|
|
33240
33288
|
if (typeof consume !== "function") throw new Error("browser_credential_consumer_required");
|
|
33241
33289
|
const challenge = randomBytes2(32).toString("base64url");
|
|
33242
33290
|
const consumedRefs = /* @__PURE__ */ new Set();
|
|
33243
33291
|
const consumedRequests = [];
|
|
33244
33292
|
const authReceipts = [];
|
|
33245
33293
|
let closed = false;
|
|
33294
|
+
let failed = false;
|
|
33246
33295
|
let requestBuffer = Buffer.alloc(0);
|
|
33247
33296
|
let sequence = Promise.resolve();
|
|
33248
33297
|
let responsePipe = null;
|
|
33298
|
+
const failClosed = () => {
|
|
33299
|
+
if (failed) return;
|
|
33300
|
+
failed = true;
|
|
33301
|
+
closed = true;
|
|
33302
|
+
requestBuffer.fill(0);
|
|
33303
|
+
requestBuffer = Buffer.alloc(0);
|
|
33304
|
+
authReceipts.length = 0;
|
|
33305
|
+
try {
|
|
33306
|
+
responsePipe?.end();
|
|
33307
|
+
} catch {
|
|
33308
|
+
}
|
|
33309
|
+
onFailure?.("browser_credential_private_fd_lost");
|
|
33310
|
+
};
|
|
33249
33311
|
const respondError = (reason) => {
|
|
33250
33312
|
if (!closed && responsePipe?.writable) responsePipe.write(encodeBrowserCredentialFrame("E", Buffer.from(reason, "utf8")));
|
|
33251
33313
|
};
|
|
33252
33314
|
const handleReceipt = (frame) => {
|
|
33315
|
+
if (closed) return;
|
|
33253
33316
|
let receipt;
|
|
33254
33317
|
try {
|
|
33255
33318
|
receipt = JSON.parse(frame.payload.toString("utf8"));
|
|
@@ -33280,6 +33343,7 @@ function createBrowserCredentialChannel({ consume }) {
|
|
|
33280
33343
|
if (authReceipts.length === 0) authReceipts.push(Object.freeze({ ...receipt, credentialRoles: [...new Set(receipt.credentialRoles)].sort() }));
|
|
33281
33344
|
};
|
|
33282
33345
|
const handleFrame = async (frame) => {
|
|
33346
|
+
if (closed) return;
|
|
33283
33347
|
if (frame.type === "A") return handleReceipt(frame);
|
|
33284
33348
|
if (frame.type !== "R" || frame.payload.length > MAX_BYTES3) return respondError("browser_credential_request_invalid");
|
|
33285
33349
|
let decoded;
|
|
@@ -33299,6 +33363,10 @@ function createBrowserCredentialChannel({ consume }) {
|
|
|
33299
33363
|
try {
|
|
33300
33364
|
const value = await consume(request);
|
|
33301
33365
|
bytes = Buffer.isBuffer(value) ? value : Buffer.from(value, "utf8");
|
|
33366
|
+
if (closed) {
|
|
33367
|
+
bytes.fill(0);
|
|
33368
|
+
return;
|
|
33369
|
+
}
|
|
33302
33370
|
if (bytes.length === 0 || bytes.length > MAX_BYTES3) throw new Error("browser_credential_value_invalid");
|
|
33303
33371
|
responseFrame = encodeBrowserCredentialFrame("V", bytes);
|
|
33304
33372
|
responsePipe.write(responseFrame, () => {
|
|
@@ -33316,6 +33384,8 @@ function createBrowserCredentialChannel({ consume }) {
|
|
|
33316
33384
|
const requestPipe = child?.stdio?.[BROWSER_CREDENTIAL_REQUEST_FD];
|
|
33317
33385
|
responsePipe = child?.stdio?.[BROWSER_CREDENTIAL_RESPONSE_FD];
|
|
33318
33386
|
if (!requestPipe?.on || !responsePipe?.write) throw new Error("browser_credential_private_fd_unavailable");
|
|
33387
|
+
requestPipe.on("error", failClosed);
|
|
33388
|
+
responsePipe.on("error", failClosed);
|
|
33319
33389
|
responsePipe.write(encodeBrowserCredentialFrame("C", Buffer.from(challenge, "utf8")));
|
|
33320
33390
|
requestPipe.on("data", (chunk) => {
|
|
33321
33391
|
if (closed) return;
|
|
@@ -33342,6 +33412,7 @@ function createBrowserCredentialChannel({ consume }) {
|
|
|
33342
33412
|
},
|
|
33343
33413
|
async receipts() {
|
|
33344
33414
|
await sequence;
|
|
33415
|
+
if (failed) return [];
|
|
33345
33416
|
return authReceipts.map((receipt) => ({ ...receipt, credentialRoles: [...receipt.credentialRoles] }));
|
|
33346
33417
|
},
|
|
33347
33418
|
close() {
|
|
@@ -33357,7 +33428,7 @@ function createBrowserCredentialChannel({ consume }) {
|
|
|
33357
33428
|
import { existsSync as existsSync12, lstatSync as lstatSync9, readFileSync as readFileSync12, readdirSync as readdirSync8, statSync as statSync6 } from "node:fs";
|
|
33358
33429
|
import { createHash as createHash14 } from "node:crypto";
|
|
33359
33430
|
import { homedir as homedir4 } from "node:os";
|
|
33360
|
-
import { isAbsolute as isAbsolute7, join as join16, relative as relative5, resolve as resolve10 } from "node:path";
|
|
33431
|
+
import { dirname as dirname10, isAbsolute as isAbsolute7, join as join16, relative as relative5, resolve as resolve10 } from "node:path";
|
|
33361
33432
|
var CAPABILITY = "browser_credential_auth_transaction_v1";
|
|
33362
33433
|
var CREDENTIAL_BROWSER_TCB = Object.freeze({
|
|
33363
33434
|
package: "chrome-devtools-mcp",
|
|
@@ -33370,26 +33441,34 @@ var CREDENTIAL_BROWSER_PACKAGE_FILES = Object.freeze({
|
|
|
33370
33441
|
"dist/index.js": "7530da9aaa0ee272fa6e10ff80059f42a45aee6fff8d8c7cbce05c2cb24e180c"
|
|
33371
33442
|
});
|
|
33372
33443
|
var CREDENTIAL_AUTH_EXTENSION_SHA256 = "14088f0a7761a2a0884477ac2f300dcf615e4ba78b7753e4aec8078b344ab9b9";
|
|
33444
|
+
var IMAGE_PI_HOME = "/opt/pi-cli-runtime/.pi";
|
|
33445
|
+
var IMAGE_AUTH_EXTENSION_PATH = join16(IMAGE_PI_HOME, "extensions", "browser-credential-auth.mjs");
|
|
33446
|
+
var BROWSER_AUTH_IMAGE_NODE_PATH = join16(IMAGE_PI_HOME, "npm", "node_modules");
|
|
33373
33447
|
var READINESS_CACHE_TTL_MS = 5e3;
|
|
33374
33448
|
var readinessCache = /* @__PURE__ */ new Map();
|
|
33375
|
-
function inspectBrowserCredentialAuthReadiness(env = process.env, expected = {}) {
|
|
33449
|
+
function inspectBrowserCredentialAuthReadiness(env = process.env, expected = {}, options = {}) {
|
|
33376
33450
|
const home = String(env.PI_CODING_AGENT_DIR ?? env.PI_AGENT_HOME ?? join16(homedir4(), ".pi", "agent")).trim();
|
|
33451
|
+
const packageHome = expected.packageHome ?? IMAGE_PI_HOME;
|
|
33452
|
+
const extensionPath = expected.authExtensionPath ?? IMAGE_AUTH_EXTENSION_PATH;
|
|
33453
|
+
const requireImageOwnership = options.requireImageOwnership !== false;
|
|
33454
|
+
const cacheKey = JSON.stringify([home, packageHome, extensionPath, requireImageOwnership]);
|
|
33377
33455
|
const now = Date.now();
|
|
33378
|
-
const cached = readinessCache.get(
|
|
33379
|
-
if (cached && cached.expiresAt > now) return { ...cached.readiness };
|
|
33456
|
+
const cached = readinessCache.get(cacheKey);
|
|
33457
|
+
if (!options.fresh && cached && cached.expiresAt > now) return { ...cached.readiness };
|
|
33380
33458
|
const candidates = [
|
|
33381
|
-
join16(
|
|
33382
|
-
join16(
|
|
33459
|
+
join16(packageHome, "npm", "node_modules", "@amaster.ai", "pi-browser-use", "package.json"),
|
|
33460
|
+
join16(packageHome, "node_modules", "@amaster.ai", "pi-browser-use", "package.json")
|
|
33383
33461
|
];
|
|
33384
33462
|
const packageAttestation = candidates.map((manifestPath) => attestedPackageManifest(manifestPath, {
|
|
33385
33463
|
browserTcb: expected.browserTcb ?? CREDENTIAL_BROWSER_TCB,
|
|
33386
33464
|
packageFiles: expected.packageFiles ?? CREDENTIAL_BROWSER_PACKAGE_FILES,
|
|
33387
33465
|
authExtensionSha256: expected.authExtensionSha256 ?? CREDENTIAL_AUTH_EXTENSION_SHA256
|
|
33388
|
-
})).find(Boolean) ?? null;
|
|
33466
|
+
}, requireImageOwnership)).find(Boolean) ?? null;
|
|
33389
33467
|
const packageAttested = Boolean(packageAttestation);
|
|
33390
33468
|
const authExtensionAttested = attestedAuthExtension(
|
|
33391
|
-
|
|
33392
|
-
packageAttestation ? expected.authExtensionSha256 ?? CREDENTIAL_AUTH_EXTENSION_SHA256 : null
|
|
33469
|
+
extensionPath,
|
|
33470
|
+
packageAttestation ? expected.authExtensionSha256 ?? CREDENTIAL_AUTH_EXTENSION_SHA256 : null,
|
|
33471
|
+
requireImageOwnership
|
|
33393
33472
|
);
|
|
33394
33473
|
const readiness = {
|
|
33395
33474
|
privateChannel: true,
|
|
@@ -33398,29 +33477,48 @@ function inspectBrowserCredentialAuthReadiness(env = process.env, expected = {})
|
|
|
33398
33477
|
atomicTransaction: packageAttested && authExtensionAttested,
|
|
33399
33478
|
trustedProfileInjection: packageAttested
|
|
33400
33479
|
};
|
|
33401
|
-
readinessCache.set(
|
|
33480
|
+
readinessCache.set(cacheKey, { readiness, expiresAt: now + READINESS_CACHE_TTL_MS });
|
|
33402
33481
|
return { ...readiness };
|
|
33403
33482
|
}
|
|
33404
|
-
function
|
|
33483
|
+
function browserCredentialAuthExtensionArgs(authority, env = process.env, expected = {}, options = {}) {
|
|
33484
|
+
if (!authority) return [];
|
|
33485
|
+
const readiness = inspectBrowserCredentialAuthReadiness(env, expected, { ...options, fresh: true });
|
|
33486
|
+
if (!readiness.atomicTransaction || !readiness.sealedGate) {
|
|
33487
|
+
throw new Error("browser_credential_auth_extension_unavailable");
|
|
33488
|
+
}
|
|
33489
|
+
return ["--extension", expected.authExtensionPath ?? IMAGE_AUTH_EXTENSION_PATH];
|
|
33490
|
+
}
|
|
33491
|
+
function attestedAuthExtension(extensionPath, expectedSha256, requireImageOwnership) {
|
|
33405
33492
|
try {
|
|
33406
33493
|
if (typeof expectedSha256 !== "string" || !/^[a-f0-9]{64}$/u.test(expectedSha256)) return false;
|
|
33407
|
-
|
|
33494
|
+
const extensionStat = lstatSync9(extensionPath);
|
|
33495
|
+
if (!extensionStat.isFile() || extensionStat.isSymbolicLink()) return false;
|
|
33496
|
+
if (requireImageOwnership && !immutableImageFile(extensionPath)) return false;
|
|
33408
33497
|
const source = readFileSync12(extensionPath, "utf8");
|
|
33409
33498
|
return createHash14("sha256").update(source, "utf8").digest("hex") === expectedSha256 && source.includes("BrowserCredentialAuthBroker") && source.includes("browser_authenticate") && source.includes("AMASTER_BROWSER_CREDENTIAL_PRIVATE_CHANNEL");
|
|
33410
33499
|
} catch {
|
|
33411
33500
|
return false;
|
|
33412
33501
|
}
|
|
33413
33502
|
}
|
|
33503
|
+
function immutableImageFile(filePath) {
|
|
33504
|
+
const fileStat = lstatSync9(filePath);
|
|
33505
|
+
if (!fileStat.isFile() || fileStat.isSymbolicLink() || fileStat.uid !== 0 || (fileStat.mode & 18) !== 0) return false;
|
|
33506
|
+
for (let directory = dirname10(filePath); directory !== dirname10(directory); directory = dirname10(directory)) {
|
|
33507
|
+
const parentStat = lstatSync9(directory);
|
|
33508
|
+
if (!parentStat.isDirectory() || parentStat.isSymbolicLink() || parentStat.uid !== 0 || (parentStat.mode & 18) !== 0) return false;
|
|
33509
|
+
}
|
|
33510
|
+
return true;
|
|
33511
|
+
}
|
|
33414
33512
|
function fileSha256(path) {
|
|
33415
33513
|
return createHash14("sha256").update(readFileSync12(path)).digest("hex");
|
|
33416
33514
|
}
|
|
33417
|
-
function treeAttestation(root) {
|
|
33515
|
+
function treeAttestation(root, requireImageOwnership) {
|
|
33418
33516
|
const files = [];
|
|
33419
33517
|
const visit = (directory) => {
|
|
33420
33518
|
for (const entry of readdirSync8(directory, { withFileTypes: true })) {
|
|
33421
33519
|
const path = join16(directory, entry.name);
|
|
33422
33520
|
if (entry.isDirectory()) visit(path);
|
|
33423
|
-
else if (entry.isFile() && !lstatSync9(path).isSymbolicLink()) files.push(path);
|
|
33521
|
+
else if (entry.isFile() && !lstatSync9(path).isSymbolicLink() && (!requireImageOwnership || immutableImageFile(path))) files.push(path);
|
|
33424
33522
|
else throw new Error("browser_credential_tcb_tree_invalid");
|
|
33425
33523
|
}
|
|
33426
33524
|
};
|
|
@@ -33434,8 +33532,9 @@ function treeAttestation(root) {
|
|
|
33434
33532
|
}
|
|
33435
33533
|
return digest2.digest("hex");
|
|
33436
33534
|
}
|
|
33437
|
-
function attestedPackageManifest(manifestPath, expected) {
|
|
33535
|
+
function attestedPackageManifest(manifestPath, expected, requireImageOwnership) {
|
|
33438
33536
|
try {
|
|
33537
|
+
if (requireImageOwnership && !immutableImageFile(manifestPath)) return null;
|
|
33439
33538
|
const manifest = JSON.parse(readFileSync12(manifestPath, "utf8"));
|
|
33440
33539
|
if (manifest?.name !== "@amaster.ai/pi-browser-use") return null;
|
|
33441
33540
|
if (!Array.isArray(manifest.mirrorxCapabilities) || !manifest.mirrorxCapabilities.includes(CAPABILITY)) {
|
|
@@ -33448,14 +33547,16 @@ function attestedPackageManifest(manifestPath, expected) {
|
|
|
33448
33547
|
if (Object.entries(expected.packageFiles).some(([relativePath, sha2563]) => {
|
|
33449
33548
|
const path = resolve10(packageDir, relativePath);
|
|
33450
33549
|
const relativePathFromPackage = relative5(packageDir, path);
|
|
33451
|
-
return !relativePathFromPackage || relativePathFromPackage.startsWith("..") || isAbsolute7(relativePathFromPackage) || !statSync6(path).isFile() || fileSha256(path) !== sha2563;
|
|
33550
|
+
return !relativePathFromPackage || relativePathFromPackage.startsWith("..") || isAbsolute7(relativePathFromPackage) || !statSync6(path).isFile() || requireImageOwnership && !immutableImageFile(path) || fileSha256(path) !== sha2563;
|
|
33452
33551
|
})) return null;
|
|
33453
33552
|
const browserPackageDir = resolve10(packageDir, "..", "..", "chrome-devtools-mcp");
|
|
33454
|
-
const
|
|
33455
|
-
if (
|
|
33553
|
+
const browserManifestPath = join16(browserPackageDir, "package.json");
|
|
33554
|
+
if (requireImageOwnership && !immutableImageFile(browserManifestPath)) return null;
|
|
33555
|
+
const browserPackage = JSON.parse(readFileSync12(browserManifestPath, "utf8"));
|
|
33556
|
+
if (browserPackage.name !== expected.browserTcb.package || browserPackage.version !== expected.browserTcb.version || treeAttestation(join16(browserPackageDir, "build"), requireImageOwnership) !== expected.browserTcb.buildTreeSha256) return null;
|
|
33456
33557
|
const entrypoint = resolve10(packageDir, manifest.main);
|
|
33457
33558
|
const relativeEntrypoint = relative5(packageDir, entrypoint);
|
|
33458
|
-
if (!relativeEntrypoint || relativeEntrypoint.startsWith("..") || isAbsolute7(relativeEntrypoint) || !existsSync12(entrypoint)) return null;
|
|
33559
|
+
if (!relativeEntrypoint || relativeEntrypoint.startsWith("..") || isAbsolute7(relativeEntrypoint) || !existsSync12(entrypoint) || requireImageOwnership && !immutableImageFile(entrypoint)) return null;
|
|
33459
33560
|
return statSync6(entrypoint).isFile() ? {} : null;
|
|
33460
33561
|
} catch {
|
|
33461
33562
|
return null;
|
|
@@ -33493,7 +33594,7 @@ function inspectBrowserCredentialEnvReadiness(env = process.env) {
|
|
|
33493
33594
|
// src/amaster-runtime-daemon/pi-web-search-readiness.mjs
|
|
33494
33595
|
import { lstatSync as lstatSync11, readFileSync as readFileSync14 } from "node:fs";
|
|
33495
33596
|
import { homedir as homedir6 } from "node:os";
|
|
33496
|
-
import { join as join18 } from "node:path";
|
|
33597
|
+
import { isAbsolute as isAbsolute8, join as join18 } from "node:path";
|
|
33497
33598
|
function readRegularJson(path) {
|
|
33498
33599
|
try {
|
|
33499
33600
|
const stat = lstatSync11(path);
|
|
@@ -33504,18 +33605,36 @@ function readRegularJson(path) {
|
|
|
33504
33605
|
return null;
|
|
33505
33606
|
}
|
|
33506
33607
|
}
|
|
33507
|
-
function
|
|
33508
|
-
|
|
33608
|
+
function isRegularFile(path) {
|
|
33609
|
+
try {
|
|
33610
|
+
const stat = lstatSync11(path);
|
|
33611
|
+
return stat.isFile() && !stat.isSymbolicLink();
|
|
33612
|
+
} catch {
|
|
33613
|
+
return false;
|
|
33614
|
+
}
|
|
33615
|
+
}
|
|
33616
|
+
function installedPiWebAccess(env) {
|
|
33617
|
+
const home = String(env["AMASTER-CLI_CODING_AGENT_DIR"] ?? env.PI_CODING_AGENT_DIR ?? env.PI_AGENT_HOME ?? join18(homedir6(), ".pi", "agent")).trim();
|
|
33509
33618
|
const settings = readRegularJson(join18(home, "settings.json"));
|
|
33510
33619
|
const packages = Array.isArray(settings?.packages) ? settings.packages : [];
|
|
33511
|
-
const
|
|
33512
|
-
const providers = settings?.["pi-web-access"]?.providers;
|
|
33513
|
-
if (!configured || !providers || typeof providers !== "object" || Array.isArray(providers) || Object.keys(providers).length === 0) return false;
|
|
33620
|
+
const npmConfigured = packages.some((entry) => typeof entry === "string" && /^npm:@amaster\.ai\/pi-web-access(?:@|$)/u.test(entry));
|
|
33514
33621
|
const manifests = [
|
|
33515
33622
|
join18(home, "npm", "node_modules", "@amaster.ai", "pi-web-access", "package.json"),
|
|
33516
33623
|
join18(home, "node_modules", "@amaster.ai", "pi-web-access", "package.json")
|
|
33517
33624
|
];
|
|
33518
|
-
|
|
33625
|
+
const npmInstalled = npmConfigured && manifests.some((path) => readRegularJson(path)?.name === "@amaster.ai/pi-web-access");
|
|
33626
|
+
const localInstalled = packages.some((entry) => typeof entry === "string" && isAbsolute8(entry) && readRegularJson(join18(entry, "package.json"))?.name === "@amaster.ai/pi-web-access" && readRegularJson(join18(entry, "package.json"))?.pi?.extensions?.includes("./dist/index.js") && isRegularFile(join18(entry, "dist", "index.js")));
|
|
33627
|
+
return { settings, installed: npmInstalled || localInstalled };
|
|
33628
|
+
}
|
|
33629
|
+
function inspectPiWebSearchReadiness(env = process.env) {
|
|
33630
|
+
const { settings, installed } = installedPiWebAccess(env);
|
|
33631
|
+
const providers = settings?.["pi-web-access"]?.providers;
|
|
33632
|
+
return Boolean(installed && providers && typeof providers === "object" && !Array.isArray(providers) && Object.keys(providers).length > 0);
|
|
33633
|
+
}
|
|
33634
|
+
function inspectPiWebFetchReadiness(env = process.env) {
|
|
33635
|
+
const { settings, installed } = installedPiWebAccess(env);
|
|
33636
|
+
const fetch2 = settings?.["pi-web-access"]?.fetch;
|
|
33637
|
+
return Boolean(installed && fetch2?.mode === "direct" && fetch2?.dnsOverHttps === "google");
|
|
33519
33638
|
}
|
|
33520
33639
|
|
|
33521
33640
|
// src/amaster-runtime-daemon/browser-credential-env.mjs
|
|
@@ -33672,7 +33791,7 @@ async function materializeBrowserCredentialEnv(plan, options) {
|
|
|
33672
33791
|
// src/amaster-runtime-daemon/runtime-artifact-upload.mjs
|
|
33673
33792
|
import { createHash as createHash15 } from "node:crypto";
|
|
33674
33793
|
import { closeSync as closeSync4, constants as constants3, fstatSync as fstatSync4, lstatSync as lstatSync12, openSync as openSync4, readFileSync as readFileSync15, realpathSync as realpathSync10 } from "node:fs";
|
|
33675
|
-
import { isAbsolute as
|
|
33794
|
+
import { isAbsolute as isAbsolute9, relative as relative6, resolve as resolve12 } from "node:path";
|
|
33676
33795
|
var SHA256_PATTERN = /^[a-f0-9]{64}$/;
|
|
33677
33796
|
function requiredString2(value, name) {
|
|
33678
33797
|
if (typeof value !== "string" || !value.trim()) throw new Error(`Runtime Artifact ${name} is required`);
|
|
@@ -33685,7 +33804,7 @@ function ownedRelativePath(value) {
|
|
|
33685
33804
|
}
|
|
33686
33805
|
function pathWithin2(candidate, root) {
|
|
33687
33806
|
const rel = relative6(root, candidate);
|
|
33688
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
33807
|
+
return rel === "" || !rel.startsWith("..") && !isAbsolute9(rel);
|
|
33689
33808
|
}
|
|
33690
33809
|
function sameFileSnapshot(left, right) {
|
|
33691
33810
|
return left.dev === right.dev && left.ino === right.ino && left.size === right.size && left.mtimeMs === right.mtimeMs && left.ctimeMs === right.ctimeMs;
|
|
@@ -34051,10 +34170,10 @@ function createRuntimeArtifactIngestQueue({ ingest, onError }) {
|
|
|
34051
34170
|
// src/amaster-runtime-daemon/workspace-guard.mjs
|
|
34052
34171
|
import { createHash as createHash17 } from "node:crypto";
|
|
34053
34172
|
import { existsSync as existsSync13, mkdirSync as mkdirSync11, realpathSync as realpathSync11, statSync as statSync7 } from "node:fs";
|
|
34054
|
-
import { basename as basename6, join as join20, isAbsolute as
|
|
34173
|
+
import { basename as basename6, join as join20, isAbsolute as isAbsolute10, relative as relative7, resolve as resolve13 } from "node:path";
|
|
34055
34174
|
function pathWithin3(candidate, root) {
|
|
34056
34175
|
const rel = relative7(root, candidate);
|
|
34057
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
34176
|
+
return rel === "" || !rel.startsWith("..") && !isAbsolute10(rel);
|
|
34058
34177
|
}
|
|
34059
34178
|
function resolveWorkspaceCwd(config, command) {
|
|
34060
34179
|
const payload = asRecord(command.payload);
|
|
@@ -34291,7 +34410,7 @@ import {
|
|
|
34291
34410
|
unlinkSync as unlinkSync2,
|
|
34292
34411
|
writeFileSync as writeFileSync13
|
|
34293
34412
|
} from "node:fs";
|
|
34294
|
-
import { dirname as
|
|
34413
|
+
import { dirname as dirname11, extname, isAbsolute as isAbsolute11, join as join22, parse as parse4, resolve as resolve15, sep as sep4 } from "node:path";
|
|
34295
34414
|
import { fileURLToPath } from "node:url";
|
|
34296
34415
|
var PRESET_TEMPLATE_MANIFEST_FILE = ".mirrorx-preset-templates.json";
|
|
34297
34416
|
var MAX_PRESET_TEMPLATE_FILES = 256;
|
|
@@ -34326,7 +34445,7 @@ function assertCatalogReadableByExecutor(targetDir, fileNames, identity) {
|
|
|
34326
34445
|
if (!stat.isDirectory() || !modeAllows(stat, identity, 64, 8, 1)) {
|
|
34327
34446
|
throw new Error(`preset_template_executor_path_unreadable: ${current}`);
|
|
34328
34447
|
}
|
|
34329
|
-
const parent =
|
|
34448
|
+
const parent = dirname11(current);
|
|
34330
34449
|
if (parent === current) break;
|
|
34331
34450
|
current = parent;
|
|
34332
34451
|
}
|
|
@@ -34347,7 +34466,7 @@ function hasAllowedTemplateExtension(name) {
|
|
|
34347
34466
|
return ALLOWED_TEMPLATE_EXTENSIONS.has(extname(name).toLowerCase());
|
|
34348
34467
|
}
|
|
34349
34468
|
function validTemplateName(value) {
|
|
34350
|
-
return typeof value === "string" && value.length > 0 && value !== "." && value !== ".." && !value.includes("\0") && !value.includes("/") && !value.includes("\\") && !
|
|
34469
|
+
return typeof value === "string" && value.length > 0 && value !== "." && value !== ".." && !value.includes("\0") && !value.includes("/") && !value.includes("\\") && !isAbsolute11(value) && parse4(value).base === value && hasAllowedTemplateExtension(value);
|
|
34351
34470
|
}
|
|
34352
34471
|
function readManifest(manifestPath, { strict }) {
|
|
34353
34472
|
try {
|
|
@@ -34411,14 +34530,14 @@ function materializeBundledPresetTemplates(input) {
|
|
|
34411
34530
|
}
|
|
34412
34531
|
const manifest = readManifest(join22(sourceDir, PRESET_TEMPLATE_MANIFEST_FILE), { strict: true });
|
|
34413
34532
|
const verifiedFiles = verifiedBundleFiles(sourceDir, manifest);
|
|
34414
|
-
mkdirSync12(
|
|
34533
|
+
mkdirSync12(dirname11(targetDir), { recursive: true, mode: 493 });
|
|
34415
34534
|
const targetStat = lstatIfExists(targetDir);
|
|
34416
34535
|
if (targetStat && (!targetStat.isDirectory() || targetStat.isSymbolicLink())) {
|
|
34417
34536
|
throw new Error("preset_template_target_root_unsafe");
|
|
34418
34537
|
}
|
|
34419
34538
|
mkdirSync12(targetDir, { recursive: true, mode: 493 });
|
|
34420
34539
|
const previousManifest = readManifest(join22(targetDir, PRESET_TEMPLATE_MANIFEST_FILE), { strict: false });
|
|
34421
|
-
const stageDir = mkdtempSync4(join22(
|
|
34540
|
+
const stageDir = mkdtempSync4(join22(dirname11(targetDir), ".mirrorx-preset-templates-"));
|
|
34422
34541
|
try {
|
|
34423
34542
|
for (const file of verifiedFiles) {
|
|
34424
34543
|
const stagedPath = join22(stageDir, file.name);
|
|
@@ -34480,7 +34599,7 @@ function materializeRuntimePresetTemplates(input) {
|
|
|
34480
34599
|
|
|
34481
34600
|
// src/amaster-runtime-daemon/runtime-status-summary.mjs
|
|
34482
34601
|
import { existsSync as existsSync16, readdirSync as readdirSync11, statSync as statSync10 } from "node:fs";
|
|
34483
|
-
import { dirname as
|
|
34602
|
+
import { dirname as dirname12, join as join23, resolve as resolve16 } from "node:path";
|
|
34484
34603
|
function runtimeStatusDirectoryEntries(path) {
|
|
34485
34604
|
try {
|
|
34486
34605
|
return readdirSync11(path, { withFileTypes: true });
|
|
@@ -34562,7 +34681,7 @@ function summarizeRuntimeStatusRecentRun(workdir, manifest) {
|
|
|
34562
34681
|
}
|
|
34563
34682
|
function runtimeStatusOutboxDir(config) {
|
|
34564
34683
|
const statePath = config.AMASTER_DAEMON_STATE_FILE ?? config.daemonStateFile;
|
|
34565
|
-
return join23(
|
|
34684
|
+
return join23(dirname12(stateFilePath({
|
|
34566
34685
|
AMASTER_DAEMON_STATE_FILE: statePath
|
|
34567
34686
|
})), "result-outbox");
|
|
34568
34687
|
}
|
|
@@ -34570,7 +34689,7 @@ function runtimeStatusRunCompletionDir(config) {
|
|
|
34570
34689
|
const explicit = config.AMASTER_RUN_COMPLETION_STATE_DIR ?? config.runCompletionStateDir;
|
|
34571
34690
|
if (typeof explicit === "string" && explicit.trim()) return resolve16(explicit);
|
|
34572
34691
|
const statePath = config.AMASTER_DAEMON_STATE_FILE ?? config.daemonStateFile;
|
|
34573
|
-
return join23(
|
|
34692
|
+
return join23(dirname12(stateFilePath({
|
|
34574
34693
|
AMASTER_DAEMON_STATE_FILE: statePath
|
|
34575
34694
|
})), "run-completion-state");
|
|
34576
34695
|
}
|
|
@@ -34971,7 +35090,7 @@ export default function amasterProjectInstructions(pi) {
|
|
|
34971
35090
|
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
34972
35091
|
import { createHash as createHash19 } from "node:crypto";
|
|
34973
35092
|
import { existsSync as existsSync17, readdirSync as readdirSync12, readFileSync as readFileSync19, statSync as statSync11 } from "node:fs";
|
|
34974
|
-
import { basename as basename7, extname as extname2, isAbsolute as
|
|
35093
|
+
import { basename as basename7, extname as extname2, isAbsolute as isAbsolute12, join as join24, relative as relative8, resolve as resolve18 } from "node:path";
|
|
34975
35094
|
var WORKSPACE_RUNTIME_SERVICES_FILENAME = ".amaster-runtime-services.json";
|
|
34976
35095
|
var ARTIFACT_EXTENSIONS = /* @__PURE__ */ new Map([
|
|
34977
35096
|
[".md", "markdown"],
|
|
@@ -35017,7 +35136,7 @@ var SAFE_RUNTIME_SERVICE_HEALTH_STATUSES = /* @__PURE__ */ new Set(["unknown", "
|
|
|
35017
35136
|
var SAFE_RUNTIME_SERVICE_LIFECYCLES = /* @__PURE__ */ new Set(["shared", "ephemeral"]);
|
|
35018
35137
|
function statusPathWithin(candidate, root) {
|
|
35019
35138
|
const rel = relative8(root, candidate);
|
|
35020
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
35139
|
+
return rel === "" || !rel.startsWith("..") && !isAbsolute12(rel);
|
|
35021
35140
|
}
|
|
35022
35141
|
function normalizeRelativePath(root, filePath) {
|
|
35023
35142
|
return relative8(root, filePath).split(/[\\/]+/).join("/");
|
|
@@ -35272,7 +35391,7 @@ function assertRequiredTaskAttachmentMaterialized(input, materialized) {
|
|
|
35272
35391
|
}
|
|
35273
35392
|
|
|
35274
35393
|
// src/amaster-runtime-daemon.mjs
|
|
35275
|
-
var CONNECTOR_VERSION = "0.1.
|
|
35394
|
+
var CONNECTOR_VERSION = "0.1.13-beta.0";
|
|
35276
35395
|
var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
|
|
35277
35396
|
var SUPPORTED_TASK_CONTEXT_VERSIONS = Object.freeze([TASK_CONTEXT_MANIFEST_VERSION, TASK_CONTEXT_V2]);
|
|
35278
35397
|
var daemonRequire = createRequire(import.meta.url);
|
|
@@ -35384,7 +35503,7 @@ function resultOutboxPendingCount(config) {
|
|
|
35384
35503
|
function runCompletionStateDir(config) {
|
|
35385
35504
|
const explicit = readString(process.env.AMASTER_RUN_COMPLETION_STATE_DIR);
|
|
35386
35505
|
if (explicit) return resolve19(expandHomePath(explicit));
|
|
35387
|
-
return join25(
|
|
35506
|
+
return join25(dirname13(stateFilePath(process.env)), "run-completion-state");
|
|
35388
35507
|
}
|
|
35389
35508
|
function runCompletionStateInvalidDir(config) {
|
|
35390
35509
|
return join25(runCompletionStateDir(config), "invalid");
|
|
@@ -35830,7 +35949,8 @@ function runtimeAdvertisedCapabilities(config) {
|
|
|
35830
35949
|
executors: config.executors,
|
|
35831
35950
|
browserCredentialAuth: inspectBrowserCredentialAuthReadiness(),
|
|
35832
35951
|
browserCredentialEnv: inspectBrowserCredentialEnvReadiness(),
|
|
35833
|
-
piWebSearchReady: inspectPiWebSearchReadiness()
|
|
35952
|
+
piWebSearchReady: inspectPiWebSearchReadiness(),
|
|
35953
|
+
piWebFetchReady: inspectPiWebFetchReadiness()
|
|
35834
35954
|
});
|
|
35835
35955
|
}
|
|
35836
35956
|
function buildRegisterPayload(config) {
|
|
@@ -36722,7 +36842,7 @@ function safeAgentInstructionMaterializationTarget(workspace, filePath) {
|
|
|
36722
36842
|
const raw = readString(filePath);
|
|
36723
36843
|
if (!raw || raw.includes("\0")) return null;
|
|
36724
36844
|
const normalized = raw.replace(/\\/g, "/");
|
|
36725
|
-
if (
|
|
36845
|
+
if (isAbsolute13(normalized)) return null;
|
|
36726
36846
|
const segments = normalized.split("/").filter(Boolean);
|
|
36727
36847
|
if (segments.length === 0 || segments.some((segment) => segment === "." || segment === "..")) return null;
|
|
36728
36848
|
const relativePath = segments.join("/");
|
|
@@ -36812,7 +36932,7 @@ async function materializeEffectiveAgentInstructions(config, command, workspace,
|
|
|
36812
36932
|
}
|
|
36813
36933
|
const target = safeAgentInstructionMaterializationTarget(workspace, filePath);
|
|
36814
36934
|
if (!target) throw new Error(`context_envelope_instruction_path_invalid: ${filePath}`);
|
|
36815
|
-
mkdirSync13(
|
|
36935
|
+
mkdirSync13(dirname13(target.targetPath), { recursive: true });
|
|
36816
36936
|
const temporaryPath = `${target.targetPath}.mirrorx-${command.commandId}.tmp`;
|
|
36817
36937
|
try {
|
|
36818
36938
|
writeFileSync14(temporaryPath, content, { encoding: "utf8", mode: 384 });
|
|
@@ -38221,7 +38341,7 @@ function manifestMatchesActiveRuntimeRef(manifest, refs, workdir = null) {
|
|
|
38221
38341
|
function buildOrphanReaperSample(root, workdir, manifest, residents) {
|
|
38222
38342
|
const relativeWorkdir = (() => {
|
|
38223
38343
|
const value = relative9(root, workdir);
|
|
38224
|
-
return value && !value.startsWith("..") && !
|
|
38344
|
+
return value && !value.startsWith("..") && !isAbsolute13(value) ? value : basename8(workdir);
|
|
38225
38345
|
})();
|
|
38226
38346
|
return {
|
|
38227
38347
|
workdir: relativeWorkdir,
|
|
@@ -38334,7 +38454,14 @@ function runExecutor(command, args, options) {
|
|
|
38334
38454
|
const maxOutputBytes = parsePositiveInteger(options.maxOutputBytes, 50 * 1024 * 1024);
|
|
38335
38455
|
const maxRssMb = parsePositiveInteger(options.maxRssMb, 0);
|
|
38336
38456
|
const maxRssBytes = maxRssMb * 1024 * 1024;
|
|
38337
|
-
const browserCredentialChannel = typeof options.browserCredentialConsumer === "function" ? createBrowserCredentialChannel({
|
|
38457
|
+
const browserCredentialChannel = typeof options.browserCredentialConsumer === "function" ? createBrowserCredentialChannel({
|
|
38458
|
+
consume: options.browserCredentialConsumer,
|
|
38459
|
+
onFailure: (reason) => {
|
|
38460
|
+
spawnError = reason;
|
|
38461
|
+
spawnErrorCode = reason;
|
|
38462
|
+
requestStop(reason);
|
|
38463
|
+
}
|
|
38464
|
+
}) : null;
|
|
38338
38465
|
const childEnv = { ...options.env };
|
|
38339
38466
|
delete childEnv.AMASTER_BROWSER_CREDENTIAL_PRIVATE_CHANNEL;
|
|
38340
38467
|
if (browserCredentialChannel) childEnv.AMASTER_BROWSER_CREDENTIAL_PRIVATE_CHANNEL = "1";
|
|
@@ -38602,8 +38729,8 @@ function runExecutor(command, args, options) {
|
|
|
38602
38729
|
child.stdout.once("end", () => stdoutDecoder.end());
|
|
38603
38730
|
child.stderr.once("end", () => stderrDecoder.end());
|
|
38604
38731
|
child.on("error", (err) => {
|
|
38605
|
-
spawnError = err.message;
|
|
38606
|
-
spawnErrorCode = typeof err.code === "string" ? err.code : null;
|
|
38732
|
+
if (!spawnError) spawnError = err.message;
|
|
38733
|
+
if (!spawnErrorCode) spawnErrorCode = typeof err.code === "string" ? err.code : null;
|
|
38607
38734
|
});
|
|
38608
38735
|
child.on("exit", (code, signal) => {
|
|
38609
38736
|
childExited = true;
|
|
@@ -39184,7 +39311,7 @@ async function completeCommand(config, command, status, result2, error) {
|
|
|
39184
39311
|
function resultOutboxDir(config) {
|
|
39185
39312
|
const explicit = readString(process.env.AMASTER_RESULT_OUTBOX_DIR);
|
|
39186
39313
|
if (explicit) return resolve19(expandHomePath(explicit));
|
|
39187
|
-
return join25(
|
|
39314
|
+
return join25(dirname13(stateFilePath(process.env)), "result-outbox");
|
|
39188
39315
|
}
|
|
39189
39316
|
function resultOutboxInvalidDir(config) {
|
|
39190
39317
|
return join25(resultOutboxDir(config), "invalid");
|
|
@@ -39661,7 +39788,7 @@ async function materializeRequiredArtifactInputs(config, command, workspace) {
|
|
|
39661
39788
|
}
|
|
39662
39789
|
usedPaths.add(relativePath);
|
|
39663
39790
|
const targetPath = join25(workspace.cwd, relativePath);
|
|
39664
|
-
mkdirSync13(
|
|
39791
|
+
mkdirSync13(dirname13(targetPath), { recursive: true });
|
|
39665
39792
|
writeFileSync14(targetPath, body);
|
|
39666
39793
|
chmodSync8(targetPath, 292);
|
|
39667
39794
|
materialized.push({
|
|
@@ -39759,7 +39886,7 @@ async function materializeMentionedArtifactFiles(config, command, workspace) {
|
|
|
39759
39886
|
return { materialized, skipped };
|
|
39760
39887
|
}
|
|
39761
39888
|
function issueCheckpointDir(workspace) {
|
|
39762
|
-
return join25(
|
|
39889
|
+
return join25(dirname13(workspace.runDir), "checkpoint");
|
|
39763
39890
|
}
|
|
39764
39891
|
async function clearIssueCheckpoint(config, command, workspace, reason, consumedSource = null) {
|
|
39765
39892
|
const checkpointDir = issueCheckpointDir(workspace);
|
|
@@ -39781,7 +39908,7 @@ async function clearIssueCheckpoint(config, command, workspace, reason, consumed
|
|
|
39781
39908
|
}
|
|
39782
39909
|
function safeCheckpointRelativePath(rawPath) {
|
|
39783
39910
|
const raw = String(rawPath ?? "").trim();
|
|
39784
|
-
if (
|
|
39911
|
+
if (isAbsolute13(raw) || /^[A-Za-z]:[\\/]/.test(raw)) return null;
|
|
39785
39912
|
const normalized = raw.split(/[\\/]+/).filter(Boolean).join("/");
|
|
39786
39913
|
if (!normalized || normalized.startsWith("../") || normalized.split("/").some((segment) => segment.startsWith("."))) return null;
|
|
39787
39914
|
if (normalized.startsWith("input-attachments/") || isRuntimeMetadataArtifactPath(normalized)) return null;
|
|
@@ -39913,8 +40040,8 @@ async function materializeIssueCheckpoint(config, command, workspace) {
|
|
|
39913
40040
|
}
|
|
39914
40041
|
const materialized = [];
|
|
39915
40042
|
for (const { relativePath, source, target, expectedSha256, expectedByteSize } of validated) {
|
|
39916
|
-
mkdirSync13(
|
|
39917
|
-
const targetParent = realpathSync12(
|
|
40043
|
+
mkdirSync13(dirname13(target), { recursive: true });
|
|
40044
|
+
const targetParent = realpathSync12(dirname13(target));
|
|
39918
40045
|
if (!pathWithin3(targetParent, workspaceRoot)) {
|
|
39919
40046
|
throw new Error(`issue checkpoint target escapes its workspace: ${relativePath}`);
|
|
39920
40047
|
}
|
|
@@ -40021,7 +40148,7 @@ async function saveIssueCheckpoint(config, command, workspace, candidates, optio
|
|
|
40021
40148
|
}
|
|
40022
40149
|
const target = resolve19(filesDir, relativePath);
|
|
40023
40150
|
if (!pathWithin3(target, filesDir)) continue;
|
|
40024
|
-
mkdirSync13(
|
|
40151
|
+
mkdirSync13(dirname13(target), { recursive: true });
|
|
40025
40152
|
copyFileSync2(ownedSource, target);
|
|
40026
40153
|
const storedStat = lstatSync15(target);
|
|
40027
40154
|
if (!storedStat.isFile() || storedStat.size !== byteSize) {
|
|
@@ -40392,7 +40519,7 @@ async function executeRunCommand(config, command) {
|
|
|
40392
40519
|
executorCommand: invocation.command,
|
|
40393
40520
|
executorHome: workspace.executorHome,
|
|
40394
40521
|
runDir: workspace.runDir,
|
|
40395
|
-
runtimeCacheRoot: join25(
|
|
40522
|
+
runtimeCacheRoot: join25(dirname13(config.daemonStateFile), "cache"),
|
|
40396
40523
|
cwd,
|
|
40397
40524
|
runtimeAuth: commandRuntimeAuth(command),
|
|
40398
40525
|
nativeSession: asRecord(asRecord(executionCommand.payload).nativeSession),
|
|
@@ -40463,6 +40590,10 @@ async function executeRunCommand(config, command) {
|
|
|
40463
40590
|
if (executor.kind === "pi" && Array.isArray(managedMcpProfile.extensionArgs) && managedMcpProfile.extensionArgs.length > 0) {
|
|
40464
40591
|
invocation.args = [...invocation.args, ...managedMcpProfile.extensionArgs];
|
|
40465
40592
|
}
|
|
40593
|
+
if (executor.kind === "pi" && browserCredentialAuthority) {
|
|
40594
|
+
invocation.args = [...invocation.args, ...browserCredentialAuthExtensionArgs(browserCredentialAuthority, executorEnv)];
|
|
40595
|
+
executorEnv = { ...executorEnv, NODE_PATH: BROWSER_AUTH_IMAGE_NODE_PATH };
|
|
40596
|
+
}
|
|
40466
40597
|
if (executor.kind === "pi") {
|
|
40467
40598
|
assertManagedPiNonInteractiveInvocation(invocation.args, managedMcpProfile);
|
|
40468
40599
|
}
|
package/dist/amaster-runtime.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { homedir, hostname } from "node:os";
|
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
import { BUILD_SUPPORTED_CAPABILITIES } from "./amaster-runtime-daemon/capability-registry.mjs";
|
|
9
9
|
|
|
10
|
-
const CONNECTOR_VERSION = "0.1.
|
|
10
|
+
const CONNECTOR_VERSION = "0.1.13-beta.0";
|
|
11
11
|
|
|
12
12
|
const CONFIG_KEY_MAP = new Map([
|
|
13
13
|
["server_url", "AMASTER_EMPLOYEE_SERVER_URL"],
|