Files
deepseek-harness/packages/core/tools/src/error-codes.ts
T
sjw1231 09604ac04d refactor(tools): tighten cancellation, approval, and job error contracts
Type the approval denial helper with a closed ApprovalErrorCode, state
that a cancellation is recognized by the signal reason or an Error named
AbortError, note that ApprovalError names a denial rather than a thrown
class, and separate JOB_CONTROLLER_UNAVAILABLE from a missing jobs
service. The jobs README describes JobError as the seam's export rather
than as current caller behavior, and the terminal test asserts one
concurrent send failure.

Refs #7869
2026-11-05 20:21:45 +08:00

25 lines
1.0 KiB
TypeScript

/**
* Error identities the registry records on failed tool results. The values are
* persisted contract; the entry does not re-export them, and consumers compare
* the recorded strings.
* @module
*/
/** Error name the registry records when approval does not grant a call. */
export const APPROVAL_ERROR_NAME = 'ApprovalError'
/** Approval code for a call the user rejected. */
export const APPROVAL_REJECTED = 'APPROVAL_REJECTED'
/** Approval code for an approval request cancelled without a caller cancellation. */
export const APPROVAL_CANCELLED = 'APPROVAL_CANCELLED'
/** Approval code for a call that needs approval when no approval service, Agent, or channel can answer it. */
export const APPROVAL_UNAVAILABLE = 'APPROVAL_UNAVAILABLE'
/** One code an approval denial records under {@link APPROVAL_ERROR_NAME}. */
export type ApprovalErrorCode = typeof APPROVAL_REJECTED | typeof APPROVAL_CANCELLED | typeof APPROVAL_UNAVAILABLE
/** Code of `ToolContextUnavailableError`. */
export const TOOL_CONTEXT_UNAVAILABLE = 'TOOL_CONTEXT_UNAVAILABLE'