kokorobox-native 0.16.0 → 0.16.2

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
@@ -1,7 +1,7 @@
1
1
  # kokorobox-native
2
2
 
3
- Native Node.js APIs used by KokoroBox Desktop. This package is an ESM loader:
4
- it selects the native binary for the current operating system and architecture.
3
+ Native Node.js APIs used by KokoroBox Desktop. This ESM package selects the
4
+ native binary for the current operating system and architecture.
5
5
 
6
6
  ## Installation
7
7
 
@@ -9,8 +9,8 @@ it selects the native binary for the current operating system and architecture.
9
9
  pnpm add kokorobox-native
10
10
  ```
11
11
 
12
- Prebuilt optional packages are available for x64 and arm64 Windows (MSVC),
13
- macOS, and GNU/Linux. The loader also accepts a development binary through
12
+ Prebuilt optional packages support x64 and arm64 Windows (MSVC), macOS, and
13
+ GNU/Linux. For local development, the loader also accepts
14
14
  `NAPI_RS_NATIVE_LIBRARY_PATH`.
15
15
 
16
16
  ## Usage
@@ -19,146 +19,37 @@ macOS, and GNU/Linux. The loader also accepts a development binary through
19
19
  import {
20
20
  getNativeCapabilities,
21
21
  getNetworkContext,
22
- getTrafficPresenterPath,
23
22
  inspectApplication,
24
23
  } from "kokorobox-native";
25
24
 
26
25
  const capabilities = getNativeCapabilities();
27
26
  const network = await getNetworkContext();
28
27
  const app = await inspectApplication("/Applications/KokoroBox.app");
29
- const presenter = getTrafficPresenterPath();
30
28
  ```
31
29
 
32
- The full TypeScript declarations are shipped in
33
- [`index.d.ts`](index.d.ts).
30
+ Check `getNativeCapabilities()` before using optional platform features.
34
31
 
35
- ## API overview
32
+ ## Diagnostics
36
33
 
37
- | Area | Exports |
38
- | --- | --- |
39
- | Capabilities | `getNativeCapabilities` |
40
- | Traffic presenter | `getTrafficPresenterPath` |
41
- | Icons | `fileToDataUrl`, `getAppName` |
42
- | Applications | `inspectApplication`, `scanWindowsApplications`, `findExecutables` |
43
- | Rules | `fileToStr` |
44
- | Platform | `getLaunchAtLogin`, `setLaunchAtLogin`, `getNetworkContext`, `waitForNetworkContextChange` |
45
- | Service identity | `openServiceIdentity`, `deleteServiceIdentity`, `ServiceIdentity` |
46
- | Linux terminal proxy | `setTerminalProxyEnvironment`, `clearTerminalProxyEnvironment` |
47
- | macOS service | `getMacosManagedServiceStatus`, `registerMacosManagedService`, `unregisterMacosManagedService`, `reloadMacosManagedService`, `openMacosLoginItemsSettings` |
48
- | macOS application routing | `applyMacosApplicationRouting`, `getMacosApplicationRoutingStatus`, `stopMacosApplicationRouting`, `openMacosApplicationRoutingSettings` |
49
- | Core permissions | `getCorePrivilegeStatus`, `setCorePrivileges` |
50
- | Privileged operations | `runServiceLifecycleElevated`, `cleanupLegacyMacosService`, `stopMacosManagedService`, `repairManagedFilePermissions` |
51
- | Windows | `getCurrentUserSid`, `isRunningAsAdmin`, `relaunchCurrentApplicationWithPrivilege`, `ensureKokoroBoxCoreFirewall`, `listUwpLoopbackApps`, `setUwpLoopbackExemption` |
34
+ `drainNativeLogs()` returns English JSON-compatible records with `ts`, `level`,
35
+ `target`, and `msg`. Use one consumer to periodically drain the queue into the
36
+ application's log. It retains at most 500 records; overflow produces a warning.
37
+ `setNativeLogLevel("debug" | "info" | "warn" | "error")` changes recording
38
+ severity (default: `info`). Healthy polling is only recorded at `debug`. Operation failures retain
39
+ their original exceptions and causes; lifecycle successes record the operation
40
+ name without arguments, keys, or signatures.
52
41
 
