@amaster.ai/employee-runtime-connector 0.1.0-beta.45 → 0.1.0-beta.46

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.
@@ -1876,6 +1876,8 @@ var piManagedMcpProfileApi = (() => {
1876
1876
  const PROFILE_MARKER2 = ".amaster-managed-pi-profile.json";
1877
1877
  const SESSION_ROLLOUT_MARKER2 = ".amaster-pi-session-rollout.json";
1878
1878
  const DEFAULT_SESSION_ROLLOUT_TTL_MS2 = 24 * 60 * 60 * 1e3;
1879
+ const PI_ATTESTATION_TIMEOUT_MS = 1e4;
1880
+ const PI_ATTESTATION_MAX_ATTEMPTS = 2;
1879
1881
  function record4(value) {
1880
1882
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
1881
1883
  }
@@ -2210,15 +2212,25 @@ var piManagedMcpProfileApi = (() => {
2210
2212
  return { adapterVersion, protectedValues };
2211
2213
  }
2212
2214
  function attestPi(executorCommand, env, configPath, expectedConfig) {
2213
- const result2 = spawnSync2(executorCommand, ["--version"], {
2214
- cwd: env.AMASTER_RUNTIME_EXECUTION_WORKDIR,
2215
- env,
2216
- encoding: "utf8",
2217
- timeout: 1e4,
2218
- maxBuffer: 1024 * 1024
2219
- });
2220
- if (result2.error || result2.status !== 0) {
2221
- throw new Error(`pi_managed_mcp_attestation_failed: --version exit=${result2.status ?? "spawn_error"}`);
2215
+ let result2;
2216
+ for (let attempt = 1; attempt <= PI_ATTESTATION_MAX_ATTEMPTS; attempt += 1) {
2217
+ result2 = spawnSync2(executorCommand, ["--version"], {
2218
+ cwd: env.AMASTER_RUNTIME_EXECUTION_WORKDIR,
2219
+ env,
2220
+ encoding: "utf8",
2221
+ timeout: PI_ATTESTATION_TIMEOUT_MS,
2222
+ killSignal: "SIGKILL",
2223
+ maxBuffer: 1024 * 1024
2224
+ });
2225
+ if (result2.error?.code === "ETIMEDOUT" && attempt < PI_ATTESTATION_MAX_ATTEMPTS) continue;
2226
+ break;
2227
+ }
2228
+ if (result2.error) {
2229
+ const errorCode = typeof result2.error.code === "string" ? result2.error.code : "UNKNOWN";
2230
+ throw new Error(`pi_managed_mcp_attestation_failed: --version error=${errorCode}`);
2231
+ }
2232
+ if (result2.status !== 0) {
2233
+ throw new Error(`pi_managed_mcp_attestation_failed: --version exit=${result2.status ?? "unknown"}`);
2222
2234
  }
2223
2235
  const executorVersion = parseVersion(`${result2.stdout ?? ""}
2224
2236
  ${result2.stderr ?? ""}`, "Pi", MINIMUM_PI_VERSION);
@@ -3793,6 +3805,16 @@ function classifyPiTerminalCleanupDisposition(parsed, runtimeArtifacts) {
3793
3805
  diagnostics
3794
3806
  };
3795
3807
  }
3808
+ function classifyPiTurnLimitResult(parsed) {
3809
+ const stopReason = readString(parsed?.stopReason);
3810
+ if (parsed?.terminalEventType !== "agent_end" || !["toolUse", "tool_use"].includes(stopReason ?? "")) return null;
3811
+ return {
3812
+ errorCode: "max_turns_exhausted",
3813
+ errorFamily: "execution_limit",
3814
+ stopReason: "max_turns_exhausted",
3815
+ message: "Pi Agent exhausted its turn limit while waiting to continue tool work"
3816
+ };
3817
+ }
3796
3818
  function codexMcpToolResults(event) {
3797
3819
  if (event?.type !== "item.completed") return [];
3798
3820
  const item = asRecord(event.item);
@@ -6231,7 +6253,7 @@ function readWorkspaceStatus(cwd, opts = {}) {
6231
6253
  }
6232
6254
 
6233
6255
  // src/amaster-runtime-daemon.mjs
6234
- var CONNECTOR_VERSION = "0.1.0-beta.45";
6256
+ var CONNECTOR_VERSION = "0.1.0-beta.46";
6235
6257
  var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
6236
6258
  var MAX_CHECKPOINT_BYTES = 20 * 1024 * 1024;
6237
6259
  var CHECKPOINT_TTL_MS = 24 * 60 * 60 * 1e3;
@@ -9801,12 +9823,13 @@ async function executeRunCommand(config, command) {
9801
9823
  );
9802
9824
  }
9803
9825
  const parsedForValidation = cleanupDisposition ? { ...parsed, errorMessage: null } : parsed;
9826
+ const piTurnLimitFailure = executor.kind === "pi" && !cancelled && !hasOutputFlood && !hasMemoryLimit && execution.timedOut !== true && !execution.spawnError ? classifyPiTurnLimitResult(parsedForValidation) : null;
9804
9827
  const piInvalidOutputError = executor.kind === "pi" ? piOutputValidationError(parsedForValidation, {
9805
9828
  allowMissingTurnEnd: completionOutputStopped || Boolean(cleanupDisposition),
9806
9829
  allowMissingAssistantOutput: execution.completionOutputType === "approval_required"
9807
9830
  }) : null;
9808
9831
  const piProviderFailure = executor.kind === "pi" && !cancelled && !hasOutputFlood && !hasMemoryLimit && execution.timedOut !== true && !execution.spawnError ? classifyPiProviderError(parsedForValidation) : null;
9809
- const parsedErrorMessage = outputFloodError ?? memoryLimitError ?? piInvalidOutputError ?? nativeSessionRolloutError ?? nativeSessionRolloutCleanupError ?? parsedForValidation.errorMessage;
9832
+ const parsedErrorMessage = outputFloodError ?? memoryLimitError ?? piTurnLimitFailure?.message ?? piInvalidOutputError ?? nativeSessionRolloutError ?? nativeSessionRolloutCleanupError ?? parsedForValidation.errorMessage;
9810
9833
  const codexTransientFailure = executor.kind === "codex" && (execution.exitCode ?? 0) !== 0 ? classifyCodexTransientUpstreamError({
9811
9834
  stdout: execution.stdout,
9812
9835
  stderr: execution.stderr,
@@ -9882,10 +9905,15 @@ async function executeRunCommand(config, command) {
9882
9905
  ...Array.isArray(execution.killedWorkspaceResidents) && execution.killedWorkspaceResidents.length > 0 ? {
9883
9906
  killedWorkspaceResidents: execution.killedWorkspaceResidents
9884
9907
  } : {},
9885
- ...piInvalidOutputError && !cancelled && !hasOutputFlood && !hasMemoryLimit && execution.timedOut !== true && !execution.spawnError && !piProviderFailure ? {
9908
+ ...piInvalidOutputError && !cancelled && !hasOutputFlood && !hasMemoryLimit && execution.timedOut !== true && !execution.spawnError && !piTurnLimitFailure && !piProviderFailure ? {
9886
9909
  errorCode: "pi_executor_invalid_output",
9887
9910
  errorFamily: "validation"
9888
9911
  } : {},
9912
+ ...piTurnLimitFailure ? {
9913
+ errorCode: piTurnLimitFailure.errorCode,
9914
+ errorFamily: piTurnLimitFailure.errorFamily,
9915
+ stopReason: piTurnLimitFailure.stopReason
9916
+ } : {},
9889
9917
  ...piProviderFailure ? piProviderFailure : {},
9890
9918
  ...codexTransientFailure ? codexTransientFailure : {},
9891
9919
  ...piUsageDiagnostic && !piInvalidOutputError ? {
@@ -5,7 +5,7 @@ import { dirname, join, resolve } from "node:path";
5
5
  import { homedir, hostname } from "node:os";
6
6
  import { fileURLToPath } from "node:url";
7
7
 
8
- const CONNECTOR_VERSION = "0.1.0-beta.45";
8
+ const CONNECTOR_VERSION = "0.1.0-beta.46";
9
9
 
10
10
  const CAPABILITIES = [
11
11
  "remote_registration",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amaster.ai/employee-runtime-connector",
3
- "version": "0.1.0-beta.45",
3
+ "version": "0.1.0-beta.46",
4
4
  "description": "MirrorX runtime connector CLI and daemon",
5
5
  "license": "MIT",
6
6
  "type": "module",