kokorobox-native 0.16.2 → 0.16.4

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,6 +43,24 @@ The traffic presenter emits JSON Lines to stderr. The Windows portable updater
43
43
  also saves its last run in `%TEMP%/kokorobox-portable-updater.log` because Desktop
44
44
  exits before extraction. These sidecars include Unix milliseconds in `timestamp`.
45
45
 
46
+ ## System Proxy diagnostics
47
+
48
+ `getSystemProxyDiagnostics()` returns actual OS configuration with independent
49
+ availability information. Windows, macOS and Linux share the same entry point;
50
+ platform-specific details are nested under `windows`, `macos` or `linux`.
51
+ macOS uses SystemConfiguration for effective HTTP/HTTPS/SOCKS, PAC/discovery,
52
+ primary IPv4/IPv6 services and the current Network Location. Reading never asks
53
+ for administrator authorization. Runtime health and connectivity belong to
54
+ KokoroBox Service, not this API.
55
+
56
+ `setSystemProxy(settings)` supports explicit Windows/macOS manual, PAC and
57
+ disabled actions. macOS honors `onlyActiveDevice`, preserves PAC/discovery
58
+ when restoring manual proxies, and reuses Native's administrator dialog if
59
+ required for a write. Its structured result includes
60
+ `automaticSettingsPreserved`; callers must not resume a legacy watchdog or
61
+ cleanup that would erase those settings. Never invoke this setter merely to
62
+ inspect or refresh diagnostics.
63
+
46
64
  ## Documentation
47
65
 
48
66
  - [JavaScript API guide](../docs/api.md)
package/diagnostics.js CHANGED
@@ -16,6 +16,7 @@ const lifecycleOperations = new Set([
16
16
  "stopMacosApplicationRouting",
17
17
  "setLaunchAtLogin",
18
18
  "setUwpLoopbackExemption",
19
+ "setSystemProxy",
19
20
  ]);
20
21
 