53
- `inspectApplication` validates the input for the current platform and resolves
54
- it to a routing identifier: an executable path on Windows and Linux, or a code
55
- signing identifier on macOS. `scanWindowsApplications` is asynchronous and
56
- Windows-only; it accepts an optional result limit and executable-name exclusion
57
- list.
42
+ The traffic presenter emits JSON Lines to stderr. The Windows portable updater
43
+ also saves its last run in `%TEMP%/kokorobox-portable-updater.log` because Desktop
44
+ exits before extraction. These sidecars include Unix milliseconds in `timestamp`.
58
45
 
59
- `findExecutables` asynchronously searches absolute additional directories,
60
- `PATH`, and platform-standard binary locations without spawning command-line
61
- tools. It returns canonical paths for stable deduplication; prefix matching is
62
- available only when explicitly requested.
46
+ ## Documentation
63
47
 
64
- `ensureKokoroBoxCoreFirewall` accepts the two Mihomo executable paths and the
65
- KokoroBox application path. Native fixes the three rule names and validates
66
- the executable basenames before changing Windows Firewall state.
48
+ - [JavaScript API guide](../docs/api.md)
49
+ - [TypeScript declarations](index.d.ts)
50
+ - [Platform behavior and security contract](../docs/platform-services.md)
51
+ - [Traffic presenter protocol](../docs/traffic-presenter.md)
52
+ - [Repository layout and build commands](../README.md)
67
53
 
