fix: align agent permissions with native app
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
|
||||
import {
|
||||
buildBossAgentStatus,
|
||||
@@ -122,6 +123,10 @@ test("boss-agent status treats token-backed devices as bound and renders enterpr
|
||||
assert.match(html, /完整接管待补齐/);
|
||||
assert.match(html, /一次完整授权/);
|
||||
assert.match(html, /后续静默使用/);
|
||||
assert.match(html, /href="#permissions"><span>本机权限获取<\/span>/);
|
||||
assert.match(html, /href="#skills"><span>Skill<\/span>/);
|
||||
assert.doesNotMatch(html, /<section class="sidebar-card">/);
|
||||
assert.doesNotMatch(html, /<div class="sidebar-title">本机权限获取<\/div>/);
|
||||
assert.match(html, /api\/v1\/boss-agent\/permissions\/open\?target=all/);
|
||||
assert.match(html, /api\/v1\/boss-agent\/permissions\/open\?target=fullDiskAccess/);
|
||||
assert.match(html, /Skill/);
|
||||
@@ -153,3 +158,22 @@ test("boss-agent unbound HTML renders a real scannable QR image when qrcode is a
|
||||
assert.match(html, /data:image\/png;base64/);
|
||||
assert.match(html, /Boss APP 绑定二维码/);
|
||||
});
|
||||
|
||||
test("boss-agent mac app intercepts permission links and triggers native app permission requests", () => {
|
||||
const swiftSource = readFileSync("apps/boss-agent-mac/Sources/BossAgentApp.swift", "utf8");
|
||||
const buildScript = readFileSync("scripts/build-boss-agent-mac-app.sh", "utf8");
|
||||
|
||||
assert.match(swiftSource, /decidePolicyFor navigationAction/);
|
||||
assert.match(swiftSource, /api\/v1\/boss-agent\/permissions\/open/);
|
||||
assert.match(swiftSource, /AXIsProcessTrustedWithOptions/);
|
||||
assert.match(swiftSource, /CGRequestScreenCaptureAccess/);
|
||||
assert.match(swiftSource, /AVCaptureDevice\.requestAccess\(for: \.audio/);
|
||||
assert.match(swiftSource, /AVCaptureDevice\.requestAccess\(for: \.video/);
|
||||
assert.match(swiftSource, /UNUserNotificationCenter\.current\(\)\.requestAuthorization/);
|
||||
assert.match(swiftSource, /CGEvent\.tapCreate/);
|
||||
assert.match(swiftSource, /NSWorkspace\.shared\.open/);
|
||||
assert.match(buildScript, /NSMicrophoneUsageDescription/);
|
||||
assert.match(buildScript, /NSCameraUsageDescription/);
|
||||
assert.match(buildScript, /NSAppleEventsUsageDescription/);
|
||||
assert.match(buildScript, /NSLocalNetworkUsageDescription/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user