21
22
  function boundedMessage(value) {
@@ -91,6 +92,24 @@ export function createNativeDiagnostics() {
91
92
  throw error;
92
93
  };
93
94
  const completed = (value) => {
95
+ if (target === "getSystemProxyDiagnostics") {
96
+ record(value.status === "available" ? "info" : "warn", "SystemProxy", `[SystemProxy] Configuration: ${value.status}; Proxy enabled: ${value.enabled ?? "unknown"}`);
97
+ if (value.macos) {
98
+ const effective = value.macos.effective;
99
+ const count = value.macos.activeServiceIds?.length ?? 0;
100
+ record("info", "SystemProxy", `[SystemProxy/macOS] Active network services: ${count}; HTTP: ${effective?.http?.enabled ?? "unknown"}; HTTPS: ${effective?.https?.enabled ?? "unknown"}; PAC: ${effective?.pacEnabled ?? "unknown"}; Auto discovery: ${effective?.autoDiscovery ?? "unknown"}`);
101
+ }
102
+ if (value.linux) {
103
+ const backend = ["gnome", "kde", "environment", "unsupported"].includes(value.linux.backend) ? value.linux.backend : "unknown";
104
+ const portal = value.linux.portal?.status === "available" ? "available" : "unavailable";
105
+ record("info", "SystemProxy", `[SystemProxy] Linux backend: ${backend}; Portal: ${portal}`);
106
+ }
107
+ if (value.pac?.enabled) record("info", "SystemProxy", "[SystemProxy] PAC configuration detected");
108
+ for (const [name, state] of Object.entries({winHttp: value.windows?.winHttp, appContainer: value.windows?.appContainer})) {
109
+ if (state?.status === "unavailable") record("warn", "SystemProxy", `[SystemProxy] ${name}: unavailable`);
110
+ }
111
+ return value;
112
+ }
94
113
  if (value && value.state === "error")
95
114
  record(
96
115
  "error",
package/index.d.ts CHANGED
@@ -325,3 +325,94 @@ export function ensureKokoroBoxCoreFirewall(
325
325
  ): void;
326
326
  export function listUwpLoopbackApps(): UwpLoopbackApp[];
327
327
  export function setUwpLoopbackExemption(id: string, enabled: boolean): void;
328
+
329
+ export interface NativeProxyEndpoint {
330
+ host: string;
331
+ port: number;
332
+ }
333
+ export interface MacProxyProtocol {
334
+ enabled: boolean;
335
+ endpoint?: NativeProxyEndpoint | null;
336
+ }
337
+ export interface MacProxyState {
338
+ http: MacProxyProtocol;
339
+ https: MacProxyProtocol;
340
+ socks: MacProxyProtocol;
341
+ pacEnabled: boolean;
342
+ pacUrl?: string | null;
343
+ autoDiscovery: boolean;
344
+ bypass: string[];
345
+ excludeSimpleHostnames: boolean;
346
+ }
347
+ export interface MacNetworkService {
348
+ id: string;
349
+ name: string;
350
+ interface?: string | null;
351
+ enabled: boolean;
352
+ active: boolean;
353
+ primary: boolean;
354
+ status: "available" | "unavailable";
355
+ proxies?: MacProxyState | null;
356
+ }
357
+ export interface MacOSProxyDetails {
358
+ effective?: MacProxyState | null;
359
+ activeServiceIds: string[];
360
+ services: MacNetworkService[];
361
+ networkLocation?: string | null;
362
+ locationErrorCode?: string | null;
363
+ serviceErrorCode?: string | null;
364
+ }
365
+ export interface NativeSystemProxyMutation {
366
+ automaticSettingsPreserved: boolean;
367
+ }
368
+ export interface NativeSystemProxyDiagnostics {
369
+ platform: "windows" | "darwin" | "linux";
370
+ status: "available" | "unavailable" | "unsupported";
371
+ errorCode?: string | null;
372
+ enabled?: boolean | null;
373
+ proxies: {
374
+ http?: NativeProxyEndpoint | null;
375
+ https?: NativeProxyEndpoint | null;
376
+ socks?: NativeProxyEndpoint | null;
377
+ };
378
+ pac?: { enabled: boolean; url?: string | null } | null;
379
+ bypass: string[];
380
+ macos?: MacOSProxyDetails | null;
381
+ linux?: {
382
+ desktopEnvironment: string;
383
+ backend: "gnome" | "kde" | "environment" | "unsupported";
384
+ mode?: "none" | "manual" | "auto" | "wpad" | "environment" | null;
385
+ reversedBypass: boolean;
386
+ environment: { name: string; endpoint?: NativeProxyEndpoint | null; bypass: string[]; valid: boolean }[];
387
+ portal: { status: "available" | "unavailable"; direct: boolean; proxies: NativeProxyEndpoint[]; errorCode?: string | null };
388
+ } | null;
389
+ windows?: {
390
+ proxyServer?: string | null;
391
+ proxyOverride?: string | null;
392
+ autoConfigUrl?: string | null;
393
+ winHttp: {
394
+ status: "available" | "unavailable";
395
+ mode?: "direct" | "proxy" | "advanced" | null;
396
+ proxy?: string | null;
397
+ bypass?: string | null;
398
+ errorCode?: string | null;
399
+ };
400
+ appContainer: {
401
+ supported: boolean;
402
+ status: "available" | "unavailable";
403
+ loopbackExemptionCount?: number | null;
404
+ errorCode?: string | null;
405
+ };
406
+ } | null;
407
+ }
408
+ export interface NativeSystemProxySettings {
409
+ mode: "manual" | "auto" | "disabled";
410
+ host?: string;
411
+ port?: number;
412
+ bypass: string[];
413
+ pacUrl?: string;
414
+ onlyActiveDevice?: boolean;
415
+ }
416
+ export declare function getSystemProxyDiagnostics(): Promise<NativeSystemProxyDiagnostics>;
417
+ /** Explicit user action only. Leaves WinHTTP/UWP unchanged; macOS manual restore preserves PAC/discovery. */
418
+ export declare function setSystemProxy(settings: NativeSystemProxySettings): Promise<NativeSystemProxyMutation>;
package/index.js CHANGED
@@ -199,3 +199,6 @@ export const setUwpLoopbackExemption =
199
199
  export const ServiceIdentity = diagnosticBinding.ServiceIdentity;
200
200
  export const openServiceIdentity = diagnosticBinding.openServiceIdentity;
201
201
  export const deleteServiceIdentity = diagnosticBinding.deleteServiceIdentity;
202
+
203
+ export const getSystemProxyDiagnostics = diagnosticBinding.getSystemProxyDiagnostics;
204
+ export const setSystemProxy = diagnosticBinding.setSystemProxy;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kokorobox-native",
3
- "version": "0.16.2",
3
+ "version": "0.16.4",
4
4
  "description": "KokoroBox native bridge",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -50,11 +50,11 @@
50
50
  "access": "public"
51
51
  },
52
52
  "optionalDependencies": {
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"
53
+ "kokorobox-native-win32-x64-msvc": "0.16.4",
54
+ "kokorobox-native-win32-arm64-msvc": "0.16.4",
55
+ "kokorobox-native-darwin-x64": "0.16.4",
56
+ "kokorobox-native-darwin-arm64": "0.16.4",
57
+ "kokorobox-native-linux-x64-gnu": "0.16.4",
58
+ "kokorobox-native-linux-arm64-gnu": "0.16.4"
59
59
  }
60
60
  }