dsh-mobile 0.3.2 → 0.3.3
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/CHANGELOG.md +11 -0
- package/FUNNEL_THIRD_PARTY_LICENSES.txt +2551 -0
- package/README.en.md +18 -9
- package/README.md +16 -7
- package/SECURITY.md +6 -3
- package/THIRD_PARTY_NOTICES.md +6 -2
- package/bin/dsh-mobile-funnel-win32-x64.exe +0 -0
- package/lib/cli.js +4 -1
- package/lib/cli.js.map +1 -0
- package/lib/client.js +690 -52
- package/lib/client.js.map +1 -1
- package/lib/index.d.mts +227 -2
- package/lib/index.mjs +1717 -169
- package/lib/index.mjs.map +1 -0
- package/package.json +10 -6
- package/assets/brand/app-icon-master.png +0 -0
- package/assets/brand/repository-hero.png +0 -0
package/lib/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
import { ChildProcessWithoutNullStreams } from "node:child_process";
|
|
2
3
|
import { Readable } from "node:stream";
|
|
3
4
|
import { Context, Service } from "@deepseek-ai/cordis";
|
|
4
5
|
import { WebRoute } from "@deepseek-ai/dsh-host-webserver";
|
|
@@ -373,6 +374,9 @@ declare const EXTENSION_LIMITS: Readonly<{
|
|
|
373
374
|
script: number;
|
|
374
375
|
css: number;
|
|
375
376
|
asset: number;
|
|
377
|
+
assetFiles: 256;
|
|
378
|
+
assetBytes: number;
|
|
379
|
+
assetDepth: 8;
|
|
376
380
|
}>;
|
|
377
381
|
/** A controlled business failure returned by an extension action or route. */
|
|
378
382
|
declare class MobileExtensionError extends Error {
|
|
@@ -402,7 +406,7 @@ interface MobileRouteRequest {
|
|
|
402
406
|
readonly signal: AbortSignal;
|
|
403
407
|
readonly deviceId: string;
|
|
404
408
|
}
|
|
405
|
-
/** Values an extension route may return. */
|
|
409
|
+
/** Values an extension route may return; status is a final HTTP code from 200 through 599. */
|
|
406
410
|
interface MobileRouteResponse {
|
|
407
411
|
readonly status?: number;
|
|
408
412
|
readonly contentType?: string;
|
|
@@ -628,6 +632,227 @@ declare const LOCAL_ADMIN_PREFIX = "/api/mobile-access";
|
|
|
628
632
|
declare const AUTH_PREFIX = "/mobile-access";
|
|
629
633
|
declare const WS_PATHS: Set<string>;
|
|
630
634
|
//#endregion
|
|
635
|
+
//#region src/frp-component.d.ts
|
|
636
|
+
interface FrpArtifact {
|
|
637
|
+
readonly platform: NodeJS.Platform;
|
|
638
|
+
readonly arch: string;
|
|
639
|
+
readonly downloadUrl: string;
|
|
640
|
+
readonly downloadBytes: number;
|
|
641
|
+
readonly downloadSha256: string;
|
|
642
|
+
readonly archiveName: string;
|
|
643
|
+
readonly executableName: string;
|
|
644
|
+
}
|
|
645
|
+
/** Pinned official FRP release metadata for supported desktop targets. */
|
|
646
|
+
declare const FRP_COMPONENT_RELEASES: Readonly<Record<string, FrpArtifact>>;
|
|
647
|
+
/** Public, credential-free description of the managed FRP client. */
|
|
648
|
+
interface FrpComponentStatus {
|
|
649
|
+
readonly supported: boolean;
|
|
650
|
+
readonly installed: boolean;
|
|
651
|
+
readonly version: string;
|
|
652
|
+
readonly downloadBytes: number;
|
|
653
|
+
readonly installedBytes: number;
|
|
654
|
+
readonly sourceUrl: string;
|
|
655
|
+
readonly releasePage: string;
|
|
656
|
+
readonly storagePath: string;
|
|
657
|
+
readonly errorCode?: string;
|
|
658
|
+
}
|
|
659
|
+
interface FrpComponentManagerOptions {
|
|
660
|
+
readonly stateDirectory: string;
|
|
661
|
+
readonly platform?: NodeJS.Platform;
|
|
662
|
+
readonly arch?: string;
|
|
663
|
+
readonly fetchArtifact?: (artifact: FrpArtifact, signal: AbortSignal) => Promise<Uint8Array>;
|
|
664
|
+
readonly extractArtifact?: (archive: string, destination: string, executableName: string) => Promise<void>;
|
|
665
|
+
readonly inspectExecutable?: (executable: string) => Promise<string>;
|
|
666
|
+
}
|
|
667
|
+
/** Owns the optional official frpc binary inside the DSH Mobile state directory. */
|
|
668
|
+
declare class FrpComponentManager {
|
|
669
|
+
readonly executable: string;
|
|
670
|
+
readonly componentRoot: string;
|
|
671
|
+
readonly componentStorage: string;
|
|
672
|
+
readonly logRoot: string;
|
|
673
|
+
private readonly stagingRoot;
|
|
674
|
+
private readonly artifact;
|
|
675
|
+
private readonly fetchArtifact;
|
|
676
|
+
private readonly extractArtifact;
|
|
677
|
+
private readonly inspectExecutable;
|
|
678
|
+
private installed;
|
|
679
|
+
private installedBytes;
|
|
680
|
+
private errorCode;
|
|
681
|
+
private queue;
|
|
682
|
+
constructor(options: FrpComponentManagerOptions);
|
|
683
|
+
/** Inspect the managed executable without relying on global FRP installations. */
|
|
684
|
+
initialize(): Promise<void>;
|
|
685
|
+
/** Return component metadata without exposing configuration or credentials. */
|
|
686
|
+
status(): FrpComponentStatus;
|
|
687
|
+
/** Download, verify, and extract only frpc after explicit confirmation. */
|
|
688
|
+
install(): Promise<FrpComponentStatus>;
|
|
689
|
+
/** Remove all FRP executable, staging, and log files owned by DSH Mobile. */
|
|
690
|
+
purge(): Promise<FrpComponentStatus>;
|
|
691
|
+
private enqueue;
|
|
692
|
+
}
|
|
693
|
+
//#endregion
|
|
694
|
+
//#region src/frp-template.d.ts
|
|
695
|
+
/** Loopback-only HTTP vhost port used between Caddy and frps. */
|
|
696
|
+
declare const FRP_VHOST_HTTP_PORT = 7080;
|
|
697
|
+
/** Build the only supported frps and Caddy configuration from validated user inputs. */
|
|
698
|
+
declare function createRestrictedFrpServerTemplate(serverPort: number, token: string, publicOrigin: string): string;
|
|
699
|
+
//#endregion
|
|
700
|
+
//#region src/frp-config.d.ts
|
|
701
|
+
/** Credentials and endpoints required by the restricted FRP provider. */
|
|
702
|
+
interface FrpSettings {
|
|
703
|
+
readonly version: 1;
|
|
704
|
+
readonly serverAddress: string;
|
|
705
|
+
readonly serverPort: number;
|
|
706
|
+
readonly token: string;
|
|
707
|
+
readonly publicOrigin: string;
|
|
708
|
+
}
|
|
709
|
+
/** Safe FRP configuration fields returned to the desktop UI. */
|
|
710
|
+
interface FrpConfigurationStatus {
|
|
711
|
+
readonly configured: boolean;
|
|
712
|
+
readonly serverAddress?: string;
|
|
713
|
+
readonly serverPort?: number;
|
|
714
|
+
readonly publicOrigin?: string;
|
|
715
|
+
readonly vhostHttpPort: number;
|
|
716
|
+
readonly storagePath: string;
|
|
717
|
+
readonly errorCode?: string;
|
|
718
|
+
}
|
|
719
|
+
/** Validate the FRP server hostname or IP address. */
|
|
720
|
+
declare function validateFrpServerAddress(value: unknown): string;
|
|
721
|
+
/** Validate the FRP control port. */
|
|
722
|
+
declare function validateFrpServerPort(value: unknown): number;
|
|
723
|
+
/** Validate a high-entropy FRP token before durable storage. */
|
|
724
|
+
declare function validateFrpToken(value: unknown): string;
|
|
725
|
+
/** Validate the public HTTPS origin used by Caddy and Android pairing. */
|
|
726
|
+
declare function validateFrpPublicOrigin(value: unknown): string;
|
|
727
|
+
/** Parse FRP settings at the loopback request and filesystem boundaries. */
|
|
728
|
+
declare function parseFrpSettings(value: unknown): FrpSettings;
|
|
729
|
+
/** Build the single-purpose frpc configuration for the current loopback gateway. */
|
|
730
|
+
declare function createFrpcToml(settings: FrpSettings, localPort: number): string;
|
|
731
|
+
/** Build the matching restricted frps and Caddy templates for one VPS. */
|
|
732
|
+
declare function createFrpServerTemplate(settings: FrpSettings): string;
|
|
733
|
+
/** Owns private FRP settings and generation-specific frpc configuration. */
|
|
734
|
+
declare class FrpConfigStore {
|
|
735
|
+
readonly stateRoot: string;
|
|
736
|
+
readonly settingsFile: string;
|
|
737
|
+
readonly runtimeConfigFile: string;
|
|
738
|
+
private settingsValue;
|
|
739
|
+
private errorCode;
|
|
740
|
+
constructor(stateDirectory: string);
|
|
741
|
+
/** Load private settings while rejecting links, oversized files, and unknown fields. */
|
|
742
|
+
initialize(): Promise<void>;
|
|
743
|
+
/** Return configuration metadata without exposing the FRP token. */
|
|
744
|
+
status(): FrpConfigurationStatus;
|
|
745
|
+
/** Return private settings only to the provider lifecycle. */
|
|
746
|
+
settings(): FrpSettings | undefined;
|
|
747
|
+
/** Atomically replace private FRP settings. */
|
|
748
|
+
configure(value: unknown): Promise<FrpConfigurationStatus>;
|
|
749
|
+
/** Materialize the private generation-specific frpc configuration. */
|
|
750
|
+
writeRuntimeConfig(localPort: number): Promise<string>;
|
|
751
|
+
/** Remove only configuration files owned by the FRP provider. */
|
|
752
|
+
purge(): Promise<FrpConfigurationStatus>;
|
|
753
|
+
}
|
|
754
|
+
//#endregion
|
|
755
|
+
//#region src/remote.d.ts
|
|
756
|
+
/** Remote transports supported by the desktop plugin and Android client. */
|
|
757
|
+
type RemoteProvider = 'tailscale' | 'cpolar' | 'frp';
|
|
758
|
+
/** Common safe status returned by every remote provider controller. */
|
|
759
|
+
interface RemoteProviderStatus {
|
|
760
|
+
readonly enabled: boolean;
|
|
761
|
+
readonly state: string;
|
|
762
|
+
readonly origin?: string;
|
|
763
|
+
readonly loginUrl?: string;
|
|
764
|
+
readonly setupUrl?: string;
|
|
765
|
+
readonly errorCode?: string;
|
|
766
|
+
}
|
|
767
|
+
/** Lifecycle shared by selectable remote providers. */
|
|
768
|
+
interface RemoteProviderController {
|
|
769
|
+
initialize(): Promise<void>;
|
|
770
|
+
gateway(): MobileAccessGateway | undefined;
|
|
771
|
+
status(): RemoteProviderStatus;
|
|
772
|
+
setEnabled(enabled: boolean): Promise<RemoteProviderStatus>;
|
|
773
|
+
reconnect(): Promise<RemoteProviderStatus>;
|
|
774
|
+
reset(): Promise<RemoteProviderStatus>;
|
|
775
|
+
close(): Promise<void>;
|
|
776
|
+
}
|
|
777
|
+
/** Durable selection for the single active remote transport. */
|
|
778
|
+
interface RemoteProviderState {
|
|
779
|
+
readonly version: 1;
|
|
780
|
+
readonly provider: RemoteProvider;
|
|
781
|
+
}
|
|
782
|
+
/** Validate the provider selection loaded across the filesystem boundary. */
|
|
783
|
+
declare function parseRemoteProviderState(value: unknown): RemoteProviderState;
|
|
784
|
+
/** Atomic selection store whose absent-file state uses the configured default. */
|
|
785
|
+
declare class JsonRemoteProviderStore {
|
|
786
|
+
private readonly file;
|
|
787
|
+
private readonly defaultProvider;
|
|
788
|
+
constructor(file: string, defaultProvider: RemoteProvider);
|
|
789
|
+
load(): Promise<RemoteProviderState>;
|
|
790
|
+
save(state: RemoteProviderState): Promise<void>;
|
|
791
|
+
}
|
|
792
|
+
/** Resolve the first-run provider without letting environment values bypass validation. */
|
|
793
|
+
declare function configuredRemoteProvider(environment: NodeJS.ProcessEnv): RemoteProvider;
|
|
794
|
+
//#endregion
|
|
795
|
+
//#region src/frp.d.ts
|
|
796
|
+
/** Product-facing states for the restricted self-hosted FRP transport. */
|
|
797
|
+
type FrpState = 'off' | 'unavailable' | 'starting' | 'connecting' | 'ready' | 'error';
|
|
798
|
+
/** Safe FRP state returned only through the loopback DSH control route. */
|
|
799
|
+
interface FrpStatus {
|
|
800
|
+
readonly enabled: boolean;
|
|
801
|
+
readonly state: FrpState;
|
|
802
|
+
readonly origin?: string;
|
|
803
|
+
readonly errorCode?: string;
|
|
804
|
+
}
|
|
805
|
+
/** Inputs for one FRP client process and authenticated DSH gateway. */
|
|
806
|
+
interface FrpControllerOptions {
|
|
807
|
+
readonly store: MobileAccessControlStore;
|
|
808
|
+
readonly executable: string;
|
|
809
|
+
readonly config: FrpConfigStore;
|
|
810
|
+
readonly instanceId: string;
|
|
811
|
+
readonly createGateway: (origin: string) => Promise<MobileAccessGateway>;
|
|
812
|
+
readonly onStatus?: (status: FrpStatus) => void;
|
|
813
|
+
readonly verifyConfig?: (executable: string, configFile: string) => Promise<void>;
|
|
814
|
+
readonly launchClient?: (executable: string, configFile: string) => ChildProcessWithoutNullStreams;
|
|
815
|
+
readonly probeVhostExposure?: (serverAddress: string, port: number) => Promise<boolean>;
|
|
816
|
+
readonly probeDiscovery?: (origin: string, expectedInstanceId: string, signal: AbortSignal) => Promise<boolean>;
|
|
817
|
+
readonly startTimeoutMs?: number;
|
|
818
|
+
readonly retryIntervalMs?: number;
|
|
819
|
+
}
|
|
820
|
+
/** Owns frpc, its generation-specific configuration, and the remote gateway. */
|
|
821
|
+
declare class FrpController implements RemoteProviderController {
|
|
822
|
+
private readonly options;
|
|
823
|
+
private enabled;
|
|
824
|
+
private initialized;
|
|
825
|
+
private disposed;
|
|
826
|
+
private child;
|
|
827
|
+
private gatewayValue;
|
|
828
|
+
private generation;
|
|
829
|
+
private latest;
|
|
830
|
+
private queue;
|
|
831
|
+
private startupAbort;
|
|
832
|
+
constructor(options: FrpControllerOptions);
|
|
833
|
+
/** Restore the remembered FRP switch without changing LAN or other providers. */
|
|
834
|
+
initialize(): Promise<void>;
|
|
835
|
+
/** Return the active FRP-backed DSH gateway. */
|
|
836
|
+
gateway(): MobileAccessGateway | undefined;
|
|
837
|
+
/** Return state safe for the desktop control UI. */
|
|
838
|
+
status(): FrpStatus;
|
|
839
|
+
/** Enable or disable FRP without changing LAN or another provider. */
|
|
840
|
+
setEnabled(enabled: boolean): Promise<FrpStatus>;
|
|
841
|
+
/** Restart FRP while retaining its private server settings and devices. */
|
|
842
|
+
reconnect(): Promise<FrpStatus>;
|
|
843
|
+
/** Disable FRP without deleting its explicitly managed component or settings. */
|
|
844
|
+
reset(): Promise<FrpStatus>;
|
|
845
|
+
/** Stop all FRP resources without changing the remembered switch. */
|
|
846
|
+
close(): Promise<void>;
|
|
847
|
+
private enqueue;
|
|
848
|
+
private publish;
|
|
849
|
+
private start;
|
|
850
|
+
private waitForDiscovery;
|
|
851
|
+
private failGeneration;
|
|
852
|
+
private stop;
|
|
853
|
+
private stopProcessAndGateway;
|
|
854
|
+
}
|
|
855
|
+
//#endregion
|
|
631
856
|
//#region src/plugin.d.ts
|
|
632
857
|
/** Stable Cordis plugin name. */
|
|
633
858
|
declare const name = "dsh-mobile";
|
|
@@ -636,5 +861,5 @@ declare const inject: string[];
|
|
|
636
861
|
/** Mount the resident control route and its optional authenticated LAN gateway. */
|
|
637
862
|
declare function apply(ctx: Context, config: PluginConfig): Promise<void>;
|
|
638
863
|
//#endregion
|
|
639
|
-
export { AUTH_PREFIX, AccessController, type AccessControllerOptions, AccessError, type AuthoritySpec, BoundedRateLimiter, CSRF_COOKIE, CSRF_HEADER, Config, DEVICE_COOKIE, type DeviceSnapshot, type DeviceStore, type DeviceSummary, type DisabledTlsConfig, EXTENSION_LIMITS, JsonDeviceStore, JsonMobileAccessControlStore, LOCAL_ADMIN_PREFIX, type LocalExtensionManifest, MemoryDeviceStore, type MobileAccessControlState, type MobileAccessControlStore, MobileAccessGateway, MobileAccessGatewayController, type MobileAccessService as MobileAccessRegistry, MobileAccessService, type MobileAccessRuntime, type MobileActionContext, type MobileExtensionClientEntry, type MobileExtensionDefinition, MobileExtensionError, type MobileExtensionManifest, type MobileExtensionStatus, type MobileHostAction, type MobileHostRoute, type MobileRouteRequest, type MobileRouteResponse, type PairingResult, type ParsedCidr, type PluginConfig, type ProvidedTlsConfig, type RenewalResult, RequestTrustPolicy, type ResolvedGatewayConfig, SESSION_COOKIE, SUPPORTED_DSH_VERSIONS, type SessionAuthorization, type StoredDevice, type TlsConfig, WS_PATHS, addressAllowed, apply, assertExtensionId, assertSupportedDshVersion, createMobileAccessService, inject, isLoopbackAddress, name, parseAuthority, parseCidr, parseControlFile, parseDeviceSnapshot, parseExtensionManifest, parseGatewayConfig, parseMobileAccessControlState, resolveAuthority, rewriteMobileIndex };
|
|
864
|
+
export { AUTH_PREFIX, AccessController, type AccessControllerOptions, AccessError, type AuthoritySpec, BoundedRateLimiter, CSRF_COOKIE, CSRF_HEADER, Config, FRP_VHOST_HTTP_PORT as DEFAULT_VHOST_HTTP_PORT, FRP_VHOST_HTTP_PORT, DEVICE_COOKIE, type DeviceSnapshot, type DeviceStore, type DeviceSummary, type DisabledTlsConfig, EXTENSION_LIMITS, FRP_COMPONENT_RELEASES, FrpComponentManager, type FrpComponentStatus, FrpConfigStore, type FrpConfigurationStatus, FrpController, type FrpControllerOptions, type FrpSettings, type FrpState, type FrpStatus, JsonDeviceStore, JsonMobileAccessControlStore, JsonRemoteProviderStore, LOCAL_ADMIN_PREFIX, type LocalExtensionManifest, MemoryDeviceStore, type MobileAccessControlState, type MobileAccessControlStore, MobileAccessGateway, MobileAccessGatewayController, type MobileAccessService as MobileAccessRegistry, MobileAccessService, type MobileAccessRuntime, type MobileActionContext, type MobileExtensionClientEntry, type MobileExtensionDefinition, MobileExtensionError, type MobileExtensionManifest, type MobileExtensionStatus, type MobileHostAction, type MobileHostRoute, type MobileRouteRequest, type MobileRouteResponse, type PairingResult, type ParsedCidr, type PluginConfig, type ProvidedTlsConfig, type RemoteProvider, type RemoteProviderController, type RemoteProviderState, type RemoteProviderStatus, type RenewalResult, RequestTrustPolicy, type ResolvedGatewayConfig, SESSION_COOKIE, SUPPORTED_DSH_VERSIONS, type SessionAuthorization, type StoredDevice, type TlsConfig, WS_PATHS, addressAllowed, apply, assertExtensionId, assertSupportedDshVersion, configuredRemoteProvider, createFrpServerTemplate, createFrpcToml, createMobileAccessService, createRestrictedFrpServerTemplate, inject, isLoopbackAddress, name, parseAuthority, parseCidr, parseControlFile, parseDeviceSnapshot, parseExtensionManifest, parseFrpSettings, parseGatewayConfig, parseMobileAccessControlState, parseRemoteProviderState, resolveAuthority, rewriteMobileIndex, validateFrpPublicOrigin, validateFrpServerAddress, validateFrpServerPort, validateFrpToken };
|
|
640
865
|
//# sourceMappingURL=index.d.mts.map
|