@amaster.ai/employee-runtime-connector 0.1.1-beta.297 → 0.1.1-beta.299

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.
@@ -6,6 +6,17 @@ var __export = (target, all) => {
6
6
  __defProp(target, name, { get: all[name], enumerable: true });
7
7
  };
8
8
 
9
+ // src/amaster-runtime-daemon/audit-context.mjs
10
+ function withAuditCorrelationEnvironment(environment, command) {
11
+ const env = { ...environment };
12
+ delete env.MIRRORX_AUDIT_CORRELATION_ID;
13
+ const id = command?.auditContext?.correlationId;
14
+ if (typeof id === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(id)) {
15
+ env.MIRRORX_AUDIT_CORRELATION_ID = id;
16
+ }
17
+ return env;
18
+ }
19
+
9
20
  // src/amaster-runtime-daemon.mjs
10
21
  import { createHash as createHash19, randomUUID } from "node:crypto";
11
22
  import { createRequire } from "node:module";
@@ -34380,7 +34391,7 @@ function assertRequiredTaskAttachmentMaterialized(input, materialized) {
34380
34391
  }
34381
34392
 
34382
34393
  // src/amaster-runtime-daemon.mjs
34383
- var CONNECTOR_VERSION = "0.1.1-beta.297";
34394
+ var CONNECTOR_VERSION = "0.1.1-beta.299";
34384
34395
  var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
34385
34396
  var daemonRequire = createRequire(import.meta.url);
34386
34397
  var MAX_CHECKPOINT_BYTES = 20 * 1024 * 1024;
@@ -35791,12 +35802,11 @@ function readJsonFile2(filePath) {
35791
35802
  function syncPiExecutorProviderConfig(config, agentDir, providerConfig) {
35792
35803
  if (!agentDir) return null;
35793
35804
  const { modelsSynced, settingsSynced } = syncAmasterProviderFiles(agentDir, providerConfig);
35794
- if (modelsSynced || settingsSynced) {
35795
- handoffPiRunPathsToChild(config, [
35796
- modelsSynced ? join19(agentDir, "models.json") : null,
35797
- settingsSynced ? join19(agentDir, "settings.json") : null
35798
- ]);
35799
- }
35805
+ if (!modelsSynced && !settingsSynced) return null;
35806
+ handoffPiRunPathsToChild(config, [
35807
+ modelsSynced ? join19(agentDir, "models.json") : null,
35808
+ settingsSynced ? join19(agentDir, "settings.json") : null
35809
+ ]);
35800
35810
  return { modelsSynced, settingsSynced };
35801
35811
  }
35802
35812
  function normalizeWorkspaceContext(workspace) {
@@ -35949,10 +35959,6 @@ async function materializeEffectiveAgentInstructions(config, command, workspace,
35949
35959
  agentInstructionRevisionId: readString(instructionContract.revisionId),
35950
35960
  agentInstructionContentHash: readString(instructionContract.contentHash)
35951
35961
  });
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
35962
  }
35957
35963
  return materialized;
35958
35964
  }
@@ -38741,14 +38747,6 @@ async function materializeIssueAttachments(config, command, workspace) {
38741
38747
  sha256: attachment.sha256 ?? null
38742
38748
  }))
38743
38749
  });
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
38750
  }
38753
38751
  return materialized;
38754
38752
  }
@@ -38832,10 +38830,6 @@ async function materializeRequiredArtifactInputs(config, command, workspace) {
38832
38830
  writeFileSync12(manifestPath, JSON.stringify(localManifest, null, 2) + "\n");
38833
38831
  chmodSync8(manifestPath, 292);
38834
38832
  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
38833
  return materialized;
38840
38834
  }
