kokorobox-native 0.14.0 → 0.16.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 +25 -4
- package/index.d.ts +21 -3
- package/index.js +18 -0
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -41,12 +41,14 @@ The full TypeScript declarations are shipped in
|
|
|
41
41
|
| Icons | `fileToDataUrl`, `getAppName` |
|
|
42
42
|
| Applications | `inspectApplication`, `scanWindowsApplications`, `findExecutables` |
|
|
43
43
|
| Rules | `fileToStr` |
|
|
44
|
-
| Platform | `getLaunchAtLogin`, `setLaunchAtLogin`, `getNetworkContext` |
|
|
44
|
+
| Platform | `getLaunchAtLogin`, `setLaunchAtLogin`, `getNetworkContext`, `waitForNetworkContextChange` |
|
|
45
|
+
| Service identity | `openServiceIdentity`, `deleteServiceIdentity`, `ServiceIdentity` |
|
|
46
|
+
| Linux terminal proxy | `setTerminalProxyEnvironment`, `clearTerminalProxyEnvironment` |
|
|
45
47
|
| macOS service | `getMacosManagedServiceStatus`, `registerMacosManagedService`, `unregisterMacosManagedService`, `reloadMacosManagedService`, `openMacosLoginItemsSettings` |
|
|
46
48
|
| macOS application routing | `applyMacosApplicationRouting`, `getMacosApplicationRoutingStatus`, `stopMacosApplicationRouting`, `openMacosApplicationRoutingSettings` |
|
|
47
49
|
| Core permissions | `getCorePrivilegeStatus`, `setCorePrivileges` |
|
|
48
50
|
| Privileged operations | `runServiceLifecycleElevated`, `cleanupLegacyMacosService`, `stopMacosManagedService`, `repairManagedFilePermissions` |
|
|
49
|
-
| Windows | `getCurrentUserSid`, `isRunningAsAdmin`, `relaunchCurrentApplicationWithPrivilege`, `ensureKokoroBoxCoreFirewall` |
|
|
51
|
+
| Windows | `getCurrentUserSid`, `isRunningAsAdmin`, `relaunchCurrentApplicationWithPrivilege`, `ensureKokoroBoxCoreFirewall`, `listUwpLoopbackApps`, `setUwpLoopbackExemption` |
|
|
50
52
|
|
|
51
53
|
`inspectApplication` validates the input for the current platform and resolves
|
|
52
54
|
it to a routing identifier: an executable path on Windows and Linux, or a code
|
|
@@ -78,6 +80,18 @@ directly from SystemConfiguration without parsing command output.
|
|
|
78
80
|
Windows obtains the preferred interface and DNS servers from IP Helper and the
|
|
79
81
|
SSID from Native Wi-Fi, without spawning PowerShell.
|
|
80
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
|
+
|
|
81
95
|
The macOS managed-service functions accept the basename of an embedded
|
|
82
96
|
LaunchDaemon plist and use `SMAppService` directly. They return an explicit
|
|
83
97
|
`requires-approval` state when an administrator must approve the daemon in
|
|
@@ -116,6 +130,7 @@ support than the package itself:
|
|
|
116
130
|
| `managedFilePermissions` | macOS, Linux |
|
|
117
131
|
| `windowsPrivilegeRelaunch` | Windows |
|
|
118
132
|
| `windowsUwpLoopback` | Windows |
|
|
133
|
+
| `linuxTerminalProxy` | Linux |
|
|
119
134
|
|
|
120
135
|
Use these flags instead of inferring availability from `process.platform` or
|
|
121
136
|
from a related but broader capability.
|
|
@@ -131,10 +146,16 @@ elevated relaunch presents the standard UAC prompt; the unelevated path uses
|
|
|
131
146
|
the interactive desktop shell token. It does not configure persistent
|
|
132
147
|
elevation.
|
|
133
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
|
+
|
|
134
154
|
## Contributing
|
|
135
155
|
|
|
136
|
-
The source is a
|
|
137
|
-
behavior
|
|
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
|
|
138
159
|
[README](../README.md#repository-structure) for the complete layout and build
|
|
139
160
|
commands.
|
|
140
161
|
|
package/index.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
export interface UwpLoopbackApp {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/** Opaque identifier used only when changing this app's loopback exemption. */
|
|
3
|
+
id: string;
|
|
4
|
+
packageFamilyName: string;
|
|
5
|
+
packageFullName?: string;
|
|
4
6
|
displayName: string;
|
|
7
|
+
description?: string;
|
|
5
8
|
enabled: boolean;
|
|
9
|
+
category: "user" | "microsoft" | "system";
|
|
10
|
+
packageType?: "main" | "framework" | "resource" | "optional";
|
|
11
|
+
framework: boolean;
|
|
12
|
+
resourcePackage: boolean;
|
|
6
13
|
}
|
|
7
14
|
|
|
8
15
|
export interface NativeCapabilities {
|
|
@@ -18,12 +25,15 @@ export interface NativeCapabilities {
|
|
|
18
25
|
serviceLifecycle: boolean;
|
|
19
26
|
managedFilePermissions: boolean;
|
|
20
27
|
macosServiceManagement: boolean;
|
|
28
|
+
macosServiceProcessStatus: boolean;
|
|
21
29
|
macosApplicationRouting: boolean;
|
|
22
30
|
windowsPrivilegeRelaunch: boolean;
|
|
23
31
|
windowsUwpLoopback: boolean;
|
|
32
|
+
windowsServiceStatus: boolean;
|
|
24
33
|
coreFilePrivileges: boolean;
|
|
25
34
|
serviceIdentity: boolean;
|
|
26
35
|
linuxTerminalProxy: boolean;
|
|
36
|
+
linuxServiceStatus: boolean;
|
|
27
37
|
}
|
|
28
38
|
|
|
29
39
|
export interface ExecutableSearchOptions {
|
|
@@ -183,12 +193,18 @@ export function fileToStr(
|
|
|
183
193
|
): RuleStringResult;
|
|
184
194
|
export function getAppName(path: string): string;
|
|
185
195
|
export function getNativeCapabilities(): NativeCapabilities;
|
|
196
|
+
/** Read-only status of KokoroBoxService from the Windows Service Control Manager. */
|
|
197
|
+
export function getWindowsServiceStatus(): "running" | "stopped" | "paused" | "not-installed" | "unknown";
|
|
198
|
+
/** Read-only status of the system-wide KokoroBoxService systemd unit. */
|
|
199
|
+
export function getLinuxServiceStatus(): Promise<"running" | "stopped" | "not-installed" | "unknown">;
|
|
186
200
|
/** Write KokoroBox's Linux user-session proxy file and update systemd --user over D-Bus. */
|
|
187
201
|
export function setTerminalProxyEnvironment(host: string, port: number, bypass: string[]): Promise<boolean>;
|
|
188
202
|
/** Remove only KokoroBox's Linux user-session proxy file and clear its session variables. */
|
|
189
203
|
export function clearTerminalProxyEnvironment(): Promise<boolean | null>;
|
|
190
204
|
/** Resolve the executable shipped beside the current platform binding. */
|
|
191
205
|
export function getTrafficPresenterPath(): string;
|
|
206
|
+
/** Resolve the Windows portable updater sidecar shipped with the native platform package. */
|
|
207
|
+
export function getPortableUpdaterPath(): string;
|
|
192
208
|
export function findExecutables(options: ExecutableSearchOptions): Promise<ExecutableCandidate[]>;
|
|
193
209
|
export function getLaunchAtLogin(options: LaunchAtLoginOptions): Promise<LaunchAtLoginStatus>;
|
|
194
210
|
export function setLaunchAtLogin(
|
|
@@ -203,6 +219,8 @@ export function waitForNetworkContextChange(
|
|
|
203
219
|
): Promise<NetworkContext | null>;
|
|
204
220
|
/** Query a LaunchDaemon plist embedded in the calling macOS application. */
|
|
205
221
|
export function getMacosManagedServiceStatus(plistName: string): MacOSManagedServiceStatus;
|
|
222
|
+
/** Query launchd's process state for the fixed KokoroBoxService system daemon. */
|
|
223
|
+
export function getMacosServiceProcessStatus(): Promise<"running" | "stopped" | "not-installed" | "unknown">;
|
|
206
224
|
export function registerMacosManagedService(plistName: string): MacOSManagedServiceStatus;
|
|
207
225
|
export function unregisterMacosManagedService(plistName: string): MacOSManagedServiceStatus;
|
|
208
226
|
export function reloadMacosManagedService(plistName: string): MacOSManagedServiceStatus;
|
|
@@ -295,4 +313,4 @@ export function ensureKokoroBoxCoreFirewall(
|
|
|
295
313
|
applicationPath: string,
|
|
296
314
|
): void;
|
|
297
315
|
export function listUwpLoopbackApps(): UwpLoopbackApp[];
|
|
298
|
-
export function setUwpLoopbackExemption(
|
|
316
|
+
export function setUwpLoopbackExemption(id: string, enabled: boolean): void;
|
package/index.js
CHANGED
|
@@ -59,6 +59,21 @@ export function getTrafficPresenterPath() {
|
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
export function getPortableUpdaterPath() {
|
|
63
|
+
if (process.platform !== "win32") {
|
|
64
|
+
throw new Error("Portable updater is only available on Windows");
|
|
65
|
+
}
|
|
66
|
+
const filename = "kokorobox-portable-updater.exe";
|
|
67
|
+
const localPath = join(__dirname, filename);
|
|
68
|
+
if (existsSync(localPath)) return localPath;
|
|
69
|
+
if (loadedTuple) {
|
|
70
|
+
const packageEntry = require.resolve(`${packageName}-${loadedTuple}`);
|
|
71
|
+
const packagedPath = join(dirname(packageEntry), filename);
|
|
72
|
+
if (existsSync(packagedPath)) return packagedPath;
|
|
73
|
+
}
|
|
74
|
+
throw new Error(`Portable updater is missing for ${process.platform} ${process.arch}`);
|
|
75
|
+
}
|
|
76
|
+
|
|
62
77
|
function requireNative() {
|
|
63
78
|
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
64
79
|
try {
|
|
@@ -100,6 +115,8 @@ export const fileToDataUrl = nativeBinding.fileToDataUrl;
|
|
|
100
115
|
export const fileToStr = nativeBinding.fileToStr;
|
|
101
116
|
export const getAppName = nativeBinding.getAppName;
|
|
102
117
|
export const getNativeCapabilities = nativeBinding.getNativeCapabilities;
|
|
118
|
+
export const getWindowsServiceStatus = nativeBinding.getWindowsServiceStatus;
|
|
119
|
+
export const getLinuxServiceStatus = nativeBinding.getLinuxServiceStatus;
|
|
103
120
|
export const setTerminalProxyEnvironment = nativeBinding.setTerminalProxyEnvironment;
|
|
104
121
|
export const clearTerminalProxyEnvironment = nativeBinding.clearTerminalProxyEnvironment;
|
|
105
122
|
export const findExecutables = nativeBinding.findExecutables;
|
|
@@ -108,6 +125,7 @@ export const setLaunchAtLogin = nativeBinding.setLaunchAtLogin;
|
|
|
108
125
|
export const getNetworkContext = nativeBinding.getNetworkContext;
|
|
109
126
|
export const waitForNetworkContextChange = nativeBinding.waitForNetworkContextChange;
|
|
110
127
|
export const getMacosManagedServiceStatus = nativeBinding.getMacosManagedServiceStatus;
|
|
128
|
+
export const getMacosServiceProcessStatus = nativeBinding.getMacosServiceProcessStatus;
|
|
111
129
|
export const registerMacosManagedService = nativeBinding.registerMacosManagedService;
|
|
112
130
|
export const unregisterMacosManagedService = nativeBinding.unregisterMacosManagedService;
|
|
113
131
|
export const reloadMacosManagedService = nativeBinding.reloadMacosManagedService;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kokorobox-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.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.
|
|
52
|
-
"kokorobox-native-win32-arm64-msvc": "0.
|
|
53
|
-
"kokorobox-native-darwin-x64": "0.
|
|
54
|
-
"kokorobox-native-darwin-arm64": "0.
|
|
55
|
-
"kokorobox-native-linux-x64-gnu": "0.
|
|
56
|
-
"kokorobox-native-linux-arm64-gnu": "0.
|
|
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"
|
|
57
57
|
}
|
|
58
58
|
}
|