openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
2 lines • 2.13 kB
JavaScript
//!src/secrets/resolve-errors.ts
var SecretProviderResolutionError=class extends Error{constructor(e){super(e.message,e.cause!==void 0?{cause:e.cause}:void 0);this.scope=`provider`;this.name=`SecretProviderResolutionError`;this.code=e.code;this.source=e.source;this.provider=e.provider}};var SecretRefResolutionError=class extends Error{constructor(e){super(e.message,e.cause!==void 0?{cause:e.cause}:void 0);this.scope=`ref`;this.name=`SecretRefResolutionError`;this.code=e.code;this.source=e.source;this.provider=e.provider;this.refId=e.refId}};function isSecretResolutionError(e){return e instanceof SecretProviderResolutionError||e instanceof SecretRefResolutionError}function describeSecretResolutionOperatorDiagnostic(e){if(e instanceof SecretRefResolutionError&&e.code===`SECRET_REF_REDACTED_VALUE`)return`Secret reference "${e.source}:${e.provider}:${e.refId}" resolves to a redaction placeholder`;if(e instanceof SecretProviderResolutionError&&e.code===`SECRET_PROVIDER_PATH_SECURITY_UNVERIFIABLE`)return`Windows path security could not be verified`}function describeSecretResolutionOperatorRecovery(e){if(e instanceof SecretRefResolutionError&&e.code===`SECRET_REF_REDACTED_VALUE`)return`Run openclaw doctor --fix to repair a store-backed Gateway token; supply a real credential for other secrets, then restart the Gateway and reconnect or re-pair clients`;if(!(e instanceof SecretProviderResolutionError)||e.code!==`SECRET_PROVIDER_PATH_SECURITY_UNVERIFIABLE`)return;return e.source===`exec`?`Restore Windows path security verification, or use an existing provider command whose owner and ACLs OpenClaw can verify`:`Restore Windows path security verification, or use an existing secret file whose owner and ACLs OpenClaw can verify`}function providerResolutionError(e){return new SecretProviderResolutionError({...e,code:e.code??`SECRET_PROVIDER_UNAVAILABLE`})}function refResolutionError(e){return new SecretRefResolutionError(e)}export{refResolutionError as a,providerResolutionError as i,describeSecretResolutionOperatorRecovery as n,isSecretResolutionError as r,describeSecretResolutionOperatorDiagnostic as t};