@amaster.ai/employee-runtime-connector 0.1.1-beta.225 → 0.1.1-beta.226

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.
@@ -17,6 +17,7 @@ export const BUILD_SUPPORTED_CAPABILITIES = Object.freeze([
17
17
  "run_terminate",
18
18
  "logs_cost_workspace_status",
19
19
  "browser_credential_ref_fill_v1",
20
+ "execution_lanes_v1",
20
21
  ]);
21
22
 
22
23
  const DYNAMIC_READINESS = Object.freeze({
@@ -4072,8 +4072,11 @@ var AMASTER_RUNTIME_CONNECTOR_CAPABILITIES = [
4072
4072
  "runtime_actions_v2",
4073
4073
  "continue_task_v1",
4074
4074
  "run_exit_live_path_closure_v1",
4075
- "browser_credential_ref_fill_v1"
4075
+ "browser_credential_ref_fill_v1",
4076
+ "execution_lanes_v1"
4076
4077
  ];
4078
+ var RUNTIME_EXECUTION_LANES = ["business", "conversation"];
4079
+ var runtimeExecutionLaneSchema = external_exports.enum(RUNTIME_EXECUTION_LANES);
4077
4080
  var TERMINAL_BUSINESS_RECONCILIATION_VERSION = "mirrorx.terminal-business-reconciliation/v1";
4078
4081
  var terminalBusinessReconciliationAuthoritySnapshotSchema = external_exports.object({
4079
4082
  outcomeId: external_exports.string().uuid().nullable(),
@@ -20307,6 +20310,7 @@ const terminalActionDispositions = new Map([
20307
20310
  ["create_interaction", new Set(["waiting_human", "handoff_existing_live_path"])],
20308
20311
  ["upsert_external_wait", new Set(["waiting_external"])],
20309
20312
  ["schedule_monitor", new Set(["scheduled_monitor"])],
20313
+ ["continue_task", new Set(["continuation_scheduled"])],
20310
20314
  ]);
20311
20315
  const terminalToolNames = new Set(["runtime_action.submit", "runtime_action.status"]);
20312
20316
 
@@ -20330,6 +20334,18 @@ function shouldStopFromReceipt(rawResult) {
20330
20334
  const disposition = readString(effectResult.runDisposition);
20331
20335
  const existingOwner = asRecord(effectResult.existingOwner);
20332
20336
  const existingOwnerEpoch = Number(existingOwner.executionEpoch);
20337
+ const continuationCount = Number(effectResult.continuationCount);
20338
+ const maxContinuations = Number(effectResult.maxContinuations);
20339
+ const exactContinuation = disposition === "continuation_scheduled"
20340
+ && Boolean(readString(effectResult.chainId))
20341
+ && Boolean(readString(effectResult.continuationIntentId))
20342
+ && Boolean(readString(effectResult.wakeId))
20343
+ && Number.isSafeInteger(Number(effectResult.executionEpoch))
20344
+ && Number(effectResult.executionEpoch) > 0
20345
+ && Number.isSafeInteger(continuationCount)
20346
+ && continuationCount > 0
20347
+ && Number.isSafeInteger(maxContinuations)
20348
+ && continuationCount <= maxContinuations;
20333
20349
  if (!invocationId || !receiptInvocationId || !callId || !receiptCallId) return false;
20334
20350
 
20335
20351
  const exactQueuedWakeHandoff = disposition === "handoff_existing_live_path"
@@ -20356,7 +20372,8 @@ function shouldStopFromReceipt(rawResult) {
20356
20372
  && (disposition !== "waiting_human"
20357
20373
  || Boolean(readString(effectResult.interactionId) && readString(effectResult.epochKey)))
20358
20374
  && (disposition !== "handoff_existing_live_path"
20359
- || Boolean(readString(effectResult.epochKey) && exactQueuedWakeHandoff));
20375
+ || Boolean(readString(effectResult.epochKey) && exactQueuedWakeHandoff))
20376
+ && (disposition !== "continuation_scheduled" || exactContinuation);
20360
20377
  }
20361
20378
 
20362
20379
  export default function mirrorxRunTermination(pi) {
@@ -23500,6 +23517,39 @@ function resolveRuntimeCostModelIdentity({
23500
23517
  };
23501
23518
  }
23502
23519
 
23520
+ // src/amaster-runtime-daemon/execution-lanes.mjs
23521
+ function normalizeRuntimeExecutionLane(value) {
23522
+ return value === "conversation" ? "conversation" : "business";
23523
+ }
23524
+ function runtimeExecutionLaneForCapabilities(value, capabilities) {
23525
+ const lane = normalizeRuntimeExecutionLane(value);
23526
+ return lane === "conversation" && !(Array.isArray(capabilities) && capabilities.includes("execution_lanes_v1")) ? "business" : lane;
23527
+ }
23528
+ function localRuntimeCommandLimit(input) {
23529
+ const businessLimit = Number.isInteger(input.businessLimit) && input.businessLimit > 0 ? Math.min(input.businessLimit, 3) : 1;
23530
+ const supportsExecutionLanes = Array.isArray(input.capabilities) && input.capabilities.includes("execution_lanes_v1");
23531
+ return Math.min(4, businessLimit + (supportsExecutionLanes ? 1 : 0));
23532
+ }
23533
+ function selectRuntimeCommandsWithinLaneLimits(input) {
23534
+ const businessLimit = Number.isInteger(input.businessLimit) && input.businessLimit > 0 ? Math.min(input.businessLimit, 3) : 1;
23535
+ const totalLimit = Number.isInteger(input.totalLimit) && input.totalLimit > 0 ? Math.min(input.totalLimit, 4) : 1;
23536
+ const counts = { business: 0, conversation: 0 };
23537
+ for (const lane of Array.isArray(input.activeLanes) ? input.activeLanes : []) {
23538
+ counts[runtimeExecutionLaneForCapabilities(lane, input.capabilities)] += 1;
23539
+ }
23540
+ const selected = [];
23541
+ for (const command of Array.isArray(input.commands) ? input.commands : []) {
23542
+ const lane = runtimeExecutionLaneForCapabilities(command?.executionLane, input.capabilities);
23543
+ const total = counts.business + counts.conversation;
23544
+ if (total >= totalLimit) continue;
23545
+ if (lane === "business" && counts.business >= businessLimit) continue;
23546
+ if (lane === "conversation" && counts.conversation >= 1) continue;
23547
+ selected.push(command);
23548
+ counts[lane] += 1;
23549
+ }
23550
+ return selected;
23551
+ }
23552
+
23503
23553
  // src/amaster-runtime-daemon/prompt-compiler.mjs
23504
23554
  import { createHash as createHash9 } from "node:crypto";
23505
23555
  import { isAbsolute as isAbsolute5 } from "node:path";
@@ -24698,7 +24748,7 @@ function runtimeAuthorizationText(context, mode, {
24698
24748
  const completionContract = !suppressOrdinaryCompletionContract && completionRole && completionDeliverable ? [
24699
24749
  workDisposition.mode === "required" ? "Before the first business mutation, ensure the current required work disposition is recorded. Read-only governed checks may precede it. If no current valid receipt exists, call runtime_action_describe for record_work_disposition and persist exactly one truthful disposition before upsert_document, update_parent, add_comment, create_interaction, publish_delivery_manifest, or any other business mutation. Before ending this run, persist durable progress through Runtime Actions; browser and tool history alone are not durable progress." : "Before ending this run, persist durable progress through Runtime Actions and record one explicit task disposition. Browser and tool history alone are not durable progress.",
24700
24750
  firstDocumentCheckpoint,
24701
- continueTaskEnabled ? "If work remains in an ordinary productive run, call continue_task with a concrete nextAction and stable idempotencyKey, then end the run. For a future time recheck use schedule_monitor; for an external person or system action use upsert_external_wait. These are mutually exclusive final live paths. Do not call update_parent with status: in_progress." : "If work remains in an ordinary productive run, call update_parent with status: in_progress and a concrete next action so bounded continuation recovery can preserve a live path. Status: todo does not queue a normal continuation from an ordinary productive run. Only a server-issued successful-run handoff recovery may use status: todo, and only according to its exact Recovery Instruction. Otherwise use a supported terminal or waiting disposition."
24751
+ continueTaskEnabled ? "Treat one Run as one bounded, durable checkpoint. Once that checkpoint is persisted and another independent research, build, or revision phase remains, call continue_task immediately with a concrete nextAction and stable idempotencyKey instead of keeping the current Run open, then end the run. Do not split an unfinished atomic mutation or claim progress that is not durable. For a future time recheck use schedule_monitor; for an external person or system action use upsert_external_wait. These are mutually exclusive final live paths. Do not call update_parent with status: in_progress." : "If work remains in an ordinary productive run, call update_parent with status: in_progress and a concrete next action so bounded continuation recovery can preserve a live path. Status: todo does not queue a normal continuation from an ordinary productive run. Only a server-issued successful-run handoff recovery may use status: todo, and only according to its exact Recovery Instruction. Otherwise use a supported terminal or waiting disposition."
24702
24752
  ].filter(Boolean).join(" ") : "";
24703
24753
  const businessOutcomeOwnershipContract = businessOutcome.mode === "required" ? evidenceAutoAcceptance ? [
24704
24754
  "Evidence-auto Business Outcome closure is owned by the Server terminal reconciler.",
@@ -25963,7 +26013,8 @@ var BUILD_SUPPORTED_CAPABILITIES = Object.freeze([
25963
26013
  "run_cancel",
25964
26014
  "run_terminate",
25965
26015
  "logs_cost_workspace_status",
25966
- "browser_credential_ref_fill_v1"
26016
+ "browser_credential_ref_fill_v1",
26017
+ "execution_lanes_v1"
25967
26018
  ]);
25968
26019
  var DYNAMIC_READINESS = Object.freeze({
25969
26020
  artifact_template_catalog_v1: {
@@ -26928,7 +26979,8 @@ var PI_TERMINAL_RUNTIME_ACTION_STATUSES = /* @__PURE__ */ new Set([
26928
26979
  var PI_TERMINATING_RUNTIME_ACTION_TO_DISPOSITION = /* @__PURE__ */ new Map([
26929
26980
  ["create_interaction", /* @__PURE__ */ new Set(["waiting_human", "handoff_existing_live_path"])],
26930
26981
  ["upsert_external_wait", /* @__PURE__ */ new Set(["waiting_external"])],
26931
- ["schedule_monitor", /* @__PURE__ */ new Set(["scheduled_monitor"])]
26982
+ ["schedule_monitor", /* @__PURE__ */ new Set(["scheduled_monitor"])],
26983
+ ["continue_task", /* @__PURE__ */ new Set(["continuation_scheduled"])]
26932
26984
  ]);
26933
26985
  var PI_TERMINATING_RUNTIME_ACTION_TOOLS = /* @__PURE__ */ new Set([
26934
26986
  "runtime_action.submit",
@@ -26991,10 +27043,17 @@ function governedMcpToolResult(structuredContent) {
26991
27043
  const epochKey = readString(effectResult.epochKey);
26992
27044
  const existingOwner = asRecord(effectResult.existingOwner);
26993
27045
  const existingOwnerEpoch = readNumber(existingOwner.executionEpoch, 0);
27046
+ const continuationChainId = readString(effectResult.chainId);
27047
+ const continuationIntentId = readString(effectResult.continuationIntentId);
27048
+ const continuationWakeId = readString(effectResult.wakeId);
27049
+ const continuationExecutionEpoch = readNumber(effectResult.executionEpoch, 0);
27050
+ const continuationCount = readNumber(effectResult.continuationCount, 0);
27051
+ const maxContinuations = readNumber(effectResult.maxContinuations, 0);
27052
+ const exactContinuation = runDisposition === "continuation_scheduled" && continuationChainId && continuationIntentId && continuationWakeId && Number.isSafeInteger(continuationExecutionEpoch) && continuationExecutionEpoch > 0 && Number.isSafeInteger(continuationCount) && continuationCount > 0 && Number.isSafeInteger(maxContinuations) && continuationCount <= maxContinuations;
26994
27053
  const exactQueuedWakeHandoff = runDisposition === "handoff_existing_live_path" && readString(existingOwner.kind) === "queued_wake" && Boolean(readString(existingOwner.id)) && ["pending_dispatch", "queued", "deferred_issue_execution"].includes(
26995
27054
  readString(existingOwner.status) ?? ""
26996
27055
  ) && Number.isSafeInteger(existingOwnerEpoch) && existingOwnerEpoch > 0 && readString(existingOwner.nextAction) === "end_current_run";
26997
- const terminalRunDisposition = status === "succeeded" && providerStatus === "accepted" && PI_TERMINAL_RUNTIME_ACTION_STATUSES.has(runtimeActionResultStatus ?? "") && PI_TERMINATING_RUNTIME_ACTION_TOOLS.has(runtimeActionToolName ?? "") && effectResult.mustEndRun === true && Boolean(expectedDispositions?.has(runDisposition ?? "")) && invocationId && readString(providerReceipt.provider) === "amaster_actions" && readString(providerReceipt.invocationId) === invocationId && readString(providerReceipt.status) === "accepted" && receiptRunId && receiptCommandId && receiptIssueId && runtimeActionCallId && receiptCallId === runtimeActionCallId && (runDisposition !== "waiting_human" || Boolean(interactionId && epochKey)) && (runDisposition !== "handoff_existing_live_path" || Boolean(epochKey && exactQueuedWakeHandoff)) ? {
27056
+ const terminalRunDisposition = status === "succeeded" && providerStatus === "accepted" && PI_TERMINAL_RUNTIME_ACTION_STATUSES.has(runtimeActionResultStatus ?? "") && PI_TERMINATING_RUNTIME_ACTION_TOOLS.has(runtimeActionToolName ?? "") && effectResult.mustEndRun === true && Boolean(expectedDispositions?.has(runDisposition ?? "")) && invocationId && readString(providerReceipt.provider) === "amaster_actions" && readString(providerReceipt.invocationId) === invocationId && readString(providerReceipt.status) === "accepted" && receiptRunId && receiptCommandId && receiptIssueId && runtimeActionCallId && receiptCallId === runtimeActionCallId && (runDisposition !== "waiting_human" || Boolean(interactionId && epochKey)) && (runDisposition !== "handoff_existing_live_path" || Boolean(epochKey && exactQueuedWakeHandoff)) && (runDisposition !== "continuation_scheduled" || Boolean(exactContinuation)) ? {
26998
27057
  disposition: runDisposition,
26999
27058
  actionType: receiptActionType,
27000
27059
  toolName: runtimeActionToolName,
@@ -27005,6 +27064,16 @@ function governedMcpToolResult(structuredContent) {
27005
27064
  issueId: receiptIssueId,
27006
27065
  ...interactionId ? { interactionId } : {},
27007
27066
  ...epochKey ? { epochKey } : {},
27067
+ ...exactContinuation ? {
27068
+ continuation: {
27069
+ chainId: continuationChainId,
27070
+ intentId: continuationIntentId,
27071
+ wakeId: continuationWakeId,
27072
+ executionEpoch: continuationExecutionEpoch,
27073
+ count: continuationCount,
27074
+ max: maxContinuations
27075
+ }
27076
+ } : {},
27008
27077
  ...exactQueuedWakeHandoff ? {
27009
27078
  existingOwner: {
27010
27079
  kind: "queued_wake",
@@ -27073,6 +27142,7 @@ function piTerminatingRunDispositionEvidence(results, expected = {}) {
27073
27142
  if (!result2) return null;
27074
27143
  const disposition = asRecord(result2.terminalRunDisposition);
27075
27144
  const existingOwner = asRecord(disposition.existingOwner);
27145
+ const continuation = asRecord(disposition.continuation);
27076
27146
  return {
27077
27147
  kind: "runtime_action_run_disposition",
27078
27148
  disposition: readString(disposition.disposition),
@@ -27085,6 +27155,16 @@ function piTerminatingRunDispositionEvidence(results, expected = {}) {
27085
27155
  issueId: expectedIssueId,
27086
27156
  ...readString(disposition.interactionId) ? { interactionId: readString(disposition.interactionId) } : {},
27087
27157
  ...readString(disposition.epochKey) ? { epochKey: readString(disposition.epochKey) } : {},
27158
+ ...readString(continuation.chainId) && readString(continuation.intentId) && readString(continuation.wakeId) ? {
27159
+ continuation: {
27160
+ chainId: readString(continuation.chainId),
27161
+ intentId: readString(continuation.intentId),
27162
+ wakeId: readString(continuation.wakeId),
27163
+ executionEpoch: readNumber(continuation.executionEpoch, 0),
27164
+ count: readNumber(continuation.count, 0),
27165
+ max: readNumber(continuation.max, 0)
27166
+ }
27167
+ } : {},
27088
27168
  ...readString(existingOwner.kind) === "queued_wake" && readString(existingOwner.id) ? {
27089
27169
  existingOwner: {
27090
27170
  kind: "queued_wake",
@@ -27173,7 +27253,8 @@ function classifyPiTerminalCleanupDisposition(parsed, runtimeArtifacts) {
27173
27253
  diagnostics
27174
27254
  };
27175
27255
  }
27176
- function classifyPiTurnLimitResult(parsed) {
27256
+ function classifyPiTurnLimitResult(parsed, options = {}) {
27257
+ if (options.authoritativeTerminalDisposition === true) return null;
27177
27258
  const stopReason = readString(parsed?.stopReason);
27178
27259
  if (parsed?.sawAgentSettled !== true || !Number.isInteger(parsed?.settledEventIndex) || parsed?.terminalEventType !== "agent_end" || !["toolUse", "tool_use"].includes(stopReason ?? "")) return null;
27179
27260
  return {
@@ -29862,7 +29943,7 @@ function assertRequiredTaskAttachmentMaterialized(input, materialized) {
29862
29943
  }
29863
29944
 
29864
29945
  // src/amaster-runtime-daemon.mjs
29865
- var CONNECTOR_VERSION = "0.1.1-beta.225";
29946
+ var CONNECTOR_VERSION = "0.1.1-beta.226";
29866
29947
  var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
29867
29948
  var daemonRequire = createRequire(import.meta.url);
29868
29949
  var MAX_CHECKPOINT_BYTES = 20 * 1024 * 1024;
@@ -29878,7 +29959,7 @@ var activeRunCommands = /* @__PURE__ */ new Map();
29878
29959
  var pendingResultOutboxRunCommands = /* @__PURE__ */ new Map();
29879
29960
  var pendingRunCompletionCommands = /* @__PURE__ */ new Map();
29880
29961
  var runCompletionFlights = /* @__PURE__ */ new Map();
29881
- var localDispatchCommandIds = /* @__PURE__ */ new Set();
29962
+ var localDispatchCommands = /* @__PURE__ */ new Map();
29882
29963
  var workspaceStatusHashCache = /* @__PURE__ */ new Map();
29883
29964
  var processGroupRssSampleCache = null;
29884
29965
  var lastOrphanReaperRunAtMs = 0;
@@ -29952,6 +30033,7 @@ function runCompletionStateActiveRunCommands(config) {
29952
30033
  const command = asRecord(state.command);
29953
30034
  return {
29954
30035
  commandId: state.commandId,
30036
+ executionLane: normalizeRuntimeExecutionLane(command.executionLane),
29955
30037
  ...readString(commandRunId(command)) ? { runId: readString(commandRunId(command)) } : {},
29956
30038
  ...readString(commandIssueId(command)) ? { issueId: readString(commandIssueId(command)) } : {},
29957
30039
  ...readString(executor.kind) ? { executorKind: readString(executor.kind) } : {},
@@ -29980,6 +30062,7 @@ function resultOutboxActiveRunCommands(config) {
29980
30062
  if (!commandId) continue;
29981
30063
  entries.push({
29982
30064
  commandId,
30065
+ executionLane: normalizeRuntimeExecutionLane(activeRun.executionLane),
29983
30066
  ...readString(activeRun.runId) ? { runId: readString(activeRun.runId) } : {},
29984
30067
  ...readString(activeRun.issueId) ? { issueId: readString(activeRun.issueId) } : {},
29985
30068
  ...readString(activeRun.executorKind) ? { executorKind: readString(activeRun.executorKind) } : {},
@@ -30384,7 +30467,7 @@ function buildHeartbeatPayload(config, options = {}) {
30384
30467
  const orphanReaperSummary = asRecord(options.orphanReaper ?? lastOrphanReaperSummary);
30385
30468
  const activeRunCommandById = /* @__PURE__ */ new Map();
30386
30469
  for (const entry of [
30387
- ...Array.from(localDispatchCommandIds, (commandId) => ({ commandId, phase: "preparing" })),
30470
+ ...Array.from(localDispatchCommands.values()),
30388
30471
  ...Array.from(activeRunCommands.values()),
30389
30472
  ...Array.from(pendingResultOutboxRunCommands.values()),
30390
30473
  ...Array.from(pendingRunCompletionCommands.values()),
@@ -30695,7 +30778,10 @@ function activeRunHeartbeatIntervalMs(config) {
30695
30778
  }
30696
30779
  function maxConcurrentCommands(config) {
30697
30780
  const configured = Number(config.maxConcurrentCommands);
30698
- return Number.isInteger(configured) && configured > 0 ? Math.min(configured, 50) : 1;
30781
+ return localRuntimeCommandLimit({
30782
+ businessLimit: Number.isInteger(configured) && configured > 0 ? configured : 1,
30783
+ capabilities: config.capabilities
30784
+ });
30699
30785
  }
30700
30786
  function activeRunCommandCount(config, options = {}) {
30701
30787
  const excludeCommandIds = new Set(readStringArray(options.excludeCommandIds));
@@ -30704,19 +30790,54 @@ function activeRunCommandCount(config, options = {}) {
30704
30790
  ...pendingResultOutboxRunCommands.keys(),
30705
30791
  ...pendingRunCompletionCommands.keys(),
30706
30792
  ...runCompletionStateEntries(config).map(({ state }) => state.commandId),
30707
- ...localDispatchCommandIds
30793
+ ...localDispatchCommands.keys()
30708
30794
  ].filter((commandId) => !excludeCommandIds.has(commandId)));
30709
30795
  return commandIds.size;
30710
30796
  }
30711
30797
  function availableCommandSlots(config) {
30712
30798
  return Math.max(0, maxConcurrentCommands(config) - activeRunCommandCount(config));
30713
30799
  }
30800
+ function activeRuntimeExecutionLanes(config) {
30801
+ const laneByCommandId = /* @__PURE__ */ new Map();
30802
+ for (const entry of [
30803
+ ...activeRunCommands.values(),
30804
+ ...pendingResultOutboxRunCommands.values(),
30805
+ ...pendingRunCompletionCommands.values(),
30806
+ ...runCompletionStateActiveRunCommands(config),
30807
+ ...localDispatchCommands.values()
30808
+ ]) {
30809
+ const commandId = readString(entry.commandId);
30810
+ if (!commandId) continue;
30811
+ const lane = runtimeExecutionLaneForCapabilities(entry.executionLane, config.capabilities);
30812
+ if (!laneByCommandId.has(commandId) || lane === "conversation") {
30813
+ laneByCommandId.set(commandId, lane);
30814
+ }
30815
+ }
30816
+ return [...laneByCommandId.values()];
30817
+ }
30818
+ function locallyAdmittedCommands(config, commands) {
30819
+ const admitted = selectRuntimeCommandsWithinLaneLimits({
30820
+ commands,
30821
+ activeLanes: activeRuntimeExecutionLanes(config),
30822
+ businessLimit: Number(config.maxConcurrentCommands),
30823
+ totalLimit: maxConcurrentCommands(config),
30824
+ capabilities: config.capabilities
30825
+ });
30826
+ if (admitted.length !== commands.length) {
30827
+ process.stderr.write(
30828
+ `AMaster daemon deferred ${commands.length - admitted.length} leased command(s) at the local execution-lane guard.
30829
+ `
30830
+ );
30831
+ }
30832
+ return admitted;
30833
+ }
30714
30834
  function rememberActiveRunCommand(command, metadata) {
30715
30835
  const commandId = readString(command.commandId) ?? readString(command.id);
30716
30836
  if (!commandId) return () => {
30717
30837
  };
30718
30838
  activeRunCommands.set(commandId, {
30719
30839
  commandId,
30840
+ executionLane: normalizeRuntimeExecutionLane(command.executionLane),
30720
30841
  ...readString(commandRunId(command)) ? { runId: readString(commandRunId(command)) } : {},
30721
30842
  ...readString(commandIssueId(command)) ? { issueId: readString(commandIssueId(command)) } : {},
30722
30843
  ...metadata.executorKind ? { executorKind: metadata.executorKind } : {},
@@ -32397,7 +32518,7 @@ function walkManagedWorkdirs(root) {
32397
32518
  }
32398
32519
  function activeRuntimeExecutionRefs() {
32399
32520
  const activeRunIds = /* @__PURE__ */ new Set();
32400
- const activeCommandIds = new Set(localDispatchCommandIds);
32521
+ const activeCommandIds = new Set(localDispatchCommands.keys());
32401
32522
  const activeWorkspacePaths = /* @__PURE__ */ new Set();
32402
32523
  for (const entry of [
32403
32524
  ...Array.from(activeRunCommands.values()),
@@ -32879,6 +33000,7 @@ function pendingRunCompletionSnapshot(config, state) {
32879
33000
  const execution = asRecord(executor.closureExecution);
32880
33001
  return {
32881
33002
  commandId: state.commandId,
33003
+ executionLane: normalizeRuntimeExecutionLane(command.executionLane),
32882
33004
  ...readString(commandRunId(command)) ? { runId: readString(commandRunId(command)) } : {},
32883
33005
  ...readString(commandIssueId(command)) ? { issueId: readString(commandIssueId(command)) } : {},
32884
33006
  ...readString(executor.kind) ? { executorKind: readString(executor.kind) } : {},
@@ -34107,6 +34229,7 @@ function resultOutboxActiveRunSnapshot(command) {
34107
34229
  if (!current) return null;
34108
34230
  return {
34109
34231
  commandId,
34232
+ executionLane: normalizeRuntimeExecutionLane(current.executionLane),
34110
34233
  ...readString(current.runId) ? { runId: readString(current.runId) } : {},
34111
34234
  ...readString(current.issueId) ? { issueId: readString(current.issueId) } : {},
34112
34235
  ...readString(current.executorKind) ? { executorKind: readString(current.executorKind) } : {},
@@ -35349,7 +35472,7 @@ async function executeRunCommand(config, command) {
35349
35472
  }) : null;
35350
35473
  if (terminalRunDisposition) {
35351
35474
  const disposition = readString(terminalRunDisposition.disposition);
35352
- parsed.summary = disposition === "handoff_existing_live_path" ? "This run handed control to the existing queued live path and ended normally without creating a duplicate interaction." : disposition === "waiting_human" ? "The requested human interaction was persisted; this run ended normally and will resume only under its continuation policy." : disposition === "waiting_external" ? "The external wait was persisted; this run ended normally and will resume only after the recorded condition is satisfied." : "The monitor schedule was persisted; this run ended normally and will resume only at the scheduled check.";
35475
+ parsed.summary = disposition === "handoff_existing_live_path" ? "This run handed control to the existing queued live path and ended normally without creating a duplicate interaction." : disposition === "continuation_scheduled" ? "A bounded continuation was persisted; this run ended normally so another queued command can use the released execution slot." : disposition === "waiting_human" ? "The requested human interaction was persisted; this run ended normally and will resume only under its continuation policy." : disposition === "waiting_external" ? "The external wait was persisted; this run ended normally and will resume only after the recorded condition is satisfied." : "The monitor schedule was persisted; this run ended normally and will resume only at the scheduled check.";
35353
35476
  parsed.hasAssistantOutput = true;
35354
35477
  await ingestLog(
35355
35478
  config,
@@ -35527,7 +35650,9 @@ async function executeRunCommand(config, command) {
35527
35650
  );
35528
35651
  }
35529
35652
  const parsedForValidation = parsed;
35530
- const piTurnLimitFailure = executor.kind === "pi" && !cancelled && !hasOutputFlood && !hasArgumentAmplification && !hasMemoryLimit && execution.timedOut !== true && !execution.spawnError ? classifyPiTurnLimitResult(parsedForValidation) : null;
35653
+ const piTurnLimitFailure = executor.kind === "pi" && !cancelled && !hasOutputFlood && !hasArgumentAmplification && !hasMemoryLimit && execution.timedOut !== true && !execution.spawnError ? classifyPiTurnLimitResult(parsedForValidation, {
35654
+ authoritativeTerminalDisposition: Boolean(terminalRunDisposition)
35655
+ }) : null;
35531
35656
  const piInvalidOutputError = executor.kind === "pi" ? piOutputValidationError(parsedForValidation, {
35532
35657
  allowMissingTurnEnd: completionOutputStopped,
35533
35658
  allowMissingAssistantOutput: execution.completionOutputType === "approval_required",
@@ -35901,7 +36026,10 @@ async function runOnce(config) {
35901
36026
  leaseId,
35902
36027
  leaseSeconds: config.leaseSeconds
35903
36028
  });
35904
- const commands = Array.isArray(polled.commands) ? polled.commands : [];
36029
+ const commands = locallyAdmittedCommands(
36030
+ config,
36031
+ Array.isArray(polled.commands) ? polled.commands : []
36032
+ );
35905
36033
  await Promise.all(commands.map((command) => processCommand(config, command)));
35906
36034
  return commands.length;
35907
36035
  }
@@ -35934,10 +36062,19 @@ async function dispatchAvailableCommands(config, options = {}) {
35934
36062
  leaseId,
35935
36063
  leaseSeconds: config.leaseSeconds
35936
36064
  });
35937
- const commands = Array.isArray(polled.commands) ? polled.commands : [];
36065
+ const commands = locallyAdmittedCommands(
36066
+ config,
36067
+ Array.isArray(polled.commands) ? polled.commands : []
36068
+ );
35938
36069
  for (const command of commands) {
35939
36070
  const commandId = readString(command.commandId) ?? readString(command.id);
35940
- if (commandId) localDispatchCommandIds.add(commandId);
36071
+ if (commandId) {
36072
+ localDispatchCommands.set(commandId, {
36073
+ commandId,
36074
+ executionLane: normalizeRuntimeExecutionLane(command.executionLane),
36075
+ phase: "preparing"
36076
+ });
36077
+ }
35941
36078
  void processCommand(config, command).catch((err) => {
35942
36079
  const idForLog = commandId ?? "unknown";
35943
36080
  const message = err instanceof Error ? err.stack || err.message : String(err);
@@ -35945,7 +36082,7 @@ async function dispatchAvailableCommands(config, options = {}) {
35945
36082
  ${message}
35946
36083
  `);
35947
36084
  }).finally(() => {
35948
- if (commandId) localDispatchCommandIds.delete(commandId);
36085
+ if (commandId) localDispatchCommands.delete(commandId);
35949
36086
  });
35950
36087
  }
35951
36088
  return commands.length;
@@ -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.225";
10
+ const CONNECTOR_VERSION = "0.1.1-beta.226";
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.225",
3
+ "version": "0.1.1-beta.226",
4
4
  "description": "MirrorX runtime connector CLI and daemon",
5
5
  "license": "MIT",
6
6
  "type": "module",