@algosuite/vo-mcp 0.2.0-beta.62 → 0.2.0-beta.64

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.
@@ -61,6 +61,67 @@ async function fetchInstallationToken({ req, required = false, readOnly = false,
61
61
  }
62
62
  }
63
63
 
64
+ // ../../scripts/virtual-office/code-runner/control-plane-heartbeat-body.mjs
65
+ function buildRunnerHeartbeatBody({
66
+ runnerId: runnerId2,
67
+ runnerInstanceId,
68
+ operatorId,
69
+ uptimeSec,
70
+ activeTasks,
71
+ maxConcurrency,
72
+ effectiveConcurrency,
73
+ measuredTaskSlots,
74
+ measuredCpuSlots,
75
+ measuredMemorySlots,
76
+ version,
77
+ daemonVersion,
78
+ nodeVersion,
79
+ defaultAgent,
80
+ supervisorInstanceId: supervisorInstanceId2,
81
+ supervisorVersion: supervisorVersion2,
82
+ supervisorCapabilities,
83
+ servedRepos,
84
+ servedOperators,
85
+ availableAgents,
86
+ accountUsage,
87
+ availableLocalModels,
88
+ prepared_job_shadow: preparedJobShadow
89
+ } = {}) {
90
+ const body = { runner_id: runnerId2, ...preparedJobShadow ? { prepared_job_shadow: preparedJobShadow } : {} };
91
+ if (runnerInstanceId) body.runner_instance_id = runnerInstanceId;
92
+ if (operatorId) body.operator_id = operatorId;
93
+ if (typeof uptimeSec === "number") body.uptime_sec = uptimeSec;
94
+ if (typeof activeTasks === "number") body.active_tasks = activeTasks;
95
+ if (typeof maxConcurrency === "number") body.max_concurrency = maxConcurrency;
96
+ if (typeof effectiveConcurrency === "number") body.effective_concurrency = effectiveConcurrency;
97
+ if (typeof measuredTaskSlots === "number") body.measured_task_slots = measuredTaskSlots;
98
+ if (typeof measuredCpuSlots === "number") body.measured_cpu_slots = measuredCpuSlots;
99
+ if (typeof measuredMemorySlots === "number") body.measured_memory_slots = measuredMemorySlots;
100
+ if (version) body.version = version;
101
+ if (daemonVersion) body.daemon_version = daemonVersion;
102
+ if (nodeVersion) body.node_version = nodeVersion;
103
+ if (defaultAgent) body.default_agent = defaultAgent;
104
+ if (supervisorInstanceId2) body.supervisor_instance_id = supervisorInstanceId2;
105
+ if (supervisorVersion2) body.supervisor_version = supervisorVersion2;
106
+ if (Array.isArray(supervisorCapabilities) && supervisorCapabilities.length > 0) {
107
+ body.supervisor_capabilities = supervisorCapabilities;
108
+ }
109
+ if (Array.isArray(servedRepos) && servedRepos.length > 0) body.served_repos = servedRepos;
110
+ if (Array.isArray(servedOperators) && servedOperators.length > 0) {
111
+ body.served_operator_ids = servedOperators;
112
+ }
113
+ if (Array.isArray(availableAgents) && availableAgents.length > 0) {
114
+ body.available_agents = availableAgents;
115
+ }
116
+ if (Array.isArray(accountUsage) && accountUsage.length > 0) {
117
+ body.account_usage = accountUsage;
118
+ }
119
+ if (Array.isArray(availableLocalModels) && availableLocalModels.length > 0) {
120
+ body.available_local_models = availableLocalModels;
121
+ }
122
+ return body;
123
+ }
124
+
64
125
  // ../../scripts/virtual-office/code-runner/control-plane-promote.mjs
