feat: sync project understanding for imported devices
This commit is contained in:
@@ -399,6 +399,10 @@ public class BossApiClient {
|
||||
return requestWithRestore("POST", "/api/v1/devices/" + encode(deviceId) + "/import-draft/apply", new JSONObject());
|
||||
}
|
||||
|
||||
public ApiResponse syncDeviceProjectUnderstanding(String deviceId) throws IOException, JSONException {
|
||||
return requestWithRestore("POST", "/api/v1/devices/" + encode(deviceId) + "/project-understanding-sync", new JSONObject());
|
||||
}
|
||||
|
||||
public ApiResponse getAccounts() throws IOException, JSONException {
|
||||
return requestWithRestore("GET", "/api/v1/accounts", null);
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ public class DeviceDetailActivity extends BossScreenActivity {
|
||||
));
|
||||
}
|
||||
appendContent(BossUi.buildMenuRow(this, "导入项目", "勾选这台设备上要暴露到会话首页的项目和线程", null, v -> openImportDraft()));
|
||||
appendContent(BossUi.buildMenuRow(this, "同步项目理解", "让主 Agent 主动询问这台设备上的活跃项目目标、进度和架构", null, v -> syncProjectUnderstanding()));
|
||||
appendContent(BossUi.buildMenuRow(this, "查看技能", "查看当前设备同步的 Skill 清单", null, v -> openSkills()));
|
||||
setRefreshing(false);
|
||||
}
|
||||
@@ -93,6 +94,33 @@ public class DeviceDetailActivity extends BossScreenActivity {
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
private void syncProjectUnderstanding() {
|
||||
setRefreshing(true);
|
||||
executor.execute(() -> {
|
||||
try {
|
||||
BossApiClient.ApiResponse response = apiClient.syncDeviceProjectUnderstanding(deviceId);
|
||||
if (!response.ok()) throw new IllegalStateException(response.message());
|
||||
JSONObject payload = response.json;
|
||||
JSONArray queuedTasks = payload.optJSONArray("queuedTasks");
|
||||
int queuedCount = queuedTasks == null ? 0 : queuedTasks.length();
|
||||
runOnUiThread(() -> {
|
||||
setRefreshing(false);
|
||||
if (queuedCount <= 0) {
|
||||
showMessage("当前设备没有可同步的活跃线程。");
|
||||
} else {
|
||||
showMessage("主 Agent 已开始同步 " + queuedCount + " 个项目理解。");
|
||||
}
|
||||
reload();
|
||||
});
|
||||
} catch (Exception error) {
|
||||
runOnUiThread(() -> {
|
||||
setRefreshing(false);
|
||||
showMessage("同步失败:" + error.getMessage());
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void openEditDialog() {
|
||||
executor.execute(() -> {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user