fix: sync native agent permission states
This commit is contained in:
@@ -4,6 +4,7 @@ import { readFileSync } from "node:fs";
|
||||
|
||||
import {
|
||||
buildBossAgentStatus,
|
||||
mergeBossAgentNativePermissionOverrides,
|
||||
renderBossAgentHtml,
|
||||
renderBossAgentHtmlWithQr,
|
||||
} from "../local-agent/boss-agent-status.mjs";
|
||||
@@ -169,8 +170,8 @@ test("boss-agent permission and skill menu entries render as separate tab pages"
|
||||
assert.match(permissionsHtml, /<h2>一次完整授权<\/h2>/);
|
||||
assert.match(permissionsHtml, /完整接管待补齐/);
|
||||
assert.match(permissionsHtml, /后续静默使用/);
|
||||
assert.match(permissionsHtml, /api\/v1\/boss-agent\/permissions\/open\?target=all/);
|
||||
assert.match(permissionsHtml, /api\/v1\/boss-agent\/permissions\/open\?target=fullDiskAccess/);
|
||||
assert.match(permissionsHtml, /api\/v1\/boss-agent\/permissions\/open\?target=all&returnTab=permissions/);
|
||||
assert.match(permissionsHtml, /api\/v1\/boss-agent\/permissions\/open\?target=fullDiskAccess&returnTab=permissions/);
|
||||
assert.doesNotMatch(permissionsHtml, /<h2>Skill 部署情况<\/h2>/);
|
||||
|
||||
const skillsHtml = renderBossAgentHtml(status, { activeTab: "skills" });
|
||||
@@ -180,6 +181,33 @@ test("boss-agent permission and skill menu entries render as separate tab pages"
|
||||
assert.doesNotMatch(skillsHtml, /<h2>一次完整授权<\/h2>/);
|
||||
});
|
||||
|
||||
test("boss-agent native permission overrides update app-owned camera and microphone state", () => {
|
||||
const merged = mergeBossAgentNativePermissionOverrides(
|
||||
{
|
||||
accessibility: "missing",
|
||||
screenRecording: "missing",
|
||||
automation: "granted",
|
||||
camera: "unknown",
|
||||
microphone: "unknown",
|
||||
},
|
||||
new URLSearchParams({
|
||||
nativeAccessibility: "granted",
|
||||
nativeCamera: "granted",
|
||||
nativeMicrophone: "missing",
|
||||
nativeScreenRecording: "granted",
|
||||
nativeInputMonitoring: "invalid",
|
||||
}),
|
||||
);
|
||||
|
||||
assert.deepEqual(merged, {
|
||||
accessibility: "granted",
|
||||
screenRecording: "granted",
|
||||
automation: "granted",
|
||||
camera: "granted",
|
||||
microphone: "missing",
|
||||
});
|
||||
});
|
||||
|
||||
test("boss-agent unbound HTML renders a real scannable QR image when qrcode is available", async () => {
|
||||
const status = buildBossAgentStatus(
|
||||
{
|
||||
@@ -215,6 +243,14 @@ test("boss-agent mac app intercepts permission links and triggers native app per
|
||||
assert.match(swiftSource, /UNUserNotificationCenter\.current\(\)\.requestAuthorization/);
|
||||
assert.match(swiftSource, /CGEvent\.tapCreate/);
|
||||
assert.match(swiftSource, /NSWorkspace\.shared\.open/);
|
||||
assert.match(swiftSource, /loadAgentPanel\(tab:/);
|
||||
assert.match(swiftSource, /returnTab/);
|
||||
assert.match(swiftSource, /nativePermissionQueryItems/);
|
||||
assert.match(swiftSource, /nativeCamera/);
|
||||
assert.match(swiftSource, /nativeMicrophone/);
|
||||
assert.match(swiftSource, /AVCaptureDevice\.authorizationStatus\(for: \.video/);
|
||||
assert.match(swiftSource, /AVCaptureDevice\.authorizationStatus\(for: \.audio/);
|
||||
assert.match(swiftSource, /NSApplication\.didBecomeActiveNotification/);
|
||||
assert.match(buildScript, /NSMicrophoneUsageDescription/);
|
||||
assert.match(buildScript, /NSCameraUsageDescription/);
|
||||
assert.match(buildScript, /NSAppleEventsUsageDescription/);
|
||||
|
||||
Reference in New Issue
Block a user