38841
38835
  function issueCheckpointDir(workspace) {
@@ -38896,7 +38890,7 @@ async function materializeIssueCheckpoint(config, command, workspace) {
38896
38890
  const checkpointDir = issueCheckpointDir(workspace);
38897
38891
  const manifestPath = join19(checkpointDir, "manifest.json");
38898
38892
  const expectedContinuation = expectedContinuationCheckpoint(command);
38899
- const unavailable2 = { files: [], taskSessionRestored: false };
38893
+ const unavailable2 = { files: [], taskSessionRestored: false, checkpointExpiresAt: null };
38900
38894
  if (!existsSync18(manifestPath)) {
38901
38895
  if (expectedContinuation) throw new Error("continuation_checkpoint_unavailable: manifest_missing");
38902
38896
  return unavailable2;
@@ -39003,13 +38997,11 @@ async function materializeIssueCheckpoint(config, command, workspace) {
39003
38997
  }
39004
38998
  materialized.push(relativePath);
39005
38999
  }
39006
- if (materialized.length > 0) {
39007
- await ingestLog(config, command, "system", "info", `Materialized ${materialized.length} checkpoint file(s) into the execution workspace`, {
39008
- checkpointFiles: materialized,
39009
- checkpointExpiresAt: new Date(expiresAt).toISOString()
39010
- });
39011
- }
39012
- return { files: materialized, taskSessionRestored };
39000
+ return {
39001
+ files: materialized,
39002
+ taskSessionRestored,
39003
+ checkpointExpiresAt: new Date(expiresAt).toISOString()
39004
+ };
39013
39005
  } catch (restoreErr) {
39014
39006
  try {
39015
39007
  await clearIssueCheckpoint(config, command, workspace, "restore_failed");
@@ -39196,6 +39188,12 @@ async function executeRunCommand(config, command) {
39196
39188
  workspace,
39197
39189
  contextContract.instructions
39198
39190
  );
39191
+ if (materializedAgentInstructions.length > 0) {
39192
+ enqueuePreparationLog("system", "info", `Materialized ${materializedAgentInstructions.length} agent instruction file(s) into the execution workspace`, {
39193
+ fileCount: materializedAgentInstructions.length,
39194
+ files: materializedAgentInstructions.map((entry) => entry.path)
39195
+ });
39196
+ }
39199
39197
  const workspaceProjectInstructionReceipt = projectExternalWorkspaceProjectInstructions(
39200
39198
  workspace.sourceWorkspacePath,
39201
39199
  workspace.cwd,
@@ -39218,6 +39216,12 @@ async function executeRunCommand(config, command) {
39218
39216
  workspaceProjectInstructionProjection: workspaceProjectInstructionReceipt
39219
39217
  });
39220
39218
  const restoredCheckpoint = await materializeIssueCheckpoint(config, command, workspace);
39219
+ if (restoredCheckpoint.files.length > 0) {
39220
+ enqueuePreparationLog("system", "info", `Materialized ${restoredCheckpoint.files.length} checkpoint file(s) into the execution workspace`, {
39221
+ checkpointFiles: restoredCheckpoint.files,
39222
+ checkpointExpiresAt: restoredCheckpoint.checkpointExpiresAt
39223
+ });
39224
+ }
39221
39225
  const materializedCheckpointFiles = restoredCheckpoint.files;
39222
39226
  const requestedNativeSession = asRecord(asRecord(command.payload).nativeSession);
39223
39227
  const taskSessionCheckpointUnavailable = Object.keys(governedMcp).length > 0 && requestedNativeSession.mode === "task_session" && !expectedContinuationCheckpoint(command) && !restoredCheckpoint.taskSessionRestored;
@@ -39231,9 +39235,26 @@ async function executeRunCommand(config, command) {
39231
39235
  });
39232
39236
  }
39233
39237
  const requiredArtifactInputs = await materializeRequiredArtifactInputs(config, command, workspace);
39238
+ if (requiredArtifactInputs.length > 0) {
39239
+ enqueuePreparationLog("system", "info", `Materialized ${requiredArtifactInputs.length} required artifact input(s) into the execution workspace`, {
39240
+ artifactInputCount: requiredArtifactInputs.length,
39241
+ artifactInputs: requiredArtifactInputs.map(({ path: _path, relativePath, ...entry }) => ({ ...entry, path: relativePath }))
39242
+ });
39243
+ }
39234
39244
  let materializedAttachments = requiredArtifactInputs;
39235
39245
  try {
39236
- materializedAttachments = [...requiredArtifactInputs, ...await materializeIssueAttachments(config, command, workspace)];
39246
+ const issueAttachments = await materializeIssueAttachments(config, command, workspace);
39247
+ if (issueAttachments.length > 0) {
39248
+ enqueuePreparationLog("system", "info", `Materialized ${issueAttachments.length} issue attachment(s) into the execution workspace`, {
39249
+ attachmentCount: issueAttachments.length,
39250
+ attachments: issueAttachments.map((attachment) => ({
39251
+ id: attachment.id ?? null,
39252
+ name: attachment.name,
39253
+ path: attachment.relativePath
39254
+ }))
39255
+ });
39256
+ }
39257
+ materializedAttachments = [...requiredArtifactInputs, ...issueAttachments];
39237
39258
  } catch (err) {
39238
39259
  if (issueAttachmentsAreRequired(command, commandTaskResourceInput(command))) throw err;
39239
39260
  enqueuePreparationLog("system", "warn", `Failed to materialize issue attachments: ${err instanceof Error ? err.message : String(err)}`, {
@@ -39441,6 +39462,7 @@ async function executeRunCommand(config, command) {
39441
39462
  ...managedMcpProfile.attestation
39442
39463
  });
39443
39464
  }
39465
+ executorEnv = withAuditCorrelationEnvironment(executorEnv, command);
39444
39466
  if (Object.keys(trustedPiRuntimeAssertion).length > 0) {
39445
39467
  throw new Error("pi_trusted_runtime_unsupported");
39446
39468
  }
@@ -39457,7 +39479,7 @@ async function executeRunCommand(config, command) {
39457
39479
  agentDir,
39458
39480
  piResolvedProviderConfig
39459
39481
  ));
39460
- if (providerSync && (providerSync.modelsSynced || providerSync.settingsSynced)) {
39482
+ if (providerSync) {
39461
39483
  enqueuePreparationLog("system", "info", "Synced AMaster provider config for pi executor", {
39462
39484
  modelsSynced: providerSync.modelsSynced,
39463
39485
  settingsSynced: providerSync.settingsSynced,
@@ -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.297";
10
+ const CONNECTOR_VERSION = "0.1.1-beta.299";
11
11
 
12
12
  const CONFIG_KEY_MAP = new Map([
13
13
  ["server_url", "AMASTER_EMPLOYEE_SERVER_URL"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amaster.ai/employee-runtime-connector",
3
- "version": "0.1.1-beta.297",
3
+ "version": "0.1.1-beta.299",
4
4
  "description": "MirrorX runtime connector CLI and daemon",
5
5
  "license": "MIT",
6
6
  "type": "module",