Add gui/cli capability conflict guards
This commit is contained in:
@@ -70,6 +70,11 @@ async function resolveHeartbeatProjects(config, runtime) {
|
||||
}
|
||||
|
||||
async function postHeartbeat(config, runtime, heartbeatProjects) {
|
||||
const now = new Date().toISOString();
|
||||
const preferredExecutionMode =
|
||||
config.preferredExecutionMode === "gui" || config.preferredExecutionMode === "cli"
|
||||
? config.preferredExecutionMode
|
||||
: undefined;
|
||||
const response = await fetch(`${config.controlPlaneUrl.replace(/\/$/, "")}/api/device-heartbeat`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
@@ -83,6 +88,19 @@ async function postHeartbeat(config, runtime, heartbeatProjects) {
|
||||
status: config.status,
|
||||
quota5h: config.quota5h,
|
||||
quota7d: config.quota7d,
|
||||
capabilities: {
|
||||
gui: {
|
||||
connected: Boolean(config.guiConnected),
|
||||
lastSeenAt: now,
|
||||
lastActiveProjectId: "",
|
||||
},
|
||||
cli: {
|
||||
connected: true,
|
||||
lastSeenAt: now,
|
||||
lastActiveProjectId: "",
|
||||
},
|
||||
},
|
||||
preferredExecutionMode,
|
||||
projects: heartbeatProjects.projects,
|
||||
projectCandidates: heartbeatProjects.projectCandidates,
|
||||
endpoint: config.endpoint,
|
||||
|
||||
Reference in New Issue
Block a user