@amaster.ai/employee-runtime-connector 0.1.1-beta.134 → 0.1.1-beta.136

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.
@@ -21600,14 +21600,36 @@ var BENIGN_EMPTY_STDIN_CLOSE_ERROR_CODES = /* @__PURE__ */ new Set([
21600
21600
  "EPIPE",
21601
21601
  "ERR_STREAM_DESTROYED"
21602
21602
  ]);
21603
- function closeExecutorStdin(stdin, input, onDeliveryError) {
21603
+ function executorStdinDeliveryFallback(input) {
21604
+ if (!input) return null;
21605
+ const error = new Error("executor stdin closed before delivery completed");
21606
+ error.code = "EPIPE";
21607
+ return error;
21608
+ }
21609
+ function deliverExecutorStdin(stream, input, onSettled) {
21604
21610
  const hasInput = Boolean(input);
21605
- stdin.once("error", (error) => {
21606
- if (!hasInput && BENIGN_EMPTY_STDIN_CLOSE_ERROR_CODES.has(error?.code)) return;
21607
- onDeliveryError(error);
21611
+ let settled = false;
21612
+ const settle = (error) => {
21613
+ if (settled) return;
21614
+ settled = true;
21615
+ if (!hasInput && BENIGN_EMPTY_STDIN_CLOSE_ERROR_CODES.has(error?.code)) {
21616
+ onSettled(null);
21617
+ return;
21618
+ }
21619
+ onSettled(error ?? null);
21620
+ };
21621
+ stream.on("error", settle);
21622
+ stream.once("finish", () => settle(null));
21623
+ stream.once("close", () => {
21624
+ if (stream.writableFinished) return;
21625
+ settle(executorStdinDeliveryFallback(input));
21608
21626
  });
21609
- if (hasInput) stdin.end(input);
21610
- else stdin.end();
21627
+ try {
21628
+ if (hasInput) stream.end(input);
21629
+ else stream.end();
21630
+ } catch (error) {
21631
+ settle(error);
21632
+ }
21611
21633
  }
21612
21634
 
21613
21635
  // src/amaster-runtime-daemon/durability.mjs
@@ -23846,11 +23868,22 @@ function compileCommandPromptWithManifest(input, options = {}) {
23846
23868
  contextScope,
23847
23869
  snapshotFreshness
23848
23870
  );
23849
- const resolvedDependencyContent = resolvedDependencies.required.content ? [
23871
+ const resolvedDependencyContent = [
23850
23872
  resolvedDependencies.required.content,
23851
- resolvedDependencies.details.content ? `Auxiliary predecessor context (may be truncated):
23852
- ${resolvedDependencies.details.content}` : ""
23853
- ].filter(Boolean).join("\n\n") : "";
23873
+ resolvedDependencies.details.content ? resolvedDependencies.required.content ? `Auxiliary predecessor context (may be truncated):
23874
+ ${resolvedDependencies.details.content}` : resolvedDependencies.details.content : ""
23875
+ ].filter(Boolean).join("\n\n");
23876
+ const resolvedDependencySection = resolvedDependencyContent ? {
23877
+ ...resolvedDependencies.required,
23878
+ ...!resolvedDependencies.required.content ? {
23879
+ sourceRef: resolvedDependencies.details.sourceRef,
23880
+ observedAt: resolvedDependencies.details.observedAt,
23881
+ freshness: resolvedDependencies.details.freshness,
23882
+ scope: resolvedDependencies.details.scope
23883
+ } : {},
23884
+ content: resolvedDependencyContent,
23885
+ mandatoryContent: resolvedDependencies.required.content
23886
+ } : null;
23854
23887
  const piDirectTypedTools = piDirectTypedToolsText(input);
23855
23888
  const piMcpUsage = [
23856
23889
  input.managedMcpToolMode === "proxy_only" && !resolvedDependencies.required.content ? piMcpUsageText(input) : "",
@@ -23871,13 +23904,11 @@ ${resolvedDependencies.details.content}` : ""
23871
23904
  ...governedBusinessState ? [{ name: "governed_business_state", title: "Governed Business State", priority: 99, ...governedBusinessState }] : [],
23872
23905
  ...continuationPostconditionGap ? [{ name: "continuation_postcondition_gap", title: "Continuation Postcondition Gap", priority: 100, ...continuationPostconditionGap }] : [],
23873
23906
  { name: "continuation_summary", title: continuationSectionTitle(context), priority: 97, sourceRef: readString(asRecord(context.paperclipContinuationSummary).key) ?? `issue:${input.issueId ?? "unknown"}`, observedAt: readString(asRecord(context.paperclipContinuationSummary).updatedAt), originalContent: continuationSummary, content: mode === "cold" ? "" : continuationSummary, truncationReason: mode === "cold" ? "mode_selection" : null },
23874
- ...resolvedDependencyContent ? [{
23907
+ ...resolvedDependencySection ? [{
23875
23908
  name: "resolved_dependencies",
23876
23909
  title: "Resolved Dependency Outputs",
23877
23910
  priority: 99,
23878
- ...resolvedDependencies.required,
23879
- content: resolvedDependencyContent,
23880
- mandatoryContent: resolvedDependencies.required.content
23911
+ ...resolvedDependencySection
23881
23912
  }] : [],
23882
23913
  ...deliveryReadinessContent ? [{ name: "runtime_delivery_readiness", title: "Current Delivery Readiness", priority: 99, sourceRef: `issue:${input.issueId ?? "unknown"}:delivery`, content: deliveryReadinessContent }] : [],
23883
23914
  { name: "runtime_rules", title: "", priority: 100, sourceRef: `command:${input.commandId}`, content: fixedRules(input, !hasTask) },
@@ -28989,7 +29020,7 @@ function createSourceCompletionStopPolicy({
28989
29020
  }
28990
29021
 
28991
29022
  // src/amaster-runtime-daemon.mjs
28992
- var CONNECTOR_VERSION = "0.1.1-beta.134";
29023
+ var CONNECTOR_VERSION = "0.1.1-beta.136";
28993
29024
  var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
28994
29025
  var SOURCE_ACQUISITION_CAPABILITY2 = source_acquisition_compatibility_default.profileVersion;
28995
29026
  var daemonRequire = createRequire(import.meta.url);
@@ -31761,6 +31792,7 @@ function runExecutor(command, args, options) {
31761
31792
  let quiescenceTimer = null;
31762
31793
  let stoppedResidentTimer = null;
31763
31794
  let completionOutputDrainTimer = null;
31795
+ let stdinSettlementTimer = null;
31764
31796
  let stopReason = null;
31765
31797
  let childExited = false;
31766
31798
  let childClosed = false;
@@ -31768,6 +31800,7 @@ function runExecutor(command, args, options) {
31768
31800
  let closeSignal = null;
31769
31801
  let spawnError = null;
31770
31802
  let spawnErrorCode = null;
31803
+ let stdinSettled = false;
31771
31804
  let outputDrainForcedClosed = false;
31772
31805
  let killedWorkspaceResidents = [];
31773
31806
  let stoppedResidentDrainUntil = 0;
@@ -31805,6 +31838,7 @@ function runExecutor(command, args, options) {
31805
31838
  if (quiescenceTimer) clearTimeout(quiescenceTimer);
31806
31839
  if (stoppedResidentTimer) clearTimeout(stoppedResidentTimer);
31807
31840
  if (completionOutputDrainTimer) clearTimeout(completionOutputDrainTimer);
31841
+ if (stdinSettlementTimer) clearTimeout(stdinSettlementTimer);
31808
31842
  sourceCompletionStopPolicy.close();
31809
31843
  options.signal?.removeEventListener?.("abort", abort);
31810
31844
  resolveRun({
@@ -31834,6 +31868,21 @@ function runExecutor(command, args, options) {
31834
31868
  signalExecutorProcess(child, "SIGTERM", processGroupId);
31835
31869
  scheduleStopKill();
31836
31870
  };
31871
+ const settleExecutorStdin = (error) => {
31872
+ if (stdinSettled) return;
31873
+ stdinSettled = true;
31874
+ if (stdinSettlementTimer) {
31875
+ clearTimeout(stdinSettlementTimer);
31876
+ stdinSettlementTimer = null;
31877
+ }
31878
+ if (error) {
31879
+ if (!spawnError) spawnError = `executor_stdin_delivery_failed: ${error.message}`;
31880
+ const stdinErrorCode = sourceAcquisitionSpawnErrno(error.code);
31881
+ if (!spawnErrorCode && stdinErrorCode) spawnErrorCode = stdinErrorCode;
31882
+ requestStop("stdin_delivery_failed");
31883
+ }
31884
+ maybeFinishQuiescent();
31885
+ };
31837
31886
  const sourceCompletionStopPolicy = createSourceCompletionStopPolicy({
31838
31887
  enabled: options.sourceCompletionGuard === true,
31839
31888
  onStop: requestStop
@@ -31877,6 +31926,15 @@ function runExecutor(command, args, options) {
31877
31926
  };
31878
31927
  const maybeFinishQuiescent = () => {
31879
31928
  if (settled || !childExited && !childClosed) return;
31929
+ if (!stdinSettled) {
31930
+ if (!stdinSettlementTimer) {
31931
+ stdinSettlementTimer = setTimeout(() => {
31932
+ stdinSettlementTimer = null;
31933
+ settleExecutorStdin(executorStdinDeliveryFallback(options.stdin));
31934
+ }, 100);
31935
+ }
31936
+ return;
31937
+ }
31880
31938
  if (isExecutorProcessAlive(child, processGroupId) || !childClosed && Date.now() < stoppedResidentDrainUntil || killedWorkspaceResidents.some((resident) => isProcessIdAlive(resident.pid))) {
31881
31939
  requestStop("completion_cleanup");
31882
31940
  if (!quiescenceTimer) {
@@ -32038,12 +32096,7 @@ function runExecutor(command, args, options) {
32038
32096
  closeSignal = signal;
32039
32097
  maybeFinishQuiescent();
32040
32098
  });
32041
- closeExecutorStdin(child.stdin, options.stdin, (error) => {
32042
- if (settled) return;
32043
- spawnError = `executor_stdin_delivery_failed: ${error.message}`;
32044
- spawnErrorCode = sourceAcquisitionSpawnErrno(error.code);
32045
- requestStop("executor_stdin_delivery_failed");
32046
- });
32099
+ deliverExecutorStdin(child.stdin, options.stdin, settleExecutorStdin);
32047
32100
  });
32048
32101
  }
32049
32102
  async function ingestLog(config, command, stream, level, message, payload = {}) {
@@ -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.134";
10
+ const CONNECTOR_VERSION = "0.1.1-beta.136";
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.134",
3
+ "version": "0.1.1-beta.136",
4
4
  "description": "MirrorX runtime connector CLI and daemon",
5
5
  "license": "MIT",
6
6
  "type": "module",