kokorobox-native 0.11.1 → 0.12.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
@@ -43,7 +43,7 @@ The full TypeScript declarations are shipped in
43
43
  | Rules | `fileToStr` |
44
44
  | Platform | `getLaunchAtLogin`, `setLaunchAtLogin`, `getNetworkContext` |
45
45
  | macOS service | `getMacosManagedServiceStatus`, `registerMacosManagedService`, `unregisterMacosManagedService`, `reloadMacosManagedService`, `openMacosLoginItemsSettings` |
46
- | macOS application routing | `invokeMacosApplicationRouting` |
46
+ | macOS application routing | `applyMacosApplicationRouting`, `getMacosApplicationRoutingStatus`, `stopMacosApplicationRouting`, `openMacosApplicationRoutingSettings` |
47
47
  | Core permissions | `getCorePrivilegeStatus`, `setCorePrivileges` |
48
48
  | Privileged operations | `runServiceLifecycleElevated`, `cleanupLegacyMacosService`, `stopMacosManagedService`, `repairManagedFilePermissions` |
49
49
  | Windows | `getCurrentUserSid`, `isRunningAsAdmin`, `relaunchCurrentApplicationWithPrivilege`, `setupFirewallRules` |
@@ -79,10 +79,11 @@ LaunchDaemon plist and use `SMAppService` directly. They return an explicit
79
79
  `requires-approval` state when an administrator must approve the daemon in
80
80
  System Settings.
81
81
 
82
- `invokeMacosApplicationRouting(request)` runs the bounded, versioned macOS
83
- application-routing control-plane protocol off the Node.js main thread. It
84
- controls the bundled System Extension and Network Extension; packet forwarding
85
- continues to run in the separate extension process.
82
+ The macOS application-routing functions run the bounded control plane off the
83
+ Node.js main thread. Their typed configuration omits fixed protocol details
84
+ such as version, fail-closed behavior, loopback hosts, and reserved ports; the
85
+ native layer owns and validates that wire envelope. Packet forwarding continues
86
+ to run in the separate System Extension process.
86
87
 
87
88
  Core-file privilege APIs are supported on macOS and Linux. They accept only
88
89
  canonical, existing executables named `mihomo` or `mihomo-alpha`; callers cannot
@@ -102,6 +103,20 @@ Windows account, elevation, Firewall, and application-scan APIs report an
102
103
  `UNSUPPORTED_PLATFORM:` error on other operating systems instead of behaving as
103
104
  no-ops.
104
105
 
106
+ The capability contract includes dedicated flags for APIs that have narrower
107
+ support than the package itself:
108
+
109
+ | Capability | Supported platforms |
110
+ | --- | --- |
111
+ | `networkDnsMutation` | macOS |
112
+ | `serviceLifecycle` | Windows, macOS, Linux |
113
+ | `managedFilePermissions` | macOS, Linux |
114
+ | `windowsPrivilegeRelaunch` | Windows |
115
+ | `windowsUwpLoopback` | Windows |
116
+
117
+ Use these flags instead of inferring availability from `process.platform` or
118
+ from a related but broader capability.
119
+
105
120
  `runServiceLifecycleElevated(options)` accepts only the KokoroBox Service
106
121
  `init`, `install`, `uninstall`, `start`, `stop`, and `restart` actions. macOS
107
122
  legacy-service cleanup, managed-service stopping, and managed-file permission
package/index.d.ts CHANGED
@@ -20,8 +20,13 @@ export interface NativeCapabilities {
20
20
  launchAtLogin: boolean;
21
21
  networkContext: boolean;
22
22
  networkMonitor: boolean;
23
+ networkDnsMutation: boolean;
24
+ serviceLifecycle: boolean;
25
+ managedFilePermissions: boolean;
23
26
  macosServiceManagement: boolean;
24
27
  macosApplicationRouting: boolean;
28
+ windowsPrivilegeRelaunch: boolean;
29
+ windowsUwpLoopback: boolean;
25
30
  coreFilePrivileges: boolean;
26
31
  serviceIdentity: boolean;
27
32
  }
@@ -205,8 +210,41 @@ export function registerMacosManagedService(plistName: string): MacOSManagedServ
205
210
  export function unregisterMacosManagedService(plistName: string): MacOSManagedServiceStatus;
206
211
  export function reloadMacosManagedService(plistName: string): MacOSManagedServiceStatus;
207
212
  export function openMacosLoginItemsSettings(): void;
