Skip to content

Commit b1117d9

Browse files
authored
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
1 parent fd83530 commit b1117d9

258 files changed

Lines changed: 3155 additions & 1836 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/CODEOWNERS‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
/src/gateway/**/*secret*.ts @openclaw/openclaw-secops
3232
/src/gateway/security-path*.ts @openclaw/openclaw-secops
3333
/src/gateway/resolve-configured-secret-input-string*.ts @openclaw/openclaw-secops
34-
/src/gateway/protocol/**/*secret*.ts @openclaw/openclaw-secops
34+
/packages/gateway-protocol/src/**/*secret*.ts @openclaw/openclaw-secops
3535
/src/gateway/server-methods/secrets*.ts @openclaw/openclaw-secops
3636
/src/agents/*auth*.ts @openclaw/openclaw-secops
3737
/src/agents/**/*auth*.ts @openclaw/openclaw-secops

‎.github/codeql/codeql-channel-runtime-boundary-critical-security.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ paths:
1919
- src/config/types.channel*.ts
2020
- src/gateway/server-channel*.ts
2121
- src/gateway/server-methods/channels.ts
22-
- src/gateway/protocol/schema/channels.ts
22+
- packages/gateway-protocol/src/schema/channels.ts
2323
- src/infra/channel-*.ts
2424
- src/infra/exec-approval-channel-runtime.ts
2525
- src/infra/outbound/channel-*.ts

‎.github/codeql/codeql-core-auth-secrets-critical-quality.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ paths:
3030
- src/gateway/**/*auth*.ts
3131
- src/gateway/*secret*.ts
3232
- src/gateway/**/*secret*.ts
33-
- src/gateway/protocol/**/*secret*.ts
33+
- packages/gateway-protocol/src/**/*secret*.ts
3434
- src/gateway/resolve-configured-secret-input-string*.ts
3535
- src/gateway/security-path*.ts
3636
- src/gateway/server-methods/secrets*.ts

‎.github/codeql/codeql-core-auth-secrets-critical-security.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ paths:
3030
- src/gateway/**/*auth*.ts
3131
- src/gateway/*secret*.ts
3232
- src/gateway/**/*secret*.ts
33-
- src/gateway/protocol/**/*secret*.ts
33+
- packages/gateway-protocol/src/**/*secret*.ts
3434
- src/gateway/resolve-configured-secret-input-string*.ts
3535
- src/gateway/security-path*.ts
3636
- src/gateway/server-methods/secrets*.ts

‎.github/codeql/codeql-gateway-runtime-boundary-critical-quality.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ query-filters:
1515

1616
paths:
1717
- src/gateway/method-scopes.ts
18-
- src/gateway/protocol
18+
- packages/gateway-protocol/src
1919
- src/gateway/server-methods
2020
- src/gateway/server-methods.ts
2121
- src/gateway/server-methods-list.ts

‎.github/labeler.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,15 @@
188188
- "ui/**"
189189
- "src/gateway/control-ui.ts"
190190
- "src/gateway/control-ui-shared.ts"
191-
- "src/gateway/protocol/**"
191+
- "packages/gateway-protocol/src/**"
192192
- "src/gateway/server-methods/chat.ts"
193193
- "src/infra/control-ui-assets.ts"
194194

195195
"gateway":
196196
- changed-files:
197197
- any-glob-to-any-file:
198198
- "src/gateway/**"
199+
- "packages/gateway-protocol/src/**"
199200
- "src/daemon/**"
200201
- "docs/gateway/**"
201202

