mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-30 11:54:55 +00:00
* refactor(acp-bridge): create skeleton + lift zero-coupling primitives (#4175 PR 22a) First slice of #4175 Wave 5 PR 22 (`refactor(serve): extract acp bridge primitives`). Lifts the three primitives from `packages/cli/src/serve/` that have zero coupling to the rest of `serve/`, so PR 22a can land ahead of PR 17 (#4282) and PR 14b (#4271) without merge-conflict risk on `httpAcpBridge.ts`. Also seeds the `PermissionMediator` interface contract that PR 24 will implement (4 strategies — first-responder / designated / consensus / local-only — replacing the inline first-responder voting in `BridgeClient.requestPermission`). What moves - `cli/src/serve/eventBus.ts` (578 LOC, no internal imports) → `packages/acp-bridge/src/eventBus.ts` - `cli/src/serve/inMemoryChannel.ts` (73 LOC, only depends on `@agentclientprotocol/sdk`) → `packages/acp-bridge/src/inMemoryChannel.ts` - `httpAcpBridge.ts:638-677` `AcpChannel` / `AcpChannelExitInfo` / `ChannelFactory` types → `packages/acp-bridge/src/channel.ts` - Both test files moved alongside their sources What's new - `packages/acp-bridge/` package (`@qwen-code/acp-bridge`, internal, not published to npm yet) - `packages/acp-bridge/src/permission.ts` — type-only `PermissionMediator` / `PermissionPolicy` / `PermissionResolution` / `PermissionRequestRecord` / `PermissionVote` / `PermissionVoteOutcome`. No implementation; PR 24 fills it in. - `packages/cli/src/serve/eventBus.ts` and `inMemoryChannel.ts` are now one-line re-export wrappers for backward compat. - `httpAcpBridge.ts:638-677` is now a one-line `import type` + `export type` re-export. Backward compatibility - All existing relative imports (`./eventBus.js`, `./inMemoryChannel.js`, `../serve/eventBus.js`) keep resolving via the wrappers — no churn for the 8 importer sites in `cli/src/serve/` plus `cli/src/commands/serve.ts:14`. - `httpAcpBridge.ts` continues to export `AcpChannel` / `AcpChannelExitInfo` / `ChannelFactory` so any external consumer is unaffected. - Zero `/capabilities` payload changes, zero HTTP route changes, zero SDK behavior changes, zero spawn-site behavior changes. What's not in this slice (deferred to PR 22b after PR 17/14b land) - `BridgeClient` + `createHttpAcpBridge` factory + `defaultSpawnChannelFactory` (~3000 LOC, lines 1082-3770 + 4106-4307 of `httpAcpBridge.ts`). - Channel and VSCode-IDE-companion own-spawn migrations. Tests - `npm test --workspace @qwen-code/acp-bridge` — 28/28 pass (eventBus 20 + inMemoryChannel 8) at the new location. - `cd packages/cli && npx vitest run src/serve/` — 567/567 pass (no regressions). - `cd packages/cli && npx tsc --noEmit` clean. References - #4175 Wave 5 PR 22 row - #3803 chiga0's "Stage 1.5-prereq AcpChannel lift" - `httpAcpBridge.ts:679-696` FIXME for the four `PermissionMediator` strategies this slice declares * fix(acp-bridge): minimize package-lock.json diff to acp-bridge entries only The previous commit ran `npm install --ignore-scripts`, which npm 11 treated as license to renormalize peer-dependency markers across the entire lockfile and resolve `@types/react@18.3.28`, `@types/react-dom@18.3.7`, and `@types/prop-types@15.7.15` away from their pinned versions. CI's `npm ci` then refused to install because the manifests no longer matched the lockfile. Restored package-lock.json to origin/main and surgically added only the three entries the new package actually requires: - `node_modules/@qwen-code/acp-bridge` workspace symlink - `packages/acp-bridge` workspace manifest snapshot - `@qwen-code/acp-bridge` listed under `packages/cli`'s dependencies `npm ci --no-audit --ignore-scripts` now succeeds (1453 packages, no warnings about stale lockfile entries). Re-verified `acp-bridge` package tests (28/28 pass) and `tsc --build` clean. * fix(acp-bridge): address PR 22a review feedback Three review-driven fixes: 1. **wenshao**: removed `src/**/*.test.ts` from `tsconfig.json` exclude so the moved `eventBus.test.ts` and `inMemoryChannel.test.ts` regain typecheck coverage. Pre-fix, a future change to `BridgeEvent` / `SubscribeOptions` shape would only fail at runtime; post-fix `tsc --noEmit` catches the mismatch. Matches `packages/core/tsconfig.json`'s pattern (no test exclude; emitted test artefacts in dist/ are accepted convention). 2. **Copilot**: corrected the FIXME line citation in `permission.ts` and `README.md` from `1144-1154` to the actual range `1096-1106` (the four-strategy FIXME inside `BridgeClient.requestPermission`). Verified via grep against current `httpAcpBridge.ts`. 3. **Copilot review summary**: added a "Imports — root vs subpaths" section to README.md explaining when to use the barrel root (`@qwen-code/acp-bridge`) vs per-module subpaths (`/eventBus`, `/inMemoryChannel`, `/channel`, `/permission`), and added `@see` JSDoc pointers in `cli/src/serve/eventBus.ts` and `inMemoryChannel.ts` wrappers to the implementation files for the design-rationale comments that moved to acp-bridge. Verification: 28/28 acp-bridge tests + 567/567 cli serve tests pass; `tsc --noEmit` clean across both packages including the moved test files. Declined (replied on the PR): - Move `@agentclientprotocol/sdk` to `peerDependencies` — sound advice in general but not yet relevant; package is internal (`files: ["dist"]`, no npm publish), so dedupe is automatic through monorepo file: links. Will revisit during PR 28 (npm alpha publish).
105 lines
3.9 KiB
JSON
105 lines
3.9 KiB
JSON
{
|
|
"extends": "../../tsconfig.json",
|
|
"compilerOptions": {
|
|
"outDir": "dist",
|
|
"jsx": "react-jsx",
|
|
"baseUrl": ".",
|
|
"lib": ["DOM", "DOM.Iterable", "ES2023"],
|
|
"types": ["node", "vitest/globals"],
|
|
"paths": {
|
|
"@qwen-code/qwen-code-core": ["../core/src/index.ts"],
|
|
"@qwen-code/qwen-code-core/*": ["../core/src/*"],
|
|
"@qwen-code/acp-bridge": ["../acp-bridge/src/index.ts"],
|
|
"@qwen-code/acp-bridge/*": ["../acp-bridge/src/*"]
|
|
}
|
|
},
|
|
"include": [
|
|
"index.ts",
|
|
"src/**/*.ts",
|
|
"src/**/*.tsx",
|
|
"src/**/*.json",
|
|
"./package.json",
|
|
"../core/src/utils/toml-to-markdown-converter.test.ts",
|
|
"../core/src/utils/toml-to-markdown-converter.ts"
|
|
],
|
|
"exclude": [
|
|
"node_modules",
|
|
"dist",
|
|
// TODO(5691): Fix type errors and remove excludes.
|
|
"src/commands/mcp.test.ts",
|
|
"src/commands/mcp/add.test.ts",
|
|
"src/commands/mcp/list.test.ts",
|
|
"src/commands/mcp/remove.test.ts",
|
|
"src/commands/mcp/reconnect.test.ts",
|
|
"src/config/config.integration.test.ts",
|
|
"src/config/config.test.ts",
|
|
"src/config/extension.test.ts",
|
|
"src/config/settings.test.ts",
|
|
"src/nonInteractiveCli.test.ts",
|
|
"src/services/FileCommandLoader.test.ts",
|
|
"src/services/prompt-processors/argumentProcessor.test.ts",
|
|
"src/serve/auth.test.ts",
|
|
"src/serve/server.test.ts",
|
|
"src/utils/cleanup.test.ts",
|
|
"src/utils/handleAutoUpdate.test.ts",
|
|
"src/utils/startupWarnings.test.ts",
|
|
"src/ui/App.test.tsx",
|
|
"src/ui/commands/aboutCommand.test.ts",
|
|
"src/ui/commands/authCommand.test.ts",
|
|
"src/ui/commands/bugCommand.test.ts",
|
|
"src/ui/commands/clearCommand.test.ts",
|
|
"src/ui/commands/compressCommand.test.ts",
|
|
"src/ui/commands/copyCommand.test.ts",
|
|
"src/ui/commands/docsCommand.test.ts",
|
|
"src/ui/commands/editorCommand.test.ts",
|
|
"src/ui/commands/extensionsCommand.test.ts",
|
|
"src/ui/commands/helpCommand.test.ts",
|
|
"src/ui/commands/restoreCommand.test.ts",
|
|
"src/ui/commands/settingsCommand.test.ts",
|
|
"src/ui/commands/themeCommand.test.ts",
|
|
"src/ui/commands/chatCommand.test.ts",
|
|
"src/ui/commands/directoryCommand.test.tsx",
|
|
"src/ui/commands/ideCommand.test.ts",
|
|
"src/ui/commands/initCommand.test.ts",
|
|
"src/ui/commands/quitCommand.test.ts",
|
|
"src/ui/commands/mcpCommand.test.ts",
|
|
"src/ui/commands/memoryCommand.test.ts",
|
|
"src/ui/commands/statsCommand.test.ts",
|
|
"src/ui/commands/terminalSetupCommand.test.ts",
|
|
"src/ui/commands/toolsCommand.test.ts",
|
|
"src/ui/components/ContextSummaryDisplay.test.tsx",
|
|
"src/ui/components/Footer.test.tsx",
|
|
"src/ui/components/InputPrompt.test.tsx",
|
|
"src/ui/components/ModelStatsDisplay.test.tsx",
|
|
"src/ui/components/SessionSummaryDisplay.test.tsx",
|
|
"src/ui/components/shared/text-buffer.test.ts",
|
|
"src/ui/components/shared/vim-buffer-actions.test.ts",
|
|
"src/ui/components/StatsDisplay.test.tsx",
|
|
"src/ui/components/ToolStatsDisplay.test.tsx",
|
|
"src/ui/components/WarningMessage.test.tsx",
|
|
"src/ui/contexts/SessionContext.test.tsx",
|
|
"src/ui/hooks/slashCommandProcessor.test.ts",
|
|
"src/ui/hooks/useAtCompletion.test.ts",
|
|
"src/ui/hooks/useConsoleMessages.test.ts",
|
|
"src/ui/hooks/useCommandCompletion.test.ts",
|
|
"src/ui/hooks/useFocus.test.ts",
|
|
"src/ui/hooks/useFolderTrust.test.ts",
|
|
"src/ui/hooks/useGeminiStream.test.tsx",
|
|
"src/ui/hooks/useKeypress.test.ts",
|
|
"src/ui/hooks/usePhraseCycler.test.ts",
|
|
"src/ui/hooks/vim.test.ts",
|
|
"src/ui/utils/computeStats.test.ts",
|
|
"src/ui/themes/theme.test.ts",
|
|
"src/validateNonInterActiveAuth.test.ts",
|
|
"src/services/prompt-processors/shellProcessor.test.ts",
|
|
"src/commands/extensions/examples/**"
|
|
],
|
|
"references": [
|
|
{ "path": "../core" },
|
|
{ "path": "../acp-bridge" },
|
|
{ "path": "../channels/base" },
|
|
{ "path": "../channels/telegram" },
|
|
{ "path": "../channels/weixin" },
|
|
{ "path": "../channels/dingtalk" }
|
|
]
|
|
}
|