208
- /** Invoke the versioned macOS Network/System Extension control-plane protocol. */
209
- export function invokeMacosApplicationRouting(request: string): Promise<string>;
213
+ export type MacosApplicationRoutingIdentifierKind = "SIGNING_IDENTIFIER" | "PROCESS_NAME";
214
+ export type MacosApplicationRoutingProtocol = "TCP" | "UDP" | "BOTH";
215
+ export type MacosApplicationRoutingAction = "PROXY" | "DIRECT" | "BLOCK";
216
+ export type MacosApplicationRoutingState =
217
+ | "disabled"
218
+ | "starting"
219
+ | "running"
220
+ | "stopping"
221
+ | "error";
222
+ export interface MacosApplicationRoutingRule {
223
+ signingIdentifier: string;
224
+ identifierKind: MacosApplicationRoutingIdentifierKind;
225
+ ruleProtocol: MacosApplicationRoutingProtocol;
226
+ action: MacosApplicationRoutingAction;
227
+ enabled: boolean;
228
+ priority: number;
229
+ }
230
+ export interface MacosApplicationRoutingConfiguration {
231
+ proxyAvailable: boolean;
232
+ proxyUdpDns: boolean;
233
+ diagnosticLogging: boolean;
234
+ rules: MacosApplicationRoutingRule[];
235
+ }
236
+ export interface MacosApplicationRoutingStatus {
237
+ state: MacosApplicationRoutingState;
238
+ needsUserApproval: boolean;
239
+ message?: string;
240
+ }
241
+ /** Apply a bounded policy through the macOS Network/System Extension control plane. */
242
+ export function applyMacosApplicationRouting(
243
+ configuration: MacosApplicationRoutingConfiguration,
244
+ ): Promise<MacosApplicationRoutingStatus>;
245
+ export function getMacosApplicationRoutingStatus(): Promise<MacosApplicationRoutingStatus>;
246
+ export function stopMacosApplicationRouting(): Promise<MacosApplicationRoutingStatus>;
247
+ export function openMacosApplicationRoutingSettings(): Promise<MacosApplicationRoutingStatus>;
210
248
  export type ServiceLifecycleAction =
211
249
  | "init"
212
250
  | "install"
package/index.js CHANGED
@@ -111,7 +111,10 @@ export const registerMacosManagedService = nativeBinding.registerMacosManagedSer
111
111
  export const unregisterMacosManagedService = nativeBinding.unregisterMacosManagedService;
112
112
  export const reloadMacosManagedService = nativeBinding.reloadMacosManagedService;
113
113
  export const openMacosLoginItemsSettings = nativeBinding.openMacosLoginItemsSettings;
114
- export const invokeMacosApplicationRouting = nativeBinding.invokeMacosApplicationRouting;
114
+ export const applyMacosApplicationRouting = nativeBinding.applyMacosApplicationRouting;
115
+ export const getMacosApplicationRoutingStatus = nativeBinding.getMacosApplicationRoutingStatus;
116
+ export const stopMacosApplicationRouting = nativeBinding.stopMacosApplicationRouting;
117
+ export const openMacosApplicationRoutingSettings = nativeBinding.openMacosApplicationRoutingSettings;
115
118
  export const runServiceLifecycleElevated = nativeBinding.runServiceLifecycleElevated;
116
119
  export const cleanupLegacyMacosService = nativeBinding.cleanupLegacyMacosService;
117
120
  export const stopMacosManagedService = nativeBinding.stopMacosManagedService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kokorobox-native",
3
- "version": "0.11.1",
3
+ "version": "0.12.0",
4
4
  "description": "KokoroBox native bridge",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -48,11 +48,11 @@
48
48
  "access": "public"
49
49
  },
50
50
  "optionalDependencies": {
51
- "kokorobox-native-win32-x64-msvc": "0.11.1",
52
- "kokorobox-native-win32-arm64-msvc": "0.11.1",
53
- "kokorobox-native-darwin-x64": "0.11.1",
54
- "kokorobox-native-darwin-arm64": "0.11.1",
55
- "kokorobox-native-linux-x64-gnu": "0.11.1",
56
- "kokorobox-native-linux-arm64-gnu": "0.11.1"
51
+ "kokorobox-native-win32-x64-msvc": "0.12.0",
52
+ "kokorobox-native-win32-arm64-msvc": "0.12.0",
53
+ "kokorobox-native-darwin-x64": "0.12.0",
54
+ "kokorobox-native-darwin-arm64": "0.12.0",
55
+ "kokorobox-native-linux-x64-gnu": "0.12.0",
56
+ "kokorobox-native-linux-arm64-gnu": "0.12.0"
57
57
  }
58
58
  }