68
- `fileToStr` converts a rule file and returns each generated output keyed by its
69
- behavior, metadata for those outputs, and rules that were skipped. Its optional
70
- `RuleConvertOptions` accepts Mihomo, General, Egern, and sing-box targets and
71
- the formats listed in the TypeScript declaration.
72
-
73
- Launch-at-login requires a stable filesystem-safe `identifier`, a display name,
74
- and an absolute executable path. It returns the selected backend: the Windows
75
- current-user Run key, macOS `SMAppService.mainApp`, or Linux XDG Autostart. On
76
- macOS, `requiresApproval` reports when the entry is registered but still needs
77
- approval in System Settings. Network context is best-effort, so optional fields
78
- such as the default interface and SSID may be absent. macOS obtains this state
79
- directly from SystemConfiguration without parsing command output.
80
- Windows obtains the preferred interface and DNS servers from IP Helper and the
81
- SSID from Native Wi-Fi, without spawning PowerShell.
82
-
83
- `waitForNetworkContextChange(previous, timeoutMs)` resolves with a changed
84
- snapshot or `null` when the timeout expires. `openServiceIdentity()` opens an
85
- opaque Ed25519 signer backed by the platform credential store; its private key
86
- is not returned to JavaScript. Linux can use an explicitly reported protected
87
- file fallback when Secret Service is unavailable.
88
-
89
- On Linux, the terminal proxy functions manage only KokoroBox's user-session
90
- configuration. The set call returns whether the systemd user manager was
91
- updated; clearing returns `null` when no managed file exists. See the
92
- [platform-services contract](../docs/platform-services.md) for the exact path
93
- and return semantics.
94
-
95
- The macOS managed-service functions accept the basename of an embedded
96
- LaunchDaemon plist and use `SMAppService` directly. They return an explicit
97
- `requires-approval` state when an administrator must approve the daemon in
98
- System Settings.
99
-
100
- The macOS application-routing functions run the bounded control plane off the
101
- Node.js main thread. Their typed configuration omits fixed protocol details
102
- such as version, fail-closed behavior, loopback hosts, and reserved ports; the
103
- native layer owns and validates that wire envelope. Packet forwarding continues
104
- to run in the separate System Extension process.
105
-
106
- Core-file privilege APIs are supported on macOS and Linux. They accept only
107
- canonical, existing executables named `mihomo` or `mihomo-alpha`; callers cannot
108
- use them as a general privileged-command interface. See the repository's
109
- [platform-services contract](../docs/platform-services.md) for validation and
110
- platform behavior.
111
-
112
- `getTrafficPresenterPath()` returns the presenter executable shipped in the
113
- same platform package as the loaded native binding. The presenter accepts the
114
- versioned JSON-lines protocol documented by the `traffic-presenter` crate on
115
- standard input and terminates when its parent closes that stream.
116
-
117
- ## Platform behavior
118
-
119
- Use `getNativeCapabilities()` before enabling an optional system feature.
120
- Windows account, elevation, Firewall, and application-scan APIs report an
121
- `UNSUPPORTED_PLATFORM:` error on other operating systems instead of behaving as
122
- no-ops.
123
-
124
- The capability contract includes dedicated flags for APIs that have narrower
125
- support than the package itself:
126
-
127
- | Capability | Supported platforms |
128
- | --- | --- |
129
- | `serviceLifecycle` | Windows, macOS, Linux |
130
- | `managedFilePermissions` | macOS, Linux |
131
- | `windowsPrivilegeRelaunch` | Windows |
132
- | `windowsUwpLoopback` | Windows |
133
- | `linuxTerminalProxy` | Linux |
134
-
135
- Use these flags instead of inferring availability from `process.platform` or
136
- from a related but broader capability.
137
-
138
- `runServiceLifecycleElevated(options)` accepts only the KokoroBox Service
139
- `init`, `install`, `uninstall`, `start`, `stop`, and `restart` actions. macOS
140
- legacy-service cleanup, managed-service stopping, and managed-file permission
141
- repair are separate purpose-specific APIs.
142
-
143
- `relaunchCurrentApplicationWithPrivilege(args, elevated)` starts a new copy of
144
- the current Windows application without accepting an executable path. An
145
- elevated relaunch presents the standard UAC prompt; the unelevated path uses
146
- the interactive desktop shell token. It does not configure persistent
147
- elevation.
148
-
149
- `listUwpLoopbackApps()` reports Windows app containers with an opaque ID,
150
- display metadata, category (`user`, `microsoft`, or `system`), package type,
151
- and exemption status. Pass that ID to `setUwpLoopbackExemption()` to change the
152
- app's loopback exemption.
153
-
154
- ## Contributing
155
-
156
- The source is a three-crate Rust workspace. The root crate implements native
157
- behavior, `napi/` maps it into this package’s JavaScript API, and
158
- `traffic-presenter/` builds the sidecar. See the root
159
- [README](../README.md#repository-structure) for the complete layout and build
160
- commands.
161
-
162
- This project is derived from
163
- [`UruhaLushia/sparkle-native`](https://github.com/UruhaLushia/sparkle-native)
164
- and is licensed under GPL-3.0-only.
54
+ Derived from [UruhaLushia/sparkle-native](https://github.com/UruhaLushia/sparkle-native)
55
+ and licensed under GPL-3.0-only.
package/diagnostics.js ADDED
@@ -0,0 +1,125 @@
1
+ // Diagnostics belong to the calling application. Do not open a log file or
2
+ // retain operation arguments (which may contain keys or signatures).
3
+ const maxEntries = 500;
4
+ const maxMessageLength = 4096;
5
+ const levels = ["debug", "info", "warn", "error"];
6
+ const lifecycleOperations = new Set([
7
+ "runServiceLifecycleElevated",
8
+ "registerMacosManagedService",
9
+ "unregisterMacosManagedService",
10
+ "reloadMacosManagedService",
11
+ "cleanupLegacyMacosService",
12
+ "stopMacosManagedService",
13
+ "repairManagedFilePermissions",
14
+ "setCorePrivileges",
15
+ "applyMacosApplicationRouting",
16
+ "stopMacosApplicationRouting",
17
+ "setLaunchAtLogin",
18
+ "setUwpLoopbackExemption",
19
+ ]);
20
+
21
+ function boundedMessage(value) {
22
+ const text = String(value);
23
+ if (text.length <= maxMessageLength) return text;
24
+ let end = maxMessageLength;
25
+ if (/^[\uDC00-\uDFFF]$/.test(text[end])) end--;
26
+ return text.slice(0, end) + "…";
27
+ }
28
+
29
+ export function nativeErrorMessage(error) {
30
+ const parts = [];
31
+ const seen = new Set();
32
+ function visit(value, depth = 0) {
33
+ if (depth > 4 || seen.has(value)) return;
34
+ seen.add(value);
35
+ const message = value instanceof Error ? value.message : String(value);
36
+ if (message && !parts.includes(message))
37
+ parts.push(boundedMessage(message));
38
+ if (value && typeof value === "object" && value.cause != null) {
39
+ if (Array.isArray(value.cause))
40
+ value.cause.slice(0, 4).forEach((item) => visit(item, depth + 1));
41
+ else visit(value.cause, depth + 1);
42
+ }
43
+ }
44
+ visit(error);
45
+ return boundedMessage(parts.join(": "));
46
+ }
47
+
48
+ export function createNativeDiagnostics() {
49
+ let minimum = "info";
50
+ let entries = [];
51
+ let dropped = 0;
52
+ const record = (level, target, msg) => {
53
+ if (levels.indexOf(level) < levels.indexOf(minimum)) return;
54
+ entries.push({
55
+ ts: new Date().toISOString(),
56
+ level,
57
+ target,
58
+ msg: boundedMessage(msg),
59
+ });
60
+ if (entries.length > maxEntries) {
61
+ entries.shift();
62
+ dropped++;
63
+ }
64
+ };
65
+ return {
66
+ setLevel(level) {
67
+ if (!levels.includes(level))
68
+ throw new TypeError(
69
+ "Invalid Native log level: expected debug, info, warn, or error",
70
+ );
71
+ minimum = level;
72
+ },
73
+ drain() {
74
+ const result = entries;
75
+ entries = [];
76
+ if (dropped) {
77
+ result.unshift({
78
+ ts: new Date().toISOString(),
79
+ level: "warn",
80
+ target: "diagnostics",
81
+ msg: `Dropped ${dropped} older Native log entries`,
82
+ });
83
+ dropped = 0;
84
+ }
85
+ return result;
86
+ },
87
+ wrap(target, operation) {
88
+ if (typeof operation !== "function") return operation;
89
+ const failed = (error) => {
90
+ record("error", target, nativeErrorMessage(error));
91
+ throw error;
92
+ };
93
+ const completed = (value) => {
94
+ if (value && value.state === "error")
95
+ record(
96
+ "error",
97
+ target,
98
+ typeof value.message === "string"
99
+ ? value.message
100
+ : "Native operation returned an error status",
101
+ );
102
+ else if (lifecycleOperations.has(target))
103
+ record("info", target, "Native operation completed");
104
+ else record("debug", target, "Native operation completed");
105
+ return value;
106
+ };
107
+ return function (...args) {
108
+ let result;
109
+ try {
110
+ result = Reflect.apply(operation, this, args);
111
+ } catch (error) {
112
+ return failed(error);
113
+ }
114
+ if (result && typeof result.then === "function")
115
+ return result.then(completed, failed);
116
+ return completed(result);
117
+ };
118
+ },
119
+ };
120
+ }
121
+
122
+ const diagnostics = createNativeDiagnostics();
123
+ export const wrapNativeOperation = diagnostics.wrap;
124
+ export const drainNativeLogs = diagnostics.drain;
125
+ export const setNativeLogLevel = diagnostics.setLevel;
package/index.d.ts CHANGED
@@ -1,3 +1,14 @@
1
+ export interface NativeLogEntry {
2
+ ts: string;
3
+ level: "debug" | "info" | "warn" | "error";
4
+ target: string;
5
+ msg: string;
6
+ }
7
+ /** Drains at most 500 entries and an optional overflow warning; use one consumer. */
8
+ export declare function drainNativeLogs(): NativeLogEntry[];
9
+ /** Controls recording, independently from display language. Defaults to info. */
10
+ export declare function setNativeLogLevel(level: NativeLogEntry["level"]): void;
11
+
1
12
  export interface UwpLoopbackApp {
2
13
  /** Opaque identifier used only when changing this app's loopback exemption. */
3
14
  id: string;
package/index.js CHANGED
@@ -5,6 +5,13 @@
5
5
  import { existsSync } from 'node:fs'
6
6
  import { dirname, join } from "node:path";
7
7
  import { createRequire } from "node:module";
8
+ import {
9
+ nativeErrorMessage,
10
+ wrapNativeOperation,
11
+ drainNativeLogs,
12
+ setNativeLogLevel,
13
+ } from "./diagnostics.js";
14
+ export { drainNativeLogs, setNativeLogLevel };
8
15
 
9
16
  const require = createRequire(import.meta.url);
10
17
  const __dirname = new URL(".", import.meta.url).pathname.replace(
@@ -71,7 +78,9 @@ export function getPortableUpdaterPath() {
71
78
  const packagedPath = join(dirname(packageEntry), filename);
72
79
  if (existsSync(packagedPath)) return packagedPath;
73
80
  }
74
- throw new Error(`Portable updater is missing for ${process.platform} ${process.arch}`);
81
+ throw new Error(
82
+ `Portable updater is missing for ${process.platform} ${process.arch}`,
83
+ );
75
84
  }
76
85
 
77
86
  function requireNative() {
@@ -105,49 +114,88 @@ function requireNative() {
105
114
  const nativeBinding = requireNative();
106
115
 
107
116
  if (!nativeBinding) {
108
- const error = new Error("Failed to load kokorobox-native binding");
117
+ const detail = nativeErrorMessage({
118
+ cause: loadErrors,
119
+ toString: () => "Failed to load kokorobox-native binding",
120
+ });
121
+ const error = new Error(detail);
109
122
  error.cause = loadErrors;
110
123
  throw error;
111
124
  }
112
125
 
113
- export default nativeBinding;
114
- export const fileToDataUrl = nativeBinding.fileToDataUrl;
115
- export const fileToStr = nativeBinding.fileToStr;
116
- export const getAppName = nativeBinding.getAppName;
117
- export const getNativeCapabilities = nativeBinding.getNativeCapabilities;
118
- export const getWindowsServiceStatus = nativeBinding.getWindowsServiceStatus;
119
- export const getLinuxServiceStatus = nativeBinding.getLinuxServiceStatus;
120
- export const setTerminalProxyEnvironment = nativeBinding.setTerminalProxyEnvironment;
121
- export const clearTerminalProxyEnvironment = nativeBinding.clearTerminalProxyEnvironment;
122
- export const findExecutables = nativeBinding.findExecutables;
123
- export const getLaunchAtLogin = nativeBinding.getLaunchAtLogin;
124
- export const setLaunchAtLogin = nativeBinding.setLaunchAtLogin;
125
- export const getNetworkContext = nativeBinding.getNetworkContext;
126
- export const waitForNetworkContextChange = nativeBinding.waitForNetworkContextChange;
127
- export const getMacosManagedServiceStatus = nativeBinding.getMacosManagedServiceStatus;
128
- export const getMacosServiceProcessStatus = nativeBinding.getMacosServiceProcessStatus;
129
- export const registerMacosManagedService = nativeBinding.registerMacosManagedService;
130
- export const unregisterMacosManagedService = nativeBinding.unregisterMacosManagedService;
131
- export const reloadMacosManagedService = nativeBinding.reloadMacosManagedService;
132
- export const openMacosLoginItemsSettings = nativeBinding.openMacosLoginItemsSettings;
133
- export const applyMacosApplicationRouting = nativeBinding.applyMacosApplicationRouting;
134
- export const getMacosApplicationRoutingStatus = nativeBinding.getMacosApplicationRoutingStatus;
135
- export const stopMacosApplicationRouting = nativeBinding.stopMacosApplicationRouting;
136
- export const openMacosApplicationRoutingSettings = nativeBinding.openMacosApplicationRoutingSettings;
137
- export const runServiceLifecycleElevated = nativeBinding.runServiceLifecycleElevated;
138
- export const cleanupLegacyMacosService = nativeBinding.cleanupLegacyMacosService;
139
- export const stopMacosManagedService = nativeBinding.stopMacosManagedService;
140
- export const repairManagedFilePermissions = nativeBinding.repairManagedFilePermissions;
141
- export const relaunchCurrentApplicationWithPrivilege = nativeBinding.relaunchCurrentApplicationWithPrivilege;
142
- export const getCorePrivilegeStatus = nativeBinding.getCorePrivilegeStatus;
143
- export const setCorePrivileges = nativeBinding.setCorePrivileges;
144
- export const inspectApplication = nativeBinding.inspectApplication;
145
- export const scanWindowsApplications = nativeBinding.scanWindowsApplications;
146
- export const getCurrentUserSid = nativeBinding.getCurrentUserSid;
147
- export const isRunningAsAdmin = nativeBinding.isRunningAsAdmin;
148
- export const ensureKokoroBoxCoreFirewall = nativeBinding.ensureKokoroBoxCoreFirewall;
149
- export const listUwpLoopbackApps = nativeBinding.listUwpLoopbackApps;
150
- export const setUwpLoopbackExemption = nativeBinding.setUwpLoopbackExemption;
151
- export const ServiceIdentity = nativeBinding.ServiceIdentity;
152
- export const openServiceIdentity = nativeBinding.openServiceIdentity;
153
- export const deleteServiceIdentity = nativeBinding.deleteServiceIdentity;
126
+ // Preserve native classes and unsupported exports; wrap callable operations
127
+ // for both named imports and the default binding without changing arguments.
128
+ const diagnosticBinding = {};
129
+ for (const [name, descriptor] of Object.entries(
130
+ Object.getOwnPropertyDescriptors(nativeBinding),
131
+ )) {
132
+ if (/^[a-z]/.test(name) && typeof descriptor.value === "function") {
133
+ descriptor.value = wrapNativeOperation(name, descriptor.value);
134
+ }
135
+ Object.defineProperty(diagnosticBinding, name, descriptor);
136
+ }
137
+ diagnosticBinding.drainNativeLogs = drainNativeLogs;
138
+ diagnosticBinding.setNativeLogLevel = setNativeLogLevel;
139
+ export default diagnosticBinding;
140
+ export const fileToDataUrl = diagnosticBinding.fileToDataUrl;
141
+ export const fileToStr = diagnosticBinding.fileToStr;
142
+ export const getAppName = diagnosticBinding.getAppName;
143
+ export const getNativeCapabilities = diagnosticBinding.getNativeCapabilities;
144
+ export const getWindowsServiceStatus =
145
+ diagnosticBinding.getWindowsServiceStatus;
146
+ export const getLinuxServiceStatus = diagnosticBinding.getLinuxServiceStatus;
147
+ export const setTerminalProxyEnvironment =
148
+ diagnosticBinding.setTerminalProxyEnvironment;
149
+ export const clearTerminalProxyEnvironment =
150
+ diagnosticBinding.clearTerminalProxyEnvironment;
151
+ export const findExecutables = diagnosticBinding.findExecutables;
152
+ export const getLaunchAtLogin = diagnosticBinding.getLaunchAtLogin;
153
+ export const setLaunchAtLogin = diagnosticBinding.setLaunchAtLogin;
154
+ export const getNetworkContext = diagnosticBinding.getNetworkContext;
155
+ export const waitForNetworkContextChange =
156
+ diagnosticBinding.waitForNetworkContextChange;
157
+ export const getMacosManagedServiceStatus =
158
+ diagnosticBinding.getMacosManagedServiceStatus;
159
+ export const getMacosServiceProcessStatus =
160
+ diagnosticBinding.getMacosServiceProcessStatus;
161
+ export const registerMacosManagedService =
162
+ diagnosticBinding.registerMacosManagedService;
163
+ export const unregisterMacosManagedService =
164
+ diagnosticBinding.unregisterMacosManagedService;
165
+ export const reloadMacosManagedService =
166
+ diagnosticBinding.reloadMacosManagedService;
167
+ export const openMacosLoginItemsSettings =
168
+ diagnosticBinding.openMacosLoginItemsSettings;
169
+ export const applyMacosApplicationRouting =
170
+ diagnosticBinding.applyMacosApplicationRouting;
171
+ export const getMacosApplicationRoutingStatus =
172
+ diagnosticBinding.getMacosApplicationRoutingStatus;
173
+ export const stopMacosApplicationRouting =
174
+ diagnosticBinding.stopMacosApplicationRouting;
175
+ export const openMacosApplicationRoutingSettings =
176
+ diagnosticBinding.openMacosApplicationRoutingSettings;
177
+ export const runServiceLifecycleElevated =
178
+ diagnosticBinding.runServiceLifecycleElevated;
179
+ export const cleanupLegacyMacosService =
180
+ diagnosticBinding.cleanupLegacyMacosService;
181
+ export const stopMacosManagedService =
182
+ diagnosticBinding.stopMacosManagedService;
183
+ export const repairManagedFilePermissions =
184
+ diagnosticBinding.repairManagedFilePermissions;
185
+ export const relaunchCurrentApplicationWithPrivilege =
186
+ diagnosticBinding.relaunchCurrentApplicationWithPrivilege;
187
+ export const getCorePrivilegeStatus = diagnosticBinding.getCorePrivilegeStatus;
188
+ export const setCorePrivileges = diagnosticBinding.setCorePrivileges;
189
+ export const inspectApplication = diagnosticBinding.inspectApplication;
190
+ export const scanWindowsApplications =
191
+ diagnosticBinding.scanWindowsApplications;
192
+ export const getCurrentUserSid = diagnosticBinding.getCurrentUserSid;
193
+ export const isRunningAsAdmin = diagnosticBinding.isRunningAsAdmin;
194
+ export const ensureKokoroBoxCoreFirewall =
195
+ diagnosticBinding.ensureKokoroBoxCoreFirewall;
196
+ export const listUwpLoopbackApps = diagnosticBinding.listUwpLoopbackApps;
197
+ export const setUwpLoopbackExemption =
198
+ diagnosticBinding.setUwpLoopbackExemption;
199
+ export const ServiceIdentity = diagnosticBinding.ServiceIdentity;
200
+ export const openServiceIdentity = diagnosticBinding.openServiceIdentity;
201
+ export const deleteServiceIdentity = diagnosticBinding.deleteServiceIdentity;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kokorobox-native",
3
- "version": "0.16.0",
3
+ "version": "0.16.2",
4
4
  "description": "KokoroBox native bridge",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -17,6 +17,7 @@
17
17
  "license": "GPL-3.0-only",
18
18
  "files": [
19
19
  "index.js",
20
+ "diagnostics.js",
20
21
  "index.d.ts",
21
22
  "README.md"
22
23
  ],
@@ -32,6 +33,7 @@
32
33
  ]
33
34
  },
34
35
  "scripts": {
36
+ "test:logs": "node --test tests/diagnostics.test.mjs",
35
37
  "build": "napi build --platform --release --strip --no-js --dts napi.generated.d.ts",
36
38
  "build:debug": "napi build --platform --no-js --dts napi.generated.d.ts",
37
39
  "create-npm-dirs": "napi create-npm-dirs",
@@ -48,11 +50,11 @@
48
50
  "access": "public"
49
51
  },
50
52
  "optionalDependencies": {
51
- "kokorobox-native-win32-x64-msvc": "0.16.0",
52
- "kokorobox-native-win32-arm64-msvc": "0.16.0",
53
- "kokorobox-native-darwin-x64": "0.16.0",
54
- "kokorobox-native-darwin-arm64": "0.16.0",
55
- "kokorobox-native-linux-x64-gnu": "0.16.0",
56
- "kokorobox-native-linux-arm64-gnu": "0.16.0"
53
+ "kokorobox-native-win32-x64-msvc": "0.16.2",
54
+ "kokorobox-native-win32-arm64-msvc": "0.16.2",
55
+ "kokorobox-native-darwin-x64": "0.16.2",
56
+ "kokorobox-native-darwin-arm64": "0.16.2",
57
+ "kokorobox-native-linux-x64-gnu": "0.16.2",
58
+ "kokorobox-native-linux-arm64-gnu": "0.16.2"
57
59
  }
58
60
  }