You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(serve): introduce ServeErrorKind and BridgeTimeoutError (#4175 Wave 3 PR 13)
Lay the type foundation for `/workspace/preflight` and `/workspace/env` (and
the eventual MCP guardrails route) so cells emitted by all three share a
closed `errorKind` taxonomy:
- `SERVE_ERROR_KINDS` literal-list + `ServeErrorKind` union — the seven
values from #4175 (`missing_binary`, `blocked_egress`, `auth_env_error`,
`init_timeout`, `protocol_error`, `missing_file`, `parse_error`).
- `BridgeTimeoutError` typed class — `withTimeout` now rejects with this
rather than a plain `Error`, letting `mapDomainErrorToErrorKind` recognize
init / heartbeat / extMethod timeouts via `instanceof` instead of
regex-matching message strings. Message format is preserved bit-for-bit.
- `mapDomainErrorToErrorKind` helper — one place to classify
`BridgeTimeoutError`, `SkillError`, fs ENOENT/EACCES/EPERM, ModelConfigError
subclasses (recognized by `name` field — they aren't on the public surface
of `@qwen-code/qwen-code-core`), `SyntaxError`, plus message-regex fallbacks
for legacy throw sites (`agent channel closed`, missing CLI entry path).
- `ServeStatusCell.errorKind` tightened from open `string` to the closed
`ServeErrorKind` union. Backward compatible — PR 12 never assigned the
field.
- SDK mirrors: `DAEMON_ERROR_KINDS` const + `DaemonErrorKind` type;
`DaemonStatusCell.errorKind` tightened.
Tests: 11 new unit tests in `status.test.ts` covering each mapping rule plus
the BridgeTimeoutError shape.
No route changes; no behavior changes for any existing path.
0 commit comments