mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
refactor: extract gateway client package (#87797)
* refactor: extract gateway client package * chore: drop generated gateway package artifacts * refactor: move gateway protocol package * refactor: remove old gateway protocol tree * test: keep auth compat split in run mode * test: expose gateway wrapper options for internals * fix: watch moved gateway package sources * test: normalize slash command import guard * chore: teach knip gateway package entries * ci: route gateway client package checks * fix: reuse ipaddr for gateway client hosts * fix: sync gateway protocol usage schema
This commit is contained in:
committed by
GitHub
parent
fd8353012f
commit
b1117d9862
@@ -142,6 +142,17 @@ function nodeBuildConfig(config: UserConfig): UserConfig {
|
||||
};
|
||||
}
|
||||
|
||||
function nodeWorkspacePackageBuildConfig(config: UserConfig): UserConfig {
|
||||
return {
|
||||
...config,
|
||||
env,
|
||||
format: "esm",
|
||||
platform: "node",
|
||||
sourcemap: OUTPUT_SOURCE_MAPS,
|
||||
inputOptions: buildInputOptions,
|
||||
};
|
||||
}
|
||||
|
||||
const bundledPluginBuildEntries = collectBundledPluginBuildEntries();
|
||||
const shouldBuildPrivateQaEntries = process.env.OPENCLAW_BUILD_PRIVATE_QA === "1";
|
||||
const productionPluginSdkEntrypoints = shouldBuildPrivateQaEntries
|
||||
@@ -296,7 +307,7 @@ function buildDockerE2eHarnessEntries(): Record<string, string> {
|
||||
"config/config": "src/config/config.ts",
|
||||
"crestodian/crestodian": "src/crestodian/crestodian.ts",
|
||||
"crestodian/rescue-message": "src/crestodian/rescue-message.ts",
|
||||
"gateway/protocol/index": "src/gateway/protocol/index.ts",
|
||||
"gateway/protocol/index": "packages/gateway-protocol/src/index.ts",
|
||||
"infra/errors": "src/infra/errors.ts",
|
||||
"infra/ws": "src/infra/ws.ts",
|
||||
"plugin-sdk/provider-onboard": "src/plugin-sdk/provider-onboard.ts",
|
||||
@@ -337,6 +348,29 @@ function buildAgentCoreDistEntries(): Record<string, string> {
|
||||
};
|
||||
}
|
||||
|
||||
function buildGatewayProtocolDistEntries(): Record<string, string> {
|
||||
return {
|
||||
// Package exports resolve from packages/gateway-protocol/dist, while the
|
||||
// root build still emits dist/gateway/protocol/index for Docker harnesses.
|
||||
index: "packages/gateway-protocol/src/index.ts",
|
||||
"client-info": "packages/gateway-protocol/src/client-info.ts",
|
||||
"connect-error-details": "packages/gateway-protocol/src/connect-error-details.ts",
|
||||
schema: "packages/gateway-protocol/src/schema.ts",
|
||||
"startup-unavailable": "packages/gateway-protocol/src/startup-unavailable.ts",
|
||||
version: "packages/gateway-protocol/src/version.ts",
|
||||
};
|
||||
}
|
||||
|
||||
function buildGatewayClientDistEntries(): Record<string, string> {
|
||||
return {
|
||||
// Keep package entrypoints explicit so package.json exports and root build
|
||||
// config cannot drift when client internals are split again.
|
||||
index: "packages/gateway-client/src/index.ts",
|
||||
readiness: "packages/gateway-client/src/readiness.ts",
|
||||
timeouts: "packages/gateway-client/src/timeouts.ts",
|
||||
};
|
||||
}
|
||||
|
||||
function shouldExternalizeAgentCoreDependency(id: string): boolean {
|
||||
return (
|
||||
id === "ignore" ||
|
||||
@@ -349,6 +383,19 @@ function shouldExternalizeAgentCoreDependency(id: string): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
function shouldExternalizeGatewayProtocolDependency(id: string): boolean {
|
||||
return id === "typebox" || id.startsWith("typebox/");
|
||||
}
|
||||
|
||||
function shouldExternalizeGatewayClientDependency(id: string): boolean {
|
||||
return (
|
||||
id === "ws" ||
|
||||
id.startsWith("ws/") ||
|
||||
id === "@openclaw/gateway-protocol" ||
|
||||
id.startsWith("@openclaw/gateway-protocol/")
|
||||
);
|
||||
}
|
||||
|
||||
const coreDistEntries = buildCoreDistEntries();
|
||||
const dockerE2eHarnessEntries = buildDockerE2eHarnessEntries();
|
||||
const rootBundledPluginBuildEntries = bundledPluginBuildEntries.filter(
|
||||
@@ -391,6 +438,24 @@ export default defineConfig([
|
||||
neverBundle: shouldExternalizeAgentCoreDependency,
|
||||
},
|
||||
}),
|
||||
nodeWorkspacePackageBuildConfig({
|
||||
clean: true,
|
||||
dts: RUN_NODE_SKIP_DTS_BUILD ? false : undefined,
|
||||
entry: buildGatewayProtocolDistEntries(),
|
||||
outDir: "packages/gateway-protocol/dist",
|
||||
deps: {
|
||||
neverBundle: shouldExternalizeGatewayProtocolDependency,
|
||||
},
|
||||
}),
|
||||
nodeWorkspacePackageBuildConfig({
|
||||
clean: true,
|
||||
dts: RUN_NODE_SKIP_DTS_BUILD ? false : undefined,
|
||||
entry: buildGatewayClientDistEntries(),
|
||||
outDir: "packages/gateway-client/dist",
|
||||
deps: {
|
||||
neverBundle: shouldExternalizeGatewayClientDependency,
|
||||
},
|
||||
}),
|
||||
nodeBuildConfig({
|
||||
// Build core entrypoints, plugin-sdk subpaths, bundled plugin entrypoints,
|
||||
// and bundled hooks in one graph so runtime singletons are emitted once.
|
||||
|
||||
Reference in New Issue
Block a user