dsh-llm depends on dsh-attachment and dsh-typert-protocol, so classes in those packages could not extend a base defined in dsh-llm without a project-reference cycle. HarnessError now lives in @deepseek-ai/dsh-error, which has no dependencies; dsh-llm declares it as a peer and re-exports the same class, so existing imports and instanceof checks keep working. The Agent Note records why the original leaf-package placement no longer holds. Refs #7869
23 lines
827 B
TypeScript
23 lines
827 B
TypeScript
/**
|
|
* Harness error base with a stable machine-routable code and chained cause.
|
|
* Package errors extend it so tool results and replay can retain failure class.
|
|
* @module @deepseek-ai/dsh-error
|
|
*/
|
|
|
|
/**
|
|
* Base class for all harness errors. Carries a `code` (stable, programmatic —
|
|
* e.g. `NO_ADAPTER`, `INVALID_ARGS`) distinct from the
|
|
* human-readable `message`, and supports `cause` chaining via the standard
|
|
* `ErrorOptions`. `name` defaults to the subclass constructor name.
|
|
*/
|
|
export class HarnessError extends Error {
|
|
/** Stable machine-routable failure class (e.g. `RATE_LIMIT`); route on this, never by parsing `message`. */
|
|
readonly code: string
|
|
|
|
constructor(message: string, code: string, options?: ErrorOptions) {
|
|
super(message, options)
|
|
this.code = code
|
|
this.name = new.target.name
|
|
}
|
|
}
|