UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

56 lines (55 loc) • 2.52 kB
//#region src/agents/harness/errors.ts var MissingAgentHarnessError = class extends Error { constructor(e) { super(`Requested agent harness "${e}" is not registered.`); this.name = "MissingAgentHarnessError"; } }; function isMissingAgentHarnessError(e) { return e instanceof MissingAgentHarnessError; } /** A harness lost ownership of the session generation before the attempt could start. */ var AgentHarnessSessionSupersededError = class extends Error { constructor(e, t) { super(e, t); this.name = "AgentHarnessSessionSupersededError"; } }; /** Required native cleanup failed; the host must preserve the current session generation. */ var AgentHarnessSessionCleanupError = class extends Error { constructor(e, t) { super(e, t); this.name = "AgentHarnessSessionCleanupError"; } }; /** A model-independent harness preflight failed before an attempt could start. */ var AgentHarnessPreflightError = class extends Error { constructor(e, t) { super(e, t); this.name = "AgentHarnessPreflightError"; this.scope = t?.scope; this.userMessage = t?.userMessage; } }; /** A native session registration attempted to bypass the host's turn admission. */ var SessionControllerAdmissionRequiredError = class extends AgentHarnessPreflightError { constructor() { const e = "Session-keyed native runs require a host-admitted harness turn. Register this run from the host-provided runAttempt callback; use detached execution only for sessionless work."; super(e, { userMessage: e }); this.code = "SESSION_CONTROLLER_ADMISSION_REQUIRED"; this.name = "SessionControllerAdmissionRequiredError"; } }; const agentHarnessPreflightOwners = /* @__PURE__ */ new WeakMap(); function recordAgentHarnessPreflightOwner(e, t) { if (isAgentHarnessPreflightError(e) && e.scope === "harness") agentHarnessPreflightOwners.set(e, t); } function resolveAgentHarnessPreflightOwner(e) { return isAgentHarnessPreflightError(e) ? agentHarnessPreflightOwners.get(e) : void 0; } /** Returns whether fallback would only repeat the same harness preflight failure. */ function isAgentHarnessPreflightError(e) { return e instanceof AgentHarnessPreflightError; } //#endregion export { SessionControllerAdmissionRequiredError as a, recordAgentHarnessPreflightOwner as c, MissingAgentHarnessError as i, resolveAgentHarnessPreflightOwner as l, AgentHarnessSessionCleanupError as n, isAgentHarnessPreflightError as o, AgentHarnessSessionSupersededError as r, isMissingAgentHarnessError as s, AgentHarnessPreflightError as t };