@hunsu/config 0.1.0 → 0.1.1
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/dist/index.d.ts +13 -13
- package/dist/index.js +19 -19
- package/package.json +1 -1
- package/src/index.ts +31 -31
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export type HunsuConfigError = {
|
|
|
15
15
|
path?: string;
|
|
16
16
|
allowed?: readonly string[];
|
|
17
17
|
};
|
|
18
|
-
export type HunsuPortName = "
|
|
18
|
+
export type HunsuPortName = "bridgeApi" | "studioWeb" | "agentPreview";
|
|
19
19
|
export type HunsuEndpoint = {
|
|
20
20
|
name: HunsuPortName;
|
|
21
21
|
host: string;
|
|
@@ -41,17 +41,17 @@ export type HunsuPortValidationOptions = {
|
|
|
41
41
|
};
|
|
42
42
|
export type StudioWebServerConfig = {
|
|
43
43
|
web: HunsuEndpoint;
|
|
44
|
-
|
|
44
|
+
bridgeApi: HunsuEndpoint;
|
|
45
45
|
strictPort: boolean;
|
|
46
46
|
apiProxyTarget: string;
|
|
47
|
-
|
|
47
|
+
browserBridgeUrl?: string;
|
|
48
48
|
browserHubApiUrl?: string;
|
|
49
49
|
};
|
|
50
50
|
export type StudioLauncherConfig = {
|
|
51
51
|
webUrl: string;
|
|
52
52
|
};
|
|
53
|
-
export type
|
|
54
|
-
|
|
53
|
+
export type BridgeApiServerConfig = {
|
|
54
|
+
bridgeApi: HunsuEndpoint;
|
|
55
55
|
};
|
|
56
56
|
export type CodexSandboxMode = "read-only" | "workspace-write" | "danger-full-access";
|
|
57
57
|
export type CodexApprovalPolicy = "never" | "on-request" | "on-failure" | "untrusted";
|
|
@@ -68,8 +68,8 @@ export type CodexAppServerConfig = {
|
|
|
68
68
|
args: string[];
|
|
69
69
|
environment: Record<string, string>;
|
|
70
70
|
};
|
|
71
|
-
export type
|
|
72
|
-
|
|
71
|
+
export type BridgeRuntimeConfig = {
|
|
72
|
+
bridgeApi: HunsuEndpoint;
|
|
73
73
|
processEnv: Record<string, string>;
|
|
74
74
|
roadmapRegistryPath: string;
|
|
75
75
|
routeWorktreeRoot?: string;
|
|
@@ -78,7 +78,7 @@ export type LocalRuntimeConfig = {
|
|
|
78
78
|
codexAppServer: CodexAppServerConfig;
|
|
79
79
|
codexThreadOptions: CodexThreadOptionsConfig;
|
|
80
80
|
};
|
|
81
|
-
export type
|
|
81
|
+
export type BridgeRuntimeConfigOptions = {
|
|
82
82
|
cwd?: string;
|
|
83
83
|
homeDir?: string;
|
|
84
84
|
processEnv?: Env;
|
|
@@ -100,8 +100,8 @@ type PortSpec = {
|
|
|
100
100
|
allowPortZero: boolean;
|
|
101
101
|
};
|
|
102
102
|
export declare const HUNSU_PORT_SPECS: Record<HunsuPortName, PortSpec>;
|
|
103
|
-
export declare const HUNSU_ACTIVE_SERVICE_PORTS: readonly ["
|
|
104
|
-
export declare const HUNSU_STUDIO_WEB_ACTIVE_PORTS: readonly ["
|
|
103
|
+
export declare const HUNSU_ACTIVE_SERVICE_PORTS: readonly ["bridgeApi", "studioWeb"];
|
|
104
|
+
export declare const HUNSU_STUDIO_WEB_ACTIVE_PORTS: readonly ["bridgeApi", "studioWeb"];
|
|
105
105
|
export declare function ok<T>(value: T): ConfigResult<T>;
|
|
106
106
|
export declare function err(error: HunsuConfigError): ConfigResult<never>;
|
|
107
107
|
export declare function mapConfigResult<T, U>(result: ConfigResult<T>, transform: (value: T) => U): ConfigResult<U>;
|
|
@@ -112,8 +112,8 @@ export declare function resolveValidatedHunsuPorts(env: Env, options: HunsuPortR
|
|
|
112
112
|
export declare function resolveStudioWebServerConfig(env: Env): ConfigResult<StudioWebServerConfig>;
|
|
113
113
|
export declare function resolveStudioLauncherConfig(env: Env): ConfigResult<StudioLauncherConfig>;
|
|
114
114
|
export declare function currentProcessEnv(): Env;
|
|
115
|
-
export declare function
|
|
116
|
-
export declare function
|
|
115
|
+
export declare function resolveBridgeApiServerConfig(env: Env): ConfigResult<BridgeApiServerConfig>;
|
|
116
|
+
export declare function resolveBridgeRuntimeConfig(env: Env, options?: BridgeRuntimeConfigOptions): ConfigResult<BridgeRuntimeConfig>;
|
|
117
117
|
export declare function validateNoPortConflicts(config: HunsuPortConfig, activePortNames: readonly HunsuPortName[]): ConfigResult<HunsuPortConfig>;
|
|
118
118
|
export declare function endpointUrl(endpoint: Pick<HunsuEndpoint, "host" | "port">): string;
|
|
119
119
|
export declare function readConfigBoolean(env: Env, envName: string, fallback: boolean): ConfigResult<boolean>;
|
|
@@ -122,6 +122,6 @@ export declare function readConfigOptionalString(env: Env, envName: string): Con
|
|
|
122
122
|
export declare function readConfigUrl(env: Env, envName: string, fallback: string): ConfigResult<string>;
|
|
123
123
|
export declare function readConfigJsonStringArray(env: Env, envName: string, fallback?: readonly string[]): ConfigResult<string[]>;
|
|
124
124
|
export declare function readConfigPath(env: Env, envName: string, fallback: string, cwd?: string): ConfigResult<string>;
|
|
125
|
-
export declare function resolveCodexAppServerConfig(env: Env, overrides?:
|
|
125
|
+
export declare function resolveCodexAppServerConfig(env: Env, overrides?: BridgeRuntimeConfigOptions["codexAppServer"]): ConfigResult<CodexAppServerConfig>;
|
|
126
126
|
export declare function resolveCodexThreadOptions(env: Env, overrides?: CodexThreadOptionsConfig): ConfigResult<CodexThreadOptionsConfig>;
|
|
127
127
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -4,12 +4,12 @@ const DEFAULT_HOST = "127.0.0.1";
|
|
|
4
4
|
const DEFAULT_LOCAL_HUB_API_URL = "http://127.0.0.1:8787";
|
|
5
5
|
const DEFAULT_STUDIO_WEB_URL = "https://hunsu.app/studio";
|
|
6
6
|
export const HUNSU_PORT_SPECS = {
|
|
7
|
-
|
|
8
|
-
name: "
|
|
7
|
+
bridgeApi: {
|
|
8
|
+
name: "bridgeApi",
|
|
9
9
|
defaultHost: DEFAULT_HOST,
|
|
10
|
-
hostEnv: ["
|
|
10
|
+
hostEnv: ["HUNSU_BRIDGE_HOST", "HOST"],
|
|
11
11
|
defaultPort: 19687,
|
|
12
|
-
portEnv: ["
|
|
12
|
+
portEnv: ["HUNSU_BRIDGE_PORT", "PORT"],
|
|
13
13
|
reserved: false,
|
|
14
14
|
allowPortZero: false
|
|
15
15
|
},
|
|
@@ -32,12 +32,12 @@ export const HUNSU_PORT_SPECS = {
|
|
|
32
32
|
allowPortZero: false
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
-
export const HUNSU_ACTIVE_SERVICE_PORTS = ["
|
|
36
|
-
export const HUNSU_STUDIO_WEB_ACTIVE_PORTS = ["
|
|
35
|
+
export const HUNSU_ACTIVE_SERVICE_PORTS = ["bridgeApi", "studioWeb"];
|
|
36
|
+
export const HUNSU_STUDIO_WEB_ACTIVE_PORTS = ["bridgeApi", "studioWeb"];
|
|
37
37
|
const CODEX_SANDBOX_MODES = ["read-only", "workspace-write", "danger-full-access"];
|
|
38
38
|
const CODEX_APPROVAL_POLICIES = ["never", "on-request", "on-failure", "untrusted"];
|
|
39
39
|
const CODEX_APPROVALS_REVIEWERS = ["user", "auto_review"];
|
|
40
|
-
const
|
|
40
|
+
const BRIDGE_TEST_RUNNERS = ["deterministic"];
|
|
41
41
|
export function ok(value) {
|
|
42
42
|
return { ok: true, value };
|
|
43
43
|
}
|
|
@@ -57,9 +57,9 @@ export function unwrapConfigResult(result) {
|
|
|
57
57
|
throw new Error(result.error.message);
|
|
58
58
|
}
|
|
59
59
|
export function resolveHunsuPorts(env, options = {}) {
|
|
60
|
-
const
|
|
61
|
-
if (!
|
|
62
|
-
return
|
|
60
|
+
const bridgeApi = resolveEndpoint(HUNSU_PORT_SPECS.bridgeApi, env, options.overrides?.bridgeApi);
|
|
61
|
+
if (!bridgeApi.ok) {
|
|
62
|
+
return bridgeApi;
|
|
63
63
|
}
|
|
64
64
|
const studioWeb = resolveEndpoint(HUNSU_PORT_SPECS.studioWeb, env, options.overrides?.studioWeb);
|
|
65
65
|
if (!studioWeb.ok) {
|
|
@@ -70,7 +70,7 @@ export function resolveHunsuPorts(env, options = {}) {
|
|
|
70
70
|
return agentPreview;
|
|
71
71
|
}
|
|
72
72
|
return ok({
|
|
73
|
-
|
|
73
|
+
bridgeApi: bridgeApi.value,
|
|
74
74
|
studioWeb: studioWeb.value,
|
|
75
75
|
agentPreview: agentPreview.value
|
|
76
76
|
});
|
|
@@ -79,12 +79,12 @@ export function resolveValidatedHunsuPorts(env, options) {
|
|
|
79
79
|
return flatMapConfigResult(resolveHunsuPorts(env, options), config => validateNoPortConflicts(config, options.activePortNames));
|
|
80
80
|
}
|
|
81
81
|
export function resolveStudioWebServerConfig(env) {
|
|
82
|
-
return flatMapConfigResult(resolveValidatedHunsuPorts(env, { activePortNames: HUNSU_STUDIO_WEB_ACTIVE_PORTS }), ports => flatMapConfigResult(readConfigBoolean(env, "HUNSU_WEB_STRICT_PORT", true), strictPort => flatMapConfigResult(readOptionalUrl(env, "
|
|
82
|
+
return flatMapConfigResult(resolveValidatedHunsuPorts(env, { activePortNames: HUNSU_STUDIO_WEB_ACTIVE_PORTS }), ports => flatMapConfigResult(readConfigBoolean(env, "HUNSU_WEB_STRICT_PORT", true), strictPort => flatMapConfigResult(readOptionalUrl(env, "VITE_HUNSU_BRIDGE_URL"), browserBridgeUrl => flatMapConfigResult(readFirstOptionalUrl(env, ["VITE_HUNSU_HUB_API_URL", "HUNSU_HUB_PUBLIC_API_URL"], defaultBrowserHubApiUrl(env)), browserHubApiUrl => mapConfigResult(readFirstUrl(env, ["HUNSU_BRIDGE_API_PROXY_TARGET"], browserBridgeUrl ?? endpointUrl(ports.bridgeApi)), apiProxyTarget => ({
|
|
83
83
|
web: ports.studioWeb,
|
|
84
|
-
|
|
84
|
+
bridgeApi: ports.bridgeApi,
|
|
85
85
|
strictPort,
|
|
86
86
|
apiProxyTarget,
|
|
87
|
-
|
|
87
|
+
browserBridgeUrl,
|
|
88
88
|
browserHubApiUrl
|
|
89
89
|
}))))));
|
|
90
90
|
}
|
|
@@ -101,13 +101,13 @@ function defaultBrowserHubApiUrl(env) {
|
|
|
101
101
|
}
|
|
102
102
|
return undefined;
|
|
103
103
|
}
|
|
104
|
-
export function
|
|
105
|
-
return mapConfigResult(resolveValidatedHunsuPorts(env, { activePortNames: ["
|
|
104
|
+
export function resolveBridgeApiServerConfig(env) {
|
|
105
|
+
return mapConfigResult(resolveValidatedHunsuPorts(env, { activePortNames: ["bridgeApi"] }), ports => ({ bridgeApi: ports.bridgeApi }));
|
|
106
106
|
}
|
|
107
|
-
export function
|
|
107
|
+
export function resolveBridgeRuntimeConfig(env, options = {}) {
|
|
108
108
|
const processEnv = filterEnv(options.processEnv ?? env);
|
|
109
|
-
return flatMapConfigResult(
|
|
110
|
-
|
|
109
|
+
return flatMapConfigResult(resolveBridgeApiServerConfig(env), ({ bridgeApi }) => flatMapConfigResult(resolveRequiredConfiguredPath(options.roadmapRegistryPath, env, "HUNSU_ROADMAP_REGISTRY_PATH", join(options.homeDir ?? homedir(), ".config", "hunsu", "roadmaps.json"), options.cwd), roadmapRegistryPath => flatMapConfigResult(resolveConfiguredPath(options.routeWorktreeRoot, env, "HUNSU_ROUTE_WORKTREE_ROOT", undefined, options.cwd), routeWorktreeRoot => flatMapConfigResult(resolveConfiguredPath(options.actionWorktreeRoot, env, "HUNSU_ACTION_WORKTREE_ROOT", undefined, options.cwd), actionWorktreeRoot => flatMapConfigResult(readOptionalEnum(env, "HUNSU_BRIDGE_TEST_RUNNER", BRIDGE_TEST_RUNNERS), testRunner => flatMapConfigResult(resolveCodexAppServerConfig(env, options.codexAppServer), codexAppServer => mapConfigResult(resolveCodexThreadOptions(env, options.codexThreadOptions), codexThreadOptions => ({
|
|
110
|
+
bridgeApi,
|
|
111
111
|
processEnv,
|
|
112
112
|
roadmapRegistryPath,
|
|
113
113
|
routeWorktreeRoot,
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type HunsuConfigError = {
|
|
|
16
16
|
allowed?: readonly string[];
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
export type HunsuPortName = "
|
|
19
|
+
export type HunsuPortName = "bridgeApi" | "studioWeb" | "agentPreview";
|
|
20
20
|
|
|
21
21
|
export type HunsuEndpoint = {
|
|
22
22
|
name: HunsuPortName;
|
|
@@ -50,10 +50,10 @@ export type HunsuPortValidationOptions = {
|
|
|
50
50
|
|
|
51
51
|
export type StudioWebServerConfig = {
|
|
52
52
|
web: HunsuEndpoint;
|
|
53
|
-
|
|
53
|
+
bridgeApi: HunsuEndpoint;
|
|
54
54
|
strictPort: boolean;
|
|
55
55
|
apiProxyTarget: string;
|
|
56
|
-
|
|
56
|
+
browserBridgeUrl?: string;
|
|
57
57
|
browserHubApiUrl?: string;
|
|
58
58
|
};
|
|
59
59
|
|
|
@@ -61,8 +61,8 @@ export type StudioLauncherConfig = {
|
|
|
61
61
|
webUrl: string;
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
export type
|
|
65
|
-
|
|
64
|
+
export type BridgeApiServerConfig = {
|
|
65
|
+
bridgeApi: HunsuEndpoint;
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
export type CodexSandboxMode = "read-only" | "workspace-write" | "danger-full-access";
|
|
@@ -83,8 +83,8 @@ export type CodexAppServerConfig = {
|
|
|
83
83
|
environment: Record<string, string>;
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
-
export type
|
|
87
|
-
|
|
86
|
+
export type BridgeRuntimeConfig = {
|
|
87
|
+
bridgeApi: HunsuEndpoint;
|
|
88
88
|
processEnv: Record<string, string>;
|
|
89
89
|
roadmapRegistryPath: string;
|
|
90
90
|
routeWorktreeRoot?: string;
|
|
@@ -94,7 +94,7 @@ export type LocalRuntimeConfig = {
|
|
|
94
94
|
codexThreadOptions: CodexThreadOptionsConfig;
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
-
export type
|
|
97
|
+
export type BridgeRuntimeConfigOptions = {
|
|
98
98
|
cwd?: string;
|
|
99
99
|
homeDir?: string;
|
|
100
100
|
processEnv?: Env;
|
|
@@ -120,12 +120,12 @@ const DEFAULT_LOCAL_HUB_API_URL = "http://127.0.0.1:8787";
|
|
|
120
120
|
const DEFAULT_STUDIO_WEB_URL = "https://hunsu.app/studio";
|
|
121
121
|
|
|
122
122
|
export const HUNSU_PORT_SPECS: Record<HunsuPortName, PortSpec> = {
|
|
123
|
-
|
|
124
|
-
name: "
|
|
123
|
+
bridgeApi: {
|
|
124
|
+
name: "bridgeApi",
|
|
125
125
|
defaultHost: DEFAULT_HOST,
|
|
126
|
-
hostEnv: ["
|
|
126
|
+
hostEnv: ["HUNSU_BRIDGE_HOST", "HOST"],
|
|
127
127
|
defaultPort: 19687,
|
|
128
|
-
portEnv: ["
|
|
128
|
+
portEnv: ["HUNSU_BRIDGE_PORT", "PORT"],
|
|
129
129
|
reserved: false,
|
|
130
130
|
allowPortZero: false
|
|
131
131
|
},
|
|
@@ -149,12 +149,12 @@ export const HUNSU_PORT_SPECS: Record<HunsuPortName, PortSpec> = {
|
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
-
export const HUNSU_ACTIVE_SERVICE_PORTS = ["
|
|
153
|
-
export const HUNSU_STUDIO_WEB_ACTIVE_PORTS = ["
|
|
152
|
+
export const HUNSU_ACTIVE_SERVICE_PORTS = ["bridgeApi", "studioWeb"] as const satisfies readonly HunsuPortName[];
|
|
153
|
+
export const HUNSU_STUDIO_WEB_ACTIVE_PORTS = ["bridgeApi", "studioWeb"] as const satisfies readonly HunsuPortName[];
|
|
154
154
|
const CODEX_SANDBOX_MODES = ["read-only", "workspace-write", "danger-full-access"] as const;
|
|
155
155
|
const CODEX_APPROVAL_POLICIES = ["never", "on-request", "on-failure", "untrusted"] as const;
|
|
156
156
|
const CODEX_APPROVALS_REVIEWERS = ["user", "auto_review"] as const;
|
|
157
|
-
const
|
|
157
|
+
const BRIDGE_TEST_RUNNERS = ["deterministic"] as const;
|
|
158
158
|
|
|
159
159
|
export function ok<T>(value: T): ConfigResult<T> {
|
|
160
160
|
return { ok: true, value };
|
|
@@ -180,9 +180,9 @@ export function unwrapConfigResult<T>(result: ConfigResult<T>): T {
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
export function resolveHunsuPorts(env: Env, options: HunsuPortResolveOptions = {}): ConfigResult<HunsuPortConfig> {
|
|
183
|
-
const
|
|
184
|
-
if (!
|
|
185
|
-
return
|
|
183
|
+
const bridgeApi = resolveEndpoint(HUNSU_PORT_SPECS.bridgeApi, env, options.overrides?.bridgeApi);
|
|
184
|
+
if (!bridgeApi.ok) {
|
|
185
|
+
return bridgeApi;
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
const studioWeb = resolveEndpoint(HUNSU_PORT_SPECS.studioWeb, env, options.overrides?.studioWeb);
|
|
@@ -196,7 +196,7 @@ export function resolveHunsuPorts(env: Env, options: HunsuPortResolveOptions = {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
return ok({
|
|
199
|
-
|
|
199
|
+
bridgeApi: bridgeApi.value,
|
|
200
200
|
studioWeb: studioWeb.value,
|
|
201
201
|
agentPreview: agentPreview.value
|
|
202
202
|
});
|
|
@@ -210,14 +210,14 @@ export function resolveStudioWebServerConfig(env: Env): ConfigResult<StudioWebSe
|
|
|
210
210
|
return flatMapConfigResult(
|
|
211
211
|
resolveValidatedHunsuPorts(env, { activePortNames: HUNSU_STUDIO_WEB_ACTIVE_PORTS }),
|
|
212
212
|
ports => flatMapConfigResult(readConfigBoolean(env, "HUNSU_WEB_STRICT_PORT", true), strictPort =>
|
|
213
|
-
flatMapConfigResult(readOptionalUrl(env, "
|
|
213
|
+
flatMapConfigResult(readOptionalUrl(env, "VITE_HUNSU_BRIDGE_URL"), browserBridgeUrl =>
|
|
214
214
|
flatMapConfigResult(readFirstOptionalUrl(env, ["VITE_HUNSU_HUB_API_URL", "HUNSU_HUB_PUBLIC_API_URL"], defaultBrowserHubApiUrl(env)), browserHubApiUrl =>
|
|
215
|
-
mapConfigResult(readFirstUrl(env, ["
|
|
215
|
+
mapConfigResult(readFirstUrl(env, ["HUNSU_BRIDGE_API_PROXY_TARGET"], browserBridgeUrl ?? endpointUrl(ports.bridgeApi)), apiProxyTarget => ({
|
|
216
216
|
web: ports.studioWeb,
|
|
217
|
-
|
|
217
|
+
bridgeApi: ports.bridgeApi,
|
|
218
218
|
strictPort,
|
|
219
219
|
apiProxyTarget,
|
|
220
|
-
|
|
220
|
+
browserBridgeUrl,
|
|
221
221
|
browserHubApiUrl
|
|
222
222
|
}))
|
|
223
223
|
)
|
|
@@ -242,16 +242,16 @@ function defaultBrowserHubApiUrl(env: Env): string | undefined {
|
|
|
242
242
|
return undefined;
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
export function
|
|
245
|
+
export function resolveBridgeApiServerConfig(env: Env): ConfigResult<BridgeApiServerConfig> {
|
|
246
246
|
return mapConfigResult(
|
|
247
|
-
resolveValidatedHunsuPorts(env, { activePortNames: ["
|
|
248
|
-
ports => ({
|
|
247
|
+
resolveValidatedHunsuPorts(env, { activePortNames: ["bridgeApi"] }),
|
|
248
|
+
ports => ({ bridgeApi: ports.bridgeApi })
|
|
249
249
|
);
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
export function
|
|
252
|
+
export function resolveBridgeRuntimeConfig(env: Env, options: BridgeRuntimeConfigOptions = {}): ConfigResult<BridgeRuntimeConfig> {
|
|
253
253
|
const processEnv = filterEnv(options.processEnv ?? env);
|
|
254
|
-
return flatMapConfigResult(
|
|
254
|
+
return flatMapConfigResult(resolveBridgeApiServerConfig(env), ({ bridgeApi }) =>
|
|
255
255
|
flatMapConfigResult(resolveRequiredConfiguredPath(
|
|
256
256
|
options.roadmapRegistryPath,
|
|
257
257
|
env,
|
|
@@ -261,10 +261,10 @@ export function resolveLocalRuntimeConfig(env: Env, options: LocalRuntimeConfigO
|
|
|
261
261
|
), roadmapRegistryPath =>
|
|
262
262
|
flatMapConfigResult(resolveConfiguredPath(options.routeWorktreeRoot, env, "HUNSU_ROUTE_WORKTREE_ROOT", undefined, options.cwd), routeWorktreeRoot =>
|
|
263
263
|
flatMapConfigResult(resolveConfiguredPath(options.actionWorktreeRoot, env, "HUNSU_ACTION_WORKTREE_ROOT", undefined, options.cwd), actionWorktreeRoot =>
|
|
264
|
-
flatMapConfigResult(readOptionalEnum(env, "
|
|
264
|
+
flatMapConfigResult(readOptionalEnum(env, "HUNSU_BRIDGE_TEST_RUNNER", BRIDGE_TEST_RUNNERS), testRunner =>
|
|
265
265
|
flatMapConfigResult(resolveCodexAppServerConfig(env, options.codexAppServer), codexAppServer =>
|
|
266
266
|
mapConfigResult(resolveCodexThreadOptions(env, options.codexThreadOptions), codexThreadOptions => ({
|
|
267
|
-
|
|
267
|
+
bridgeApi,
|
|
268
268
|
processEnv,
|
|
269
269
|
roadmapRegistryPath,
|
|
270
270
|
routeWorktreeRoot,
|
|
@@ -347,7 +347,7 @@ export function readConfigPath(env: Env, envName: string, fallback: string, cwd?
|
|
|
347
347
|
return validatePath(raw === undefined || raw.trim() === "" ? fallback : raw, envName, cwd);
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
-
export function resolveCodexAppServerConfig(env: Env, overrides:
|
|
350
|
+
export function resolveCodexAppServerConfig(env: Env, overrides: BridgeRuntimeConfigOptions["codexAppServer"] = {}): ConfigResult<CodexAppServerConfig> {
|
|
351
351
|
const command = overrides.command ?? firstNonEmpty(env, ["HUNSU_CODEX_APP_SERVER_COMMAND"])?.value ?? "codex";
|
|
352
352
|
if (command.trim() === "") {
|
|
353
353
|
return err({
|