kokorobox-native 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -36,9 +36,10 @@ The full TypeScript declarations are shipped in
36
36
  | --- | --- |
37
37
  | Capabilities | `getNativeCapabilities` |
38
38
  | Icons | `fileToDataUrl`, `getAppName` |
39
- | Applications | `inspectApplication`, `scanWindowsApplications` |
39
+ | Applications | `inspectApplication`, `scanWindowsApplications`, `findExecutables` |
40
40
  | Rules | `fileToStr` |
41
41
  | Platform | `getLaunchAtLogin`, `setLaunchAtLogin`, `getNetworkContext` |
42
+ | macOS service | `getMacosManagedServiceStatus`, `registerMacosManagedService`, `unregisterMacosManagedService`, `reloadMacosManagedService`, `openMacosLoginItemsSettings` |
42
43
  | Core permissions | `getCorePrivilegeStatus`, `setCorePrivileges` |
43
44
  | Windows | `getCurrentUserSid`, `isRunningAsAdmin`, `runElevated`, `launchElevated`, `launchUnelevated`, `setupFirewallRules` |
44
45
 
@@ -48,6 +49,11 @@ signing identifier on macOS. `scanWindowsApplications` is asynchronous and
48
49
  Windows-only; it accepts an optional result limit and executable-name exclusion
49
50
  list.
50
51
 
52
+ `findExecutables` asynchronously searches absolute additional directories,
53
+ `PATH`, and platform-standard binary locations without spawning command-line
54
+ tools. It returns canonical paths for stable deduplication; prefix matching is
55
+ available only when explicitly requested.
56
+
51
57
  `fileToStr` converts a rule file and returns each generated output keyed by its
52
58
  behavior, metadata for those outputs, and rules that were skipped. Its optional
53
59
  `RuleConvertOptions` accepts Mihomo, General, Egern, and sing-box targets and
@@ -63,6 +69,11 @@ directly from SystemConfiguration without parsing command output.
63
69
  Windows obtains the preferred interface and DNS servers from IP Helper and the
64
70
  SSID from Native Wi-Fi, without spawning PowerShell.
65
71
 
72
+ The macOS managed-service functions accept the basename of an embedded
73
+ LaunchDaemon plist and use `SMAppService` directly. They return an explicit
74
+ `requires-approval` state when an administrator must approve the daemon in
75
+ System Settings.
76
+
66
77
  Core-file privilege APIs are supported on macOS and Linux. They accept only
67
78
  canonical, existing executables named `mihomo` or `mihomo-alpha`; callers cannot
68
79
  use them as a general privileged-command interface. See the repository's