‎.github/workflows/codeql-critical-quality.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,13 @@ on:
106106
- "src/gateway/**/*auth*.ts"
107107
- "src/gateway/*secret*.ts"
108108
- "src/gateway/**/*secret*.ts"
109-
- "src/gateway/protocol/**/*secret*.ts"
109+
- "packages/gateway-protocol/src/**/*secret*.ts"
110110
- "src/gateway/resolve-configured-secret-input-string*.ts"
111111
- "src/gateway/security-path*.ts"
112112
- "src/gateway/server-methods/secrets*.ts"
113113
- "src/gateway/server-startup-memory.ts"
114114
- "src/gateway/method-scopes.ts"
115-
- "src/gateway/protocol/**"
115+
- "packages/gateway-protocol/src/**"
116116
- "src/gateway/server-methods/**"
117117
- "src/gateway/server-methods.ts"
118118
- "src/gateway/server-methods-list.ts"
@@ -244,14 +244,14 @@ jobs:
244244
src/config/*)
245245
config=true
246246
;;
247-
src/gateway/protocol/*secret*.ts|src/gateway/server-methods/secrets*.ts)
247+
packages/gateway-protocol/src/*secret*.ts|packages/gateway-protocol/src/**/*secret*.ts|src/gateway/server-methods/secrets*.ts)
248248
core_auth_secrets=true
249249
gateway=true
250250
;;
251251
src/agents/*auth*.ts|src/agents/auth-health*.ts|src/agents/auth-profiles|src/agents/auth-profiles/*|src/agents/bash-tools.exec-host-shared.ts|src/agents/sandbox|src/agents/sandbox.ts|src/agents/sandbox-*.ts|src/agents/sandbox/*|src/cron/service/jobs.ts|src/cron/stagger.ts|src/gateway/*auth*.ts|src/gateway/*secret*.ts|src/gateway/resolve-configured-secret-input-string*.ts|src/gateway/security-path*.ts|src/infra/secret-file*.ts|src/secrets/*|src/security/*)
252252
core_auth_secrets=true
253253
;;
254-
src/gateway/method-scopes.ts|src/gateway/protocol/*|src/gateway/server-methods/*|src/gateway/server-methods.ts|src/gateway/server-methods-list.ts)
254+
packages/gateway-protocol/src/*|packages/gateway-protocol/src/**/*|src/gateway/method-scopes.ts|src/gateway/server-methods/*|src/gateway/server-methods.ts|src/gateway/server-methods-list.ts)
255255
gateway=true
256256
;;
257257
packages/memory-host-sdk/*|src/commands/doctor-cron-dreaming-payload-migration.ts|src/commands/doctor-memory-search.ts|src/gateway/server-startup-memory.ts|src/memory/*|src/memory-host-sdk/*)

‎AGENTS.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ Skills own workflows; root owns hard policy and routing.
3535

3636
## Map
3737

38-
- Core TS: `src/`, `ui/`, `packages/`; plugins: `extensions/`; SDK: `src/plugin-sdk/*`; channels: `src/channels/*`; loader: `src/plugins/*`; protocol: `src/gateway/protocol/*`; docs/apps: `docs/`, `apps/`.
38+
- Core TS: `src/`, `ui/`, `packages/`; plugins: `extensions/`; SDK: `src/plugin-sdk/*`; channels: `src/channels/*`; loader: `src/plugins/*`; protocol: `packages/gateway-protocol/*`; docs/apps: `docs/`, `apps/`.
3939
- Installers: sibling `../openclaw.ai`.
40-
- Scoped guides: `extensions/`, `src/{plugin-sdk,channels,plugins,gateway,gateway/protocol,agents}/`, `test/helpers*/`, `docs/`, `ui/`, `scripts/`.
40+
- Scoped guides: `extensions/`, `src/{plugin-sdk,channels,plugins,gateway,agents}/`, `packages/`, `test/helpers*/`, `docs/`, `ui/`, `scripts/`.
4141

4242
## Docs
4343

‎config/knip.config.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,14 @@ const config = {
168168
entry: ["src/index.ts!", "src/*.ts!", "src/harness/**/*.ts!"],
169169
project: ["src/**/*.ts!"],
170170
},
171+
"packages/gateway-client": {
172+
entry: ["src/index.ts!"],
173+
project: ["src/**/*.ts!"],
174+
},
175+
"packages/gateway-protocol": {
176+
entry: ["src/index.ts!", "src/schema.ts!"],
177+
project: ["src/**/*.ts!"],
178+
},
171179
"packages/*": {
172180
entry: ["index.js!", "scripts/postinstall.js!"],
173181
project: ["index.js!", "scripts/**/*.js!"],

‎docs/concepts/typebox.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ Authoritative advertised **discovery** inventory lives in
5353

5454
## Where the schemas live
5555

56-
- Source: `src/gateway/protocol/schema.ts`
57-
- Runtime validators (AJV): `src/gateway/protocol/index.ts`
56+
- Source: `packages/gateway-protocol/src/schema.ts`
57+
- Runtime validators (AJV): `packages/gateway-protocol/src/index.ts`
5858
- Advertised feature/discovery registry: `src/gateway/server-methods-list.ts`
5959
- Server handshake + method dispatch: `src/gateway/server.impl.ts`
6060
- Node client: `src/gateway/client.ts`
@@ -195,7 +195,7 @@ Example: add a new `system.echo` request that returns `{ ok: true, text }`.
195195

196196
1. **Schema (source of truth)**
197197

198-
Add to `src/gateway/protocol/schema.ts`:
198+
Add to `packages/gateway-protocol/src/schema.ts`:
199199

200200
```ts
201201
export const SystemEchoParamsSchema = Type.Object(
@@ -223,7 +223,7 @@ export type SystemEchoResult = Static<typeof SystemEchoResultSchema>;
223223

224224
2. **Validation**
225225

226-
In `src/gateway/protocol/index.ts`, export an AJV validator:
226+
In `packages/gateway-protocol/src/index.ts`, export an AJV validator:
227227

228228
```ts
229229
export const validateSystemEchoParams = ajv.compile<SystemEchoParams>(SystemEchoParamsSchema);
@@ -272,7 +272,7 @@ Unknown frame types are preserved as raw payloads for forward compatibility.
272272

273273
## Versioning + compatibility
274274

275-
- `PROTOCOL_VERSION` lives in `src/gateway/protocol/version.ts`.
275+
- `PROTOCOL_VERSION` lives in `packages/gateway-protocol/src/version.ts`.
276276
- Clients send `minProtocol` + `maxProtocol`; the server rejects ranges that
277277
do not include its current protocol.
278278
- The Swift models keep unknown frame types to avoid breaking older clients.

0 commit comments

Comments
 (0)