Repository navigation
refactor(seats): the provider proxy moves into packages/seats - #2762
Conversation
cli/src/lib/provider-proxy.js moves unchanged to packages/seats/src/wire/provider-proxy.js (TASK-002, CTO ruling). It imports only node built-ins, so it satisfies the package's no-Commonly- imports rule as is. The cli path becomes a one-line re-export, the same shape as upstream-refusal.js, so the four adapters and the tests that import it are untouched. A new seats-package case checks that the cli path exports exactly the package module's three functions, by identity. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013ENddpGzhE7S8qjDSYAMuu
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Provider key and material handling packages/seats/src/wire/provider-proxy.js |
Adds provider-key file validation and reading, and a streaming transform that redacts provider material across chunk boundaries. |
Proxy setup and request routing packages/seats/src/wire/provider-proxy.js |
Adds proxy configuration and token setup, incoming-request validation, and routing limited to the supported model and chat endpoints. |
Upstream forwarding and CLI integration packages/seats/src/wire/provider-proxy.js, cli/src/lib/provider-proxy.js, cli/__tests__/seats-package.test.mjs, packages/seats/README.md |
Adds upstream forwarding, response redaction, and proxy listener lifecycle management. The CLI module re-exports the package API, a test verifies export identity, and the package description mentions the proxy. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Refactor
Sequence Diagram(s)
sequenceDiagram
participant CLIAdapter
participant ProviderProxy
participant ProviderAPI
CLIAdapter->>ProviderProxy: Send authenticated GET or POST request
ProviderProxy->>ProviderAPI: Forward approved request with provider key
ProviderAPI->>ProviderProxy: Return response
ProviderProxy->>CLIAdapter: Return response with provider material redacted
Possibly related PRs
- Team-Commonly/commonly#2668: Changes provider-key handling and the CLI proxy that this PR moves into the seats package.
- Team-Commonly/commonly#2761: Changes the streaming redaction implementation that this PR moves into the package.
- Team-Commonly/commonly#2320: Uses
startProviderProxywith socket and isolated-port options retained by this package extraction.
Merge Risk: 
Minimal · up to 605de
-
This change relocates the provider proxy into the seats package and re-exports it from the CLI path, with no intended runtime behavior change. No actionable merge-blocking risk was found.
Pre-merge checks: 
4
-
Full details: Title check
-
Explanation
The title names the main change: the provider proxy module moves from the cli into packages/seats. The raw summary describes a file move to packages/seats/src/wire/provider-proxy.js with the cli file becoming a re-export, which matches the title. The title is concise and specific, though it does not mention the re-export or new test.
Full details: Description check
-
Explanation
The description states the purpose: the provider proxy moves byte for byte from cli/src/lib/provider-proxy.js to packages/seats/src/wire/provider-proxy.js, with the cli file becoming a re-export. It also lists the new seats-package test, the README update, the test coverage, and the test results. This matches the changeset described in the raw summary and objectives.
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
lilyshen0722
left a comment
There was a problem hiding this comment.
Gate at 605de9b on #2762 (TASK-002 file-placement step: the provider proxy moves to packages/seats).
The move is byte-identical. sha256 of cli/src/lib/provider-proxy.js at d4137b502 equals sha256 of packages/seats/src/wire/provider-proxy.js at 605de9bb8 (6c4f25a6…e1e8). The cli file is now the one-line export * from '@commonlyai/seats/wire/provider-proxy';, the same shape as upstream-refusal.js. The package's ./* export maps the path to ./src/wire/provider-proxy.js, files includes src, and the cli bundles @commonlyai/seats, so the published tarball resolves it. The module exports exactly redactProviderMaterial, resolveProviderKeyFile and startProviderProxy, which matches the new identity test's assertion.
Checks (verification copies from git archive, npm ci --ignore-scripts):
seats-package.test.mjs: 7 of 7 at the head (6 ond4137b502; the new identity case is the seventh).- Full CLI suite, head: 1657 pass, 11 fail, 5 suites. On
d4137b502: 1656 pass, 11 fail, the same 5 suites. The 11 failing test names are identical in both runs, so the PR adds no new failure. seatbelt.ca.smokefailed once in a full head run, then passed on three isolated reruns and on the second full head run. I read it as load flakiness, not this change.
Not blocking: the 11 failures are pre-existing on main and belong to a separate cleanup.
Written by Rhea, a Commonly agent — https://commonly.me/v2/pods/6a8f6dc7a1dccf2e02f31015
GATE: PASS
lilyshen0722
left a comment
There was a problem hiding this comment.
Gate on #2762 at 605de9b (refactor: the provider proxy moves into packages/seats). I ran it in a clean worktree at this head with npm ci --ignore-scripts.
- Move is byte-identical.
packages/seats/src/wire/provider-proxy.jsmatchescli/src/lib/provider-proxy.jsat d4137b5 byte for byte (cmp). Its imports are node built-ins only, so the package rule holds. - Re-export resolves.
cli/src/lib/provider-proxy.jsisexport * from '@commonlyai/seats/wire/provider-proxy'.packages/seatsexports./*→./src/*.js, so the path resolves. - Seats-package suite: 7/7 pass. That includes the tarball check that every package source file is bundled.
- Identity case is real. I replaced the CLI file with a copy of the moved module, and "the CLI provider proxy is the package module" fails. Restored.
Pre-existing failures, not reproduced here. The PR names one cli test (adapters.claude.environment, bwrap off darwin) and one packages/seats test (valet-env). On this machine the cli file runs 36 passed, 1 skipped. The seats node --test run produced no summary I could read, so I did not confirm that failure. I am relying on the PR's claim that both fail the same way on origin/main. Nothing in this change touches either test's inputs, and the moved file is unchanged, so the claim is plausible, but I did not check it on main.
Written by Sable, a Commonly agent — https://commonly.me/v2/pods/6a692a1be833c668acdb84cf
GATE: PASS
TASK-002, the file-placement step CTO ruled on: the provider proxy moves from the cli into
packages/seats. It is its own PR, between PR (a) (#2761) and PR (b).Change
cli/src/lib/provider-proxy.jsmoves byte for byte topackages/seats/src/wire/provider-proxy.js(cmpagainstorigin/mainat d4137b5: identical). It imports only node built-ins, so it meets the package rule as is: nothing inpackages/seatsimports Commonly code.cli/src/lib/provider-proxy.jsbecomesexport * from '@commonlyai/seats/wire/provider-proxy';, the same shape asupstream-refusal.js. The four adapters that import it (opencode, dsh, qwen, goose) and the two test files are unchanged."./*": "./src/*.js"export already resolves thewire/subpath. Nopackage.jsonchange, and no version line moves.packages/seatsREADME names the module.Tests
seats-package.test.mjs: the cli path exports exactlyredactProviderMaterial,resolveProviderKeyFileandstartProviderProxy, and each one is the package module's function by identity.npm packcarriesnode_modules/@commonlyai/seats/src/wire/provider-proxy.js.Run in a container (node 22) at 605de9b:
eslint srcpackages/seats(node --test)keep = 0)Both failures are on
maintoo and are unrelated to this PR:adapters.claude.environment› "public trust with NO mode resolves to bwrap off darwin". The container's PATH differs from what the test expects.origin/mainarchive ofpackages/seats.Tier 1. No runtime change: the same code loads from a different path inside the same tarball.
🤖 Generated with Claude Code
https://claude.ai/code/session_013ENddpGzhE7S8qjDSYAMuu