Skip to content

feat(config): align config.json with claude-openmax / openmax-bridge …#12

Merged
Noah-Bytes merged 1 commit into
mainfrom
feat/config-format-align-bridge
Jul 21, 2026
Merged

feat(config): align config.json with claude-openmax / openmax-bridge …#12
Noah-Bytes merged 1 commit into
mainfrom
feat/config-format-align-bridge

Conversation

@Noah-Bytes

Copy link
Copy Markdown
Collaborator

…format

Migrate the external config from the old { cws, codex, bridge, org } shape to the bridge format { enabled, server, agent, cf_access, orgs } so per-org access policy (dm + group) can be expressed and passed to the SDK's CwsAgentBridge as orgConfigs. Preserves codex-openmax's runtime-specific codex:{bin,cwd} and bridge:{localHttpPort} blocks.

  • config.ts: parse the new shape, expose camelCase runtime fields (server/agent), org_id-keyed orgs map -> array with full access, keep codex + local port; env overrides + strict validation retained.
  • cli.ts: build orgConfigs from the orgs map (full access, enabled filter), thread cf_access into token/http/ws; device_id/app_version from agent.*.
  • onboarding.ts: emit the new shape with a COMPLETE access block (dmPolicy/dmAllowFrom/groupPolicy/groups); both credential paths.
  • config.example.json: bridge-format template + codex fields.
  • tests: config/onboarding updated to the new shape.

What

Why

Test plan

  • npm test passes locally
  • npm run build passes locally

Checklist

  • No secrets / credentials committed
  • Semgrep / Gitleaks findings addressed, or a // nosemgrep: <rule-id> suppression is justified inline and approved by the project lead

…format

Migrate the external config from the old { cws, codex, bridge, org }
shape to the bridge format { enabled, server, agent, cf_access, orgs }
so per-org access policy (dm + group) can be expressed and passed to the
SDK's CwsAgentBridge as orgConfigs. Preserves codex-openmax's
runtime-specific codex:{bin,cwd} and bridge:{localHttpPort} blocks.

- config.ts: parse the new shape, expose camelCase runtime fields
  (server/agent), org_id-keyed orgs map -> array with full access,
  keep codex + local port; env overrides + strict validation retained.
- cli.ts: build orgConfigs from the orgs map (full access, enabled
  filter), thread cf_access into token/http/ws; device_id/app_version
  from agent.*.
- onboarding.ts: emit the new shape with a COMPLETE access block
  (dmPolicy/dmAllowFrom/groupPolicy/groups); both credential paths.
- config.example.json: bridge-format template + codex fields.
- tests: config/onboarding updated to the new shape.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@gavin09527 gavin09527 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✅ 过了完整 diff。

配置从旧的 {cws,codex,bridge,org} 迁到 bridge 格式 {enabled,server,agent,cf_access,orgs},对齐 claude-openmax,同时保留 codex-openmax 特有的 codex/bridge 两块。关键点都对:

  • parseOrgs 把 org_id-keyed map 规范成数组,access(dm+group) 原样透传给 SDK 的 orgConfigs,补上了旧 {dmPolicy}-only 表达不了的群策略
  • cf_access 只有在 client_id 非空时才 surface(避免发空 CF 头),且按 SDK cfAccessHeaders() 的期望 wrap 成 {cf_access}
  • activeOrgs = enabled!==false 过滤,多 org 一起进 orgConfigs;defaultOrgId 有兜底
  • REQUIRED / env override 保留;device_id/app_version 从 agent.* 取
  • onboarding + config.example + 测试都同步了

CI 全绿(Test / Semgrep / Gitleaks 均 pass),mergeable。已 approve。

@Noah-Bytes
Noah-Bytes merged commit 0e50e68 into main Jul 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants