* refactor(query): deepen dispatch policy seam with structured result contract Closes #3065. - unify query dispatch outcome as typed success/failure union - include error kind/details + final exit_code in failure path - align native and fallback paths under one dispatch policy seam - make CLI query path consume seam result (thin adapter) - add ADR + context term for Dispatch Policy Module * refactor(query): strengthen dispatch seam with shared error mapper and typed details - add query-dispatch-error-mapper module shared by native/fallback paths - remove ad-hoc inline mapping in dispatch/fallback executors - lock error-details schema in mapper + dispatch tests - document structured dispatch contract in QUERY-HANDLERS.md * fix(query): return structured fallback failure when path resolution throws - guard resolveGsdToolsPath in cjs dispatch path - map thrown resolution errors to fallback_failure result - add regression test for structured failure contract
31 lines
653 B
TypeScript
31 lines
653 B
TypeScript
export type QueryDispatchErrorKind =
|
|
| 'unknown_command'
|
|
| 'native_failure'
|
|
| 'native_timeout'
|
|
| 'fallback_failure'
|
|
| 'validation_error'
|
|
| 'internal_error';
|
|
|
|
export interface QueryDispatchError {
|
|
kind: QueryDispatchErrorKind;
|
|
code: number;
|
|
message: string;
|
|
details?: Record<string, unknown>;
|
|
}
|
|
|
|
export interface QueryDispatchSuccessResult {
|
|
ok: true;
|
|
stdout: string;
|
|
stderr: string[];
|
|
exit_code: 0;
|
|
}
|
|
|
|
export interface QueryDispatchFailureResult {
|
|
ok: false;
|
|
error: QueryDispatchError;
|
|
stderr: string[];
|
|
exit_code: number;
|
|
}
|
|
|
|
export type QueryDispatchResult = QueryDispatchSuccessResult | QueryDispatchFailureResult;
|