package/index.d.ts CHANGED
@@ -5,15 +5,41 @@ export interface FirewallRule {
5
5
 
6
6
  export interface NativeCapabilities {
7
7
  applicationInspection: boolean;
8
+ executableDiscovery: boolean;
8
9
  windowsApplicationScan: boolean;
9
10
  windowsAccount: boolean;
10
11
  windowsElevation: boolean;
11
12
  windowsFirewall: boolean;
12
13
  launchAtLogin: boolean;
13
14
  networkContext: boolean;
15
+ macosServiceManagement: boolean;
14
16
  coreFilePrivileges: boolean;
15
17
  }
16
18
 
19
+ export interface ExecutableSearchOptions {
20
+ /** Safe executable basenames, without directory components. */
21
+ names: string[];
22
+ /** Absolute directories searched before PATH and platform-standard locations. */
23
+ additionalPaths?: string[];
24
+ /** Also match executable names beginning with a supplied name. */
25
+ matchNamePrefixes?: boolean;
26
+ }
27
+
28
+ export interface ExecutableCandidate {
29
+ /** The discovered path, which may be a symlink. */
30
+ path: string;
31
+ /** The canonical executable path used for deduplication. */
32
+ canonicalPath: string;
33
+ name: string;
34
+ }
35
+
36
+ export type MacOSManagedServiceStatus =
37
+ | "not-registered"
38
+ | "enabled"
39
+ | "requires-approval"
40
+ | "not-found"
41
+ | "unknown";
42
+
17
43
  export interface LaunchAtLoginOptions {
18
44
  /** Stable, filesystem-safe identifier, such as `com.amamiyakokoro.kokorobox`. */
19
45
  identifier: string;
@@ -109,12 +135,19 @@ export function fileToStr(
109
135
  ): RuleStringResult;
110
136
  export function getAppName(path: string): string;
111
137
  export function getNativeCapabilities(): NativeCapabilities;
138
+ export function findExecutables(options: ExecutableSearchOptions): Promise<ExecutableCandidate[]>;
112
139
  export function getLaunchAtLogin(options: LaunchAtLoginOptions): Promise<LaunchAtLoginStatus>;
113
140
  export function setLaunchAtLogin(
114
141
  options: LaunchAtLoginOptions,
115
142
  enabled: boolean,
116
143
  ): Promise<LaunchAtLoginStatus>;
117
144
  export function getNetworkContext(): Promise<NetworkContext>;
145
+ /** Query a LaunchDaemon plist embedded in the calling macOS application. */
146
+ export function getMacosManagedServiceStatus(plistName: string): MacOSManagedServiceStatus;
147
+ export function registerMacosManagedService(plistName: string): MacOSManagedServiceStatus;
148
+ export function unregisterMacosManagedService(plistName: string): MacOSManagedServiceStatus;
149
+ export function reloadMacosManagedService(plistName: string): MacOSManagedServiceStatus;
150
+ export function openMacosLoginItemsSettings(): void;
118
151
  /** Inspect only validated `mihomo` and `mihomo-alpha` executable paths. */
119
152
  export function getCorePrivilegeStatus(paths: string[]): CorePrivilegeStatus[];
120
153
  /** Grant or revoke the constrained Unix core-file privilege. */
package/index.js CHANGED
@@ -81,9 +81,15 @@ export const fileToDataUrl = nativeBinding.fileToDataUrl;
81
81
  export const fileToStr = nativeBinding.fileToStr;
82
82
  export const getAppName = nativeBinding.getAppName;
83
83
  export const getNativeCapabilities = nativeBinding.getNativeCapabilities;
84
+ export const findExecutables = nativeBinding.findExecutables;
84
85
  export const getLaunchAtLogin = nativeBinding.getLaunchAtLogin;
85
86
  export const setLaunchAtLogin = nativeBinding.setLaunchAtLogin;
86
87
  export const getNetworkContext = nativeBinding.getNetworkContext;
88
+ export const getMacosManagedServiceStatus = nativeBinding.getMacosManagedServiceStatus;
89
+ export const registerMacosManagedService = nativeBinding.registerMacosManagedService;
90
+ export const unregisterMacosManagedService = nativeBinding.unregisterMacosManagedService;
91
+ export const reloadMacosManagedService = nativeBinding.reloadMacosManagedService;
92
+ export const openMacosLoginItemsSettings = nativeBinding.openMacosLoginItemsSettings;
87
93
  export const getCorePrivilegeStatus = nativeBinding.getCorePrivilegeStatus;
88
94
  export const setCorePrivileges = nativeBinding.setCorePrivileges;
89
95
  export const inspectApplication = nativeBinding.inspectApplication;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kokorobox-native",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "KokoroBox native bridge",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -47,11 +47,11 @@
47
47
  "access": "public"
48
48
  },
49
49
  "optionalDependencies": {
50
- "kokorobox-native-win32-x64-msvc": "0.6.0",
51
- "kokorobox-native-win32-arm64-msvc": "0.6.0",
52
- "kokorobox-native-darwin-x64": "0.6.0",
53
- "kokorobox-native-darwin-arm64": "0.6.0",
54
- "kokorobox-native-linux-x64-gnu": "0.6.0",
55
- "kokorobox-native-linux-arm64-gnu": "0.6.0"
50
+ "kokorobox-native-win32-x64-msvc": "0.7.0",
51
+ "kokorobox-native-win32-arm64-msvc": "0.7.0",
52
+ "kokorobox-native-darwin-x64": "0.7.0",
53
+ "kokorobox-native-darwin-arm64": "0.7.0",
54
+ "kokorobox-native-linux-x64-gnu": "0.7.0",
55
+ "kokorobox-native-linux-arm64-gnu": "0.7.0"
56
56
  }
57
57
  }