@hunsu/bridge 0.2.0-next.2 → 0.2.0-next.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 +14 -2
- package/dist/cli.js +408 -107
- package/dist/index.d.ts +25 -3
- package/dist/index.js +409 -108
- package/package.json +5 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
export const HUNSU_BRIDGE_VERSION: "0.2.0-next.
|
|
1
|
+
export const HUNSU_BRIDGE_VERSION: "0.2.0-next.4";
|
|
2
2
|
export const HUNSU_BRIDGE_PROTOCOL_VERSION: "local-bridge-v1";
|
|
3
3
|
export const BRIDGE_CLI_RESULT_SCHEMA: "hunsu.bridge.cli-result.v1";
|
|
4
|
+
export const BRIDGE_DEPLOYMENT_PROFILES: readonly ["production", "preview"];
|
|
5
|
+
|
|
6
|
+
export type BridgeDeploymentProfile = "production" | "preview";
|
|
7
|
+
export type BridgeDeploymentEndpoints = Readonly<{
|
|
8
|
+
webUrl: string;
|
|
9
|
+
connectApiUrl: string;
|
|
10
|
+
connectWsUrl: string;
|
|
11
|
+
connectTicketIssuer: string;
|
|
12
|
+
connectTicketSigningKeyId: string;
|
|
13
|
+
connectTicketSigningPublicJwk: Readonly<{ kty: "EC"; crv: "P-256"; x: string; y: string }>;
|
|
14
|
+
}>;
|
|
4
15
|
|
|
5
16
|
export type BridgeCliResult<T = unknown> =
|
|
6
17
|
| { schema: "hunsu.bridge.cli-result.v1"; ok: true; code: string; message: string; value?: T }
|
|
@@ -37,6 +48,7 @@ export type BridgeHealth = {
|
|
|
37
48
|
service: "hunsu-bridge";
|
|
38
49
|
version: string;
|
|
39
50
|
protocolVersion: "local-bridge-v1";
|
|
51
|
+
deploymentProfile: BridgeDeploymentProfile;
|
|
40
52
|
};
|
|
41
53
|
|
|
42
54
|
export type ControlEndpointProbe =
|
|
@@ -58,24 +70,30 @@ export type BridgeControlClient = {
|
|
|
58
70
|
request<T = unknown>(path: string, input?: BridgeControlRequest): Promise<BridgeCliResult<T>>;
|
|
59
71
|
};
|
|
60
72
|
|
|
61
|
-
export type
|
|
73
|
+
export type ConnectSocket = {
|
|
62
74
|
readyState: number;
|
|
63
75
|
send(data: string): void;
|
|
64
76
|
close(code?: number, reason?: string): void;
|
|
65
77
|
addEventListener(type: "open" | "close" | "error" | "message", listener: (event: { data?: unknown }) => void): void;
|
|
66
78
|
};
|
|
67
79
|
|
|
80
|
+
export type ConnectSocketFactory = (input: {
|
|
81
|
+
url: string;
|
|
82
|
+
headers: Readonly<Record<string, string>>;
|
|
83
|
+
}) => ConnectSocket | Promise<ConnectSocket>;
|
|
84
|
+
|
|
68
85
|
export type BridgeDaemonOptions = HunsuPathInput & {
|
|
69
86
|
host?: string;
|
|
70
87
|
port?: number;
|
|
71
88
|
cwd?: string;
|
|
72
89
|
runtimePath?: string;
|
|
73
90
|
webUrl?: string;
|
|
91
|
+
deploymentProfile?: BridgeDeploymentProfile;
|
|
74
92
|
development?: boolean;
|
|
75
93
|
serviceManager?: "windows-task-scheduler" | "macos-launch-agent" | "linux-systemd-user" | "development";
|
|
76
94
|
fetchImpl?: typeof fetch;
|
|
77
95
|
openBrowser?: (url: string) => Promise<void>;
|
|
78
|
-
socketFactory?:
|
|
96
|
+
socketFactory?: ConnectSocketFactory;
|
|
79
97
|
};
|
|
80
98
|
|
|
81
99
|
export type BridgeRuntimeIdentity = {
|
|
@@ -84,6 +102,7 @@ export type BridgeRuntimeIdentity = {
|
|
|
84
102
|
daemonPid: number;
|
|
85
103
|
version: string;
|
|
86
104
|
protocolVersion: "local-bridge-v1";
|
|
105
|
+
deploymentProfile: BridgeDeploymentProfile;
|
|
87
106
|
startedAt: string;
|
|
88
107
|
endpoint: string;
|
|
89
108
|
runtimePath: string;
|
|
@@ -100,6 +119,9 @@ export type RunningBridgeDaemon = {
|
|
|
100
119
|
};
|
|
101
120
|
|
|
102
121
|
export function resolveHunsuHome(input?: HunsuPathInput): string;
|
|
122
|
+
export function isBridgeDeploymentProfile(value: unknown): value is BridgeDeploymentProfile;
|
|
123
|
+
export function bridgeDeploymentEndpoints(profile: BridgeDeploymentProfile): BridgeDeploymentEndpoints;
|
|
124
|
+
export function bridgeSetupPackageTag(profile: BridgeDeploymentProfile): "next" | "candidate-next";
|
|
103
125
|
export function resolveHunsuPaths(input?: HunsuPathInput): HunsuPaths;
|
|
104
126
|
export function createBridgeControlClient(options?: HunsuPathInput & {
|
|
105
127
|
paths?: HunsuPaths;
|