feat: queue codex remote control actions
This commit is contained in:
@@ -17,6 +17,7 @@ import {
|
||||
fetchAdminBackups,
|
||||
fetchBossAdminBackoffice,
|
||||
postAdminAccess,
|
||||
postDeviceCodexRemoteControl,
|
||||
postRiskAction,
|
||||
postSkillLifecycleRequest,
|
||||
restoreAdminBackup,
|
||||
@@ -455,6 +456,19 @@ async function handleRisk(record: AdminRecord, action: string) {
|
||||
);
|
||||
}
|
||||
|
||||
async function handleCodexRemoteControl(record: AdminRecord, action: "start" | "stop") {
|
||||
const deviceId = text(record.id);
|
||||
const deviceName = text(record.name) || deviceId;
|
||||
const actionLabel = action === "start" ? "启动 Codex Remote Control" : "停止 Codex Remote Control";
|
||||
if (!window.confirm(`确认对 ${deviceName} ${actionLabel}?该操作会由对应电脑的 boss-agent 本机执行。`)) return;
|
||||
await runMutation(actionLabel, () =>
|
||||
postDeviceCodexRemoteControl(deviceId, {
|
||||
action,
|
||||
reason: `${actionLabel} · enterprise-admin-web`,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
async function createSkillRequest() {
|
||||
await runMutation("创建 Skill 请求", () =>
|
||||
postSkillLifecycleRequest({
|
||||
@@ -776,6 +790,18 @@ onMounted(async () => {
|
||||
<a-table-column title="CLI" data-index="codexCliOnline" />
|
||||
<a-table-column title="项目数" data-index="projectCount" />
|
||||
<a-table-column title="风险" data-index="openRiskCount" />
|
||||
<a-table-column title="Codex 远控">
|
||||
<template #default="{ record }">
|
||||
<a-space>
|
||||
<a-button size="small" :disabled="text(record.status) !== 'online'" @click="handleCodexRemoteControl(record, 'start')">
|
||||
启动远控
|
||||
</a-button>
|
||||
<a-button size="small" :disabled="text(record.status) !== 'online'" @click="handleCodexRemoteControl(record, 'stop')">
|
||||
停止远控
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table-column>
|
||||
</a-table>
|
||||
</a-card>
|
||||
<a-card title="能力分布" :bordered="false">
|
||||
@@ -1061,6 +1087,18 @@ onMounted(async () => {
|
||||
<a-table-column title="控制模式" data-index="preferredExecutionMode" />
|
||||
<a-table-column title="最近心跳" data-index="lastSeenAt" />
|
||||
<a-table-column title="风险" data-index="openRiskCount" />
|
||||
<a-table-column title="Codex 远控">
|
||||
<template #default="{ record }">
|
||||
<a-space>
|
||||
<a-button size="small" :disabled="text(record.status) !== 'online'" @click="handleCodexRemoteControl(record, 'start')">
|
||||
启动远控
|
||||
</a-button>
|
||||
<a-button size="small" :disabled="text(record.status) !== 'online'" @click="handleCodexRemoteControl(record, 'stop')">
|
||||
停止远控
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table-column>
|
||||
</a-table>
|
||||
</a-card>
|
||||
<a-card title="项目线程" :bordered="false">
|
||||
|
||||
@@ -133,6 +133,22 @@ export async function postSkillLifecycleRequest(payload: Record<string, unknown>
|
||||
});
|
||||
}
|
||||
|
||||
export async function postDeviceCodexRemoteControl(
|
||||
deviceId: string,
|
||||
payload: { action: "start" | "stop"; reason?: string },
|
||||
) {
|
||||
return requestJson<Record<string, unknown>>(
|
||||
`/api/v1/devices/${encodeURIComponent(deviceId)}/codex-remote-control`,
|
||||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
...payload,
|
||||
confirmed: true,
|
||||
}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export async function fetchAdminBackups(): Promise<BossAdminBackupsPayload> {
|
||||
return requestJson<BossAdminBackupsPayload>("/api/v1/admin/backups");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user