65
126
  async function promoteDraftPrRequest(req, prNumber, automationContext, onUnauthorized = () => {
66
127
  }) {
@@ -675,38 +736,8 @@ function createControlPlaneClient({
675
736
  * authenticated operator so the web shows a TRUE "runner online" signal.
676
737
  * Best-effort caller; throws on 401/non-ok so the daemon can log + retry.
677
738
  */
678
- async postHeartbeat({ runnerId: runnerId3, runnerInstanceId: runnerInstanceId2, operatorId, uptimeSec, activeTasks, maxConcurrency, effectiveConcurrency, measuredTaskSlots, measuredCpuSlots, measuredMemorySlots, version, daemonVersion, defaultAgent, supervisorInstanceId: supervisorInstanceId2, supervisorVersion: supervisorVersion2, supervisorCapabilities, servedRepos, servedOperators, availableAgents, accountUsage, availableLocalModels, prepared_job_shadow: preparedJobShadow }) {
679
- const body = { runner_id: runnerId3, ...preparedJobShadow ? { prepared_job_shadow: preparedJobShadow } : {} };
680
- if (runnerInstanceId2) body.runner_instance_id = runnerInstanceId2;
681
- if (operatorId) body.operator_id = operatorId;
682
- if (typeof uptimeSec === "number") body.uptime_sec = uptimeSec;
683
- if (typeof activeTasks === "number") body.active_tasks = activeTasks;
684
- if (typeof maxConcurrency === "number") body.max_concurrency = maxConcurrency;
685
- if (typeof effectiveConcurrency === "number") body.effective_concurrency = effectiveConcurrency;
686
- if (typeof measuredTaskSlots === "number") body.measured_task_slots = measuredTaskSlots;
687
- if (typeof measuredCpuSlots === "number") body.measured_cpu_slots = measuredCpuSlots;
688
- if (typeof measuredMemorySlots === "number") body.measured_memory_slots = measuredMemorySlots;
689
- if (version) body.version = version;
690
- if (daemonVersion) body.daemon_version = daemonVersion;
691
- if (defaultAgent) body.default_agent = defaultAgent;
692
- if (supervisorInstanceId2) body.supervisor_instance_id = supervisorInstanceId2;
693
- if (supervisorVersion2) body.supervisor_version = supervisorVersion2;
694
- if (Array.isArray(supervisorCapabilities) && supervisorCapabilities.length > 0) {
695
- body.supervisor_capabilities = supervisorCapabilities;
696
- }
697
- if (Array.isArray(servedRepos) && servedRepos.length > 0) body.served_repos = servedRepos;
698
- if (Array.isArray(servedOperators) && servedOperators.length > 0) {
699
- body.served_operator_ids = servedOperators;
700
- }
701
- if (Array.isArray(availableAgents) && availableAgents.length > 0) {
702
- body.available_agents = availableAgents;
703
- }
704
- if (Array.isArray(accountUsage) && accountUsage.length > 0) {
705
- body.account_usage = accountUsage;
706
- }
707
- if (Array.isArray(availableLocalModels) && availableLocalModels.length > 0) {
708
- body.available_local_models = availableLocalModels;
709
- }
739
+ async postHeartbeat(heartbeat) {
740
+ const body = buildRunnerHeartbeatBody(heartbeat);
710
741
  const res = await req("POST", "/api/v1/runner/heartbeat", body, {
711
742
  timeoutMs: heartbeatTimeoutMs
712
743
  });
@@ -2157,7 +2188,7 @@ async function waitForAuthoritativeRunnerHeartbeat({
2157
2188
  while (Date.now() < deadline) {
2158
2189
  try {
2159
2190
  const runners = await client.getRunnerStatus({ ...operatorId ? { operatorId } : {} });
2160
- const runner = runners.find((item) => item?.runner_id === runnerId2 && item.status === "online" && (runnerInstanceId ? item.runner_meta?.runner_instance_id === runnerInstanceId : Boolean(item.runner_meta?.runner_instance_id) && item.runner_meta.runner_instance_id !== excludeRunnerInstanceId) && item.runner_meta?.daemon_version === daemonVersion && item.runner_meta?.supervisor_instance_id === supervisorIdentity.supervisorInstanceId && item.runner_meta?.supervisor_version === supervisorIdentity.supervisorVersion && supervisorIdentity.capabilities.every((value) => item.runner_meta?.supervisor_capabilities?.includes(value)) && Array.isArray(item.runner_meta?.available_agents) && item.runner_meta.available_agents.some((agent) => agent.agent === item.runner_meta.default_agent && agent.installed === true && agent.authenticated === true));
2191
+ const runner = runners.find((item) => item?.runner_id === runnerId2 && item.status === "online" && (runnerInstanceId ? item.runner_meta?.runner_instance_id === runnerInstanceId : Boolean(item.runner_meta?.runner_instance_id) && item.runner_meta.runner_instance_id !== excludeRunnerInstanceId) && item.runner_meta?.daemon_version === daemonVersion && item.runner_meta?.supervisor_instance_id === supervisorIdentity.supervisorInstanceId && item.runner_meta?.supervisor_version === supervisorIdentity.supervisorVersion && supervisorIdentity.capabilities.every((value) => item.runner_meta?.supervisor_capabilities?.includes(value)) && Array.isArray(item.runner_meta?.available_agents) && item.runner_meta.available_agents.some((agent) => agent.agent === item.runner_meta.default_agent && agent.installed === true));
2161
2192
  if (runner) return runner;
2162
2193
  } catch {
2163
2194
  }