@amaster.ai/employee-runtime-connector 0.1.1-beta.296 → 0.1.1-beta.298
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.
|
@@ -34380,7 +34380,7 @@ function assertRequiredTaskAttachmentMaterialized(input, materialized) {
|
|
|
34380
34380
|
}
|
|
34381
34381
|
|
|
34382
34382
|
// src/amaster-runtime-daemon.mjs
|
|
34383
|
-
var CONNECTOR_VERSION = "0.1.1-beta.
|
|
34383
|
+
var CONNECTOR_VERSION = "0.1.1-beta.298";
|
|
34384
34384
|
var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
|
|
34385
34385
|
var daemonRequire = createRequire(import.meta.url);
|
|
34386
34386
|
var MAX_CHECKPOINT_BYTES = 20 * 1024 * 1024;
|
|
@@ -35076,8 +35076,13 @@ function piIsolatedChildOwnership(config) {
|
|
|
35076
35076
|
function handoffPiRunPathsToChild(config, paths) {
|
|
35077
35077
|
const ownership = piIsolatedChildOwnership(config);
|
|
35078
35078
|
if (!ownership) return;
|
|
35079
|
+
const allowedRoot = readString(config.runtimeWorkspacesRoot);
|
|
35079
35080
|
for (const path of paths) {
|
|
35080
|
-
if (typeof path
|
|
35081
|
+
if (typeof path !== "string" || !path) continue;
|
|
35082
|
+
if (allowedRoot && !pathWithin3(path, allowedRoot)) {
|
|
35083
|
+
throw new Error("pi_executor_access_path_outside_runtime_root");
|
|
35084
|
+
}
|
|
35085
|
+
makePiRunPathWritable(path, ownership.uid, ownership.gid);
|
|
35081
35086
|
}
|
|
35082
35087
|
}
|
|
35083
35088
|
function writeLocalRuntimeStatus(config, runtimeStatus) {
|
|
@@ -35783,21 +35788,15 @@ function readJsonFile2(filePath) {
|
|
|
35783
35788
|
return {};
|
|
35784
35789
|
}
|
|
35785
35790
|
}
|
|
35786
|
-
|
|
35787
|
-
if (!agentDir) return;
|
|
35791
|
+
function syncPiExecutorProviderConfig(config, agentDir, providerConfig) {
|
|
35792
|
+
if (!agentDir) return null;
|
|
35788
35793
|
const { modelsSynced, settingsSynced } = syncAmasterProviderFiles(agentDir, providerConfig);
|
|
35789
|
-
if (modelsSynced
|
|
35790
|
-
|
|
35791
|
-
|
|
35792
|
-
|
|
35793
|
-
|
|
35794
|
-
|
|
35795
|
-
modelsSynced,
|
|
35796
|
-
settingsSynced,
|
|
35797
|
-
credentialSource: "server_command_env",
|
|
35798
|
-
providerBaseUrlConfigured: Boolean(readString(providerConfig.AMASTER_PROVIDER_BASE_URL))
|
|
35799
|
-
});
|
|
35800
|
-
}
|
|
35794
|
+
if (!modelsSynced && !settingsSynced) return null;
|
|
35795
|
+
handoffPiRunPathsToChild(config, [
|
|
35796
|
+
modelsSynced ? join19(agentDir, "models.json") : null,
|
|
35797
|
+
settingsSynced ? join19(agentDir, "settings.json") : null
|
|
35798
|
+
]);
|
|
35799
|
+
return { modelsSynced, settingsSynced };
|
|
35801
35800
|
}
|
|
35802
35801
|
function normalizeWorkspaceContext(workspace) {
|
|
35803
35802
|
if (typeof workspace === "string") {
|
|
@@ -35949,10 +35948,6 @@ async function materializeEffectiveAgentInstructions(config, command, workspace,
|
|
|
35949
35948
|
agentInstructionRevisionId: readString(instructionContract.revisionId),
|
|
35950
35949
|
agentInstructionContentHash: readString(instructionContract.contentHash)
|
|
35951
35950
|
});
|
|
35952
|
-
await ingestLog(config, command, "system", "info", `Materialized ${materialized.length} agent instruction file(s) into the execution workspace`, {
|
|
35953
|
-
fileCount: materialized.length,
|
|
35954
|
-
files: materialized.map((entry) => entry.path)
|
|
35955
|
-
});
|
|
35956
35951
|
}
|
|
35957
35952
|
return materialized;
|
|
35958
35953
|
}
|
|
@@ -38741,14 +38736,6 @@ async function materializeIssueAttachments(config, command, workspace) {
|
|
|
38741
38736
|
sha256: attachment.sha256 ?? null
|
|
38742
38737
|
}))
|
|
38743
38738
|
});
|
|
38744
|
-
await ingestLog(config, command, "system", "info", `Materialized ${materialized.length} issue attachment(s) into the execution workspace`, {
|
|
38745
|
-
attachmentCount: materialized.length,
|
|
38746
|
-
attachments: materialized.map((attachment) => ({
|
|
38747
|
-
id: attachment.id ?? null,
|
|
38748
|
-
name: attachment.name,
|
|
38749
|
-
path: attachment.relativePath
|
|
38750
|
-
}))
|
|
38751
|
-
});
|
|
38752
38739
|
}
|
|
38753
38740
|
return materialized;
|
|
38754
38741
|
}
|
|
@@ -38832,10 +38819,6 @@ async function materializeRequiredArtifactInputs(config, command, workspace) {
|
|
|
38832
38819
|
writeFileSync12(manifestPath, JSON.stringify(localManifest, null, 2) + "\n");
|
|
38833
38820
|
chmodSync8(manifestPath, 292);
|
|
38834
38821
|
updateWorkspaceManifest(workspaceManifestPath(workspace), { artifactInputManifest: localManifest });
|
|
38835
|
-
await ingestLog(config, command, "system", "info", `Materialized ${materialized.length} required artifact input(s) into the execution workspace`, {
|
|
38836
|
-
artifactInputCount: materialized.length,
|
|
38837
|
-
artifactInputs: localManifest.entries
|
|
38838
|
-
});
|
|
38839
38822
|
return materialized;
|
|
38840
38823
|
}
|
|
38841
38824
|
function issueCheckpointDir(workspace) {
|
|
@@ -38896,7 +38879,7 @@ async function materializeIssueCheckpoint(config, command, workspace) {
|
|
|
38896
38879
|
const checkpointDir = issueCheckpointDir(workspace);
|
|
38897
38880
|
const manifestPath = join19(checkpointDir, "manifest.json");
|
|
38898
38881
|
const expectedContinuation = expectedContinuationCheckpoint(command);
|
|
38899
|
-
const unavailable2 = { files: [], taskSessionRestored: false };
|
|
38882
|
+
const unavailable2 = { files: [], taskSessionRestored: false, checkpointExpiresAt: null };
|
|
38900
38883
|
if (!existsSync18(manifestPath)) {
|
|
38901
38884
|
if (expectedContinuation) throw new Error("continuation_checkpoint_unavailable: manifest_missing");
|
|
38902
38885
|
return unavailable2;
|
|
@@ -39003,13 +38986,11 @@ async function materializeIssueCheckpoint(config, command, workspace) {
|
|
|
39003
38986
|
}
|
|
39004
38987
|
materialized.push(relativePath);
|
|
39005
38988
|
}
|
|
39006
|
-
|
|
39007
|
-
|
|
39008
|
-
|
|
39009
|
-
|
|
39010
|
-
|
|
39011
|
-
}
|
|
39012
|
-
return { files: materialized, taskSessionRestored };
|
|
38989
|
+
return {
|
|
38990
|
+
files: materialized,
|
|
38991
|
+
taskSessionRestored,
|
|
38992
|
+
checkpointExpiresAt: new Date(expiresAt).toISOString()
|
|
38993
|
+
};
|
|
39013
38994
|
} catch (restoreErr) {
|
|
39014
38995
|
try {
|
|
39015
38996
|
await clearIssueCheckpoint(config, command, workspace, "restore_failed");
|
|
@@ -39178,6 +39159,10 @@ async function ackCommand(config, command, phase = "preparing") {
|
|
|
39178
39159
|
}
|
|
39179
39160
|
async function executeRunCommand(config, command) {
|
|
39180
39161
|
const preparationStartedAtMs = Date.now();
|
|
39162
|
+
let preparationLogChain = Promise.resolve();
|
|
39163
|
+
const enqueuePreparationLog = (stream, level, message, payload = {}) => {
|
|
39164
|
+
preparationLogChain = preparationLogChain.then(() => ingestLog(config, command, stream, level, message, payload)).catch(() => void 0);
|
|
39165
|
+
};
|
|
39181
39166
|
const executor = selectExecutor(config, command);
|
|
39182
39167
|
const governedMcp = asRecord(commandRuntimeAuth(command).governedMcp);
|
|
39183
39168
|
if (Array.isArray(command.requiredCapabilities) && command.requiredCapabilities.includes("runtime_actions_v2") && (Object.keys(governedMcp).length === 0 || !MIRRORX_FORMAL_TASK_EXECUTOR_KINDS.includes(executor.kind) || readString(governedMcp.executorKind) !== executor.kind)) {
|
|
@@ -39192,6 +39177,12 @@ async function executeRunCommand(config, command) {
|
|
|
39192
39177
|
workspace,
|
|
39193
39178
|
contextContract.instructions
|
|
39194
39179
|
);
|
|
39180
|
+
if (materializedAgentInstructions.length > 0) {
|
|
39181
|
+
enqueuePreparationLog("system", "info", `Materialized ${materializedAgentInstructions.length} agent instruction file(s) into the execution workspace`, {
|
|
39182
|
+
fileCount: materializedAgentInstructions.length,
|
|
39183
|
+
files: materializedAgentInstructions.map((entry) => entry.path)
|
|
39184
|
+
});
|
|
39185
|
+
}
|
|
39195
39186
|
const workspaceProjectInstructionReceipt = projectExternalWorkspaceProjectInstructions(
|
|
39196
39187
|
workspace.sourceWorkspacePath,
|
|
39197
39188
|
workspace.cwd,
|
|
@@ -39214,6 +39205,12 @@ async function executeRunCommand(config, command) {
|
|
|
39214
39205
|
workspaceProjectInstructionProjection: workspaceProjectInstructionReceipt
|
|
39215
39206
|
});
|
|
39216
39207
|
const restoredCheckpoint = await materializeIssueCheckpoint(config, command, workspace);
|
|
39208
|
+
if (restoredCheckpoint.files.length > 0) {
|
|
39209
|
+
enqueuePreparationLog("system", "info", `Materialized ${restoredCheckpoint.files.length} checkpoint file(s) into the execution workspace`, {
|
|
39210
|
+
checkpointFiles: restoredCheckpoint.files,
|
|
39211
|
+
checkpointExpiresAt: restoredCheckpoint.checkpointExpiresAt
|
|
39212
|
+
});
|
|
39213
|
+
}
|
|
39217
39214
|
const materializedCheckpointFiles = restoredCheckpoint.files;
|
|
39218
39215
|
const requestedNativeSession = asRecord(asRecord(command.payload).nativeSession);
|
|
39219
39216
|
const taskSessionCheckpointUnavailable = Object.keys(governedMcp).length > 0 && requestedNativeSession.mode === "task_session" && !expectedContinuationCheckpoint(command) && !restoredCheckpoint.taskSessionRestored;
|
|
@@ -39222,17 +39219,34 @@ async function executeRunCommand(config, command) {
|
|
|
39222
39219
|
}
|
|
39223
39220
|
const executionCommand = taskSessionCheckpointUnavailable ? { ...command, payload: { ...asRecord(command.payload), nativeSession: void 0 } } : command;
|
|
39224
39221
|
if (taskSessionCheckpointUnavailable) {
|
|
39225
|
-
|
|
39222
|
+
enqueuePreparationLog("system", "info", "Starting fresh: no exact task-session workspace checkpoint is available", {
|
|
39226
39223
|
skippedReason: "native_session_checkpoint_unavailable"
|
|
39227
39224
|
});
|
|
39228
39225
|
}
|
|
39229
39226
|
const requiredArtifactInputs = await materializeRequiredArtifactInputs(config, command, workspace);
|
|
39227
|
+
if (requiredArtifactInputs.length > 0) {
|
|
39228
|
+
enqueuePreparationLog("system", "info", `Materialized ${requiredArtifactInputs.length} required artifact input(s) into the execution workspace`, {
|
|
39229
|
+
artifactInputCount: requiredArtifactInputs.length,
|
|
39230
|
+
artifactInputs: requiredArtifactInputs.map(({ path: _path, relativePath, ...entry }) => ({ ...entry, path: relativePath }))
|
|
39231
|
+
});
|
|
39232
|
+
}
|
|
39230
39233
|
let materializedAttachments = requiredArtifactInputs;
|
|
39231
39234
|
try {
|
|
39232
|
-
|
|
39235
|
+
const issueAttachments = await materializeIssueAttachments(config, command, workspace);
|
|
39236
|
+
if (issueAttachments.length > 0) {
|
|
39237
|
+
enqueuePreparationLog("system", "info", `Materialized ${issueAttachments.length} issue attachment(s) into the execution workspace`, {
|
|
39238
|
+
attachmentCount: issueAttachments.length,
|
|
39239
|
+
attachments: issueAttachments.map((attachment) => ({
|
|
39240
|
+
id: attachment.id ?? null,
|
|
39241
|
+
name: attachment.name,
|
|
39242
|
+
path: attachment.relativePath
|
|
39243
|
+
}))
|
|
39244
|
+
});
|
|
39245
|
+
}
|
|
39246
|
+
materializedAttachments = [...requiredArtifactInputs, ...issueAttachments];
|
|
39233
39247
|
} catch (err) {
|
|
39234
39248
|
if (issueAttachmentsAreRequired(command, commandTaskResourceInput(command))) throw err;
|
|
39235
|
-
|
|
39249
|
+
enqueuePreparationLog("system", "warn", `Failed to materialize issue attachments: ${err instanceof Error ? err.message : String(err)}`, {
|
|
39236
39250
|
error: err instanceof Error ? err.message : String(err)
|
|
39237
39251
|
});
|
|
39238
39252
|
}
|
|
@@ -39256,10 +39270,6 @@ async function executeRunCommand(config, command) {
|
|
|
39256
39270
|
let completionOwnsManagedMcpProfile = false;
|
|
39257
39271
|
const trustedPiRuntimeAssertion = commandTrustedPiRuntimeAssertion(command);
|
|
39258
39272
|
const preparationStages = [];
|
|
39259
|
-
let preparationLogChain = Promise.resolve();
|
|
39260
|
-
const enqueuePreparationLog = (stream, level, message, payload = {}) => {
|
|
39261
|
-
preparationLogChain = preparationLogChain.then(() => ingestLog(config, command, stream, level, message, payload)).catch(() => void 0);
|
|
39262
|
-
};
|
|
39263
39273
|
const runExecutionStage = (phase, operation) => {
|
|
39264
39274
|
const startedAtMs = Date.now();
|
|
39265
39275
|
const recordDuration = () => preparationStages.push({
|
|
@@ -39452,12 +39462,19 @@ async function executeRunCommand(config, command) {
|
|
|
39452
39462
|
agentDir = null;
|
|
39453
39463
|
}
|
|
39454
39464
|
try {
|
|
39455
|
-
await runExecutionStage("provider_config", () => syncPiExecutorProviderConfig(
|
|
39465
|
+
const providerSync = await runExecutionStage("provider_config", () => syncPiExecutorProviderConfig(
|
|
39456
39466
|
config,
|
|
39457
|
-
command,
|
|
39458
39467
|
agentDir,
|
|
39459
39468
|
piResolvedProviderConfig
|
|
39460
39469
|
));
|
|
39470
|
+
if (providerSync) {
|
|
39471
|
+
enqueuePreparationLog("system", "info", "Synced AMaster provider config for pi executor", {
|
|
39472
|
+
modelsSynced: providerSync.modelsSynced,
|
|
39473
|
+
settingsSynced: providerSync.settingsSynced,
|
|
39474
|
+
credentialSource: "server_command_env",
|
|
39475
|
+
providerBaseUrlConfigured: Boolean(readString(piResolvedProviderConfig.AMASTER_PROVIDER_BASE_URL))
|
|
39476
|
+
});
|
|
39477
|
+
}
|
|
39461
39478
|
} catch (error2) {
|
|
39462
39479
|
if (managedMcpProfile && cleanupManagedMcpProfile) {
|
|
39463
39480
|
cleanupManagedMcpProfile(managedMcpProfile, {
|
|
@@ -39605,7 +39622,6 @@ async function executeRunCommand(config, command) {
|
|
|
39605
39622
|
currentRunContractShadow: contextManifest.currentRunContractShadow
|
|
39606
39623
|
});
|
|
39607
39624
|
}
|
|
39608
|
-
await preparationLogChain;
|
|
39609
39625
|
await ackCommand(config, command, "spawned");
|
|
39610
39626
|
enqueuePreparationLog("system", "info", `Starting ${executor.kind} executor`, {
|
|
39611
39627
|
executorKind: executor.kind,
|
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.1-beta.
|
|
10
|
+
const CONNECTOR_VERSION = "0.1.1-beta.298";
|
|
11
11
|
|
|
12
12
|
const CONFIG_KEY_MAP = new Map([
|
|
13
13
|
["server_url", "AMASTER_EMPLOYEE_SERVER_URL"],
|