@theokit/sdk 4.23.0 → 4.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,27 @@
1
+ import { AuthenticationError } from "../../errors.js";
1
2
  /** The store directory, honoring an optional `homeEnvVar` override. */
2
3
  export declare function credentialHome(config: CredentialStoreConfig, env?: Record<string, string | undefined>): string;
3
4
  /** The credential file path inside the (possibly overridden) store directory. */
4
5
  export declare function authFilePath(config: CredentialStoreConfig, env?: Record<string, string | undefined>): string;
5
- /** A credential problem the caller can act on. Never carries the key value. */
6
- export declare class CredentialError extends Error {
7
- constructor(message: string);
6
+ /**
7
+ * A credential problem the caller can act on. Never carries the key value.
8
+ *
9
+ * M78 — this used to extend bare `Error`, which quietly disabled classification for the entire auth
10
+ * path: `isTransientError` is `err instanceof TheokitAgentError && err.isRetryable === true`
11
+ * (`errors.ts:443`), so a credential failure could never be judged transient OR permanent. The
12
+ * predicate was not "forgotten" downstream — it was unusable there by construction.
13
+ *
14
+ * Extending `AuthenticationError` is ADDITIVE: the class still exists, still reports
15
+ * `name: "CredentialError"`, and every existing `instanceof CredentialError` stays true. It only
16
+ * gains ancestors. `AuthenticationError` pins `isRetryable: false`, so gaining the ability to be
17
+ * classified does NOT turn a revoked credential into a retry loop.
18
+ *
19
+ * The single reference does the same thing with one root type: Codex routes every domain failure
20
+ * through `CodexErr` with `is_retryable()` as a method (`protocol/src/error.rs:176`), rather than
21
+ * parallel classes extending the language's `Error`.
22
+ */
23
+ export declare class CredentialError extends AuthenticationError {
24
+ readonly name: string;
8
25
  }
9
26
  export declare function readAuthFile(config: CredentialStoreConfig, env?: Record<string, string | undefined>): StoredCredential | undefined;
10
27
  /**
package/dist/models.cjs CHANGED
@@ -295,6 +295,12 @@ var TheokitAgentError = class extends Error {
295
295
  if (options.metadata !== void 0) this.metadata = options.metadata;
296
296
  }
297
297
  };
298
+ var AuthenticationError = class extends TheokitAgentError {
299
+ name = "AuthenticationError";
300
+ constructor(message, options = {}) {
301
+ super(message, { ...options, isRetryable: false });
302
+ }
303
+ };
298
304
  var ConfigurationError = class extends TheokitAgentError {
299
305
  name = "ConfigurationError";
300
306
  constructor(message, options = {}) {
@@ -535,11 +541,11 @@ function credentialHome(config, env = {}) {
535
541
  function authFilePath(config, env = {}) {
536
542
  return path.join(credentialHome(config, env), config.fileName);
537
543
  }
538
- var CredentialError = class extends Error {
539
- constructor(message) {
540
- super(message);
541
- this.name = "CredentialError";
542
- }
544
+ var CredentialError = class extends AuthenticationError {
545
+ // Field, not an assignment in the constructor: `AuthenticationError.name` is `override readonly`
546
+ // (`errors.ts:174`), so `this.name = …` does not compile. Caught by `tsc`, not by vitest — the
547
+ // suite was green with the broken assignment because the transpiler strips the type.
548
+ name = "CredentialError";
543
549
  };
544
550
  var apiFileSchema = zod.z.object({
545
551
  type: zod.z.literal("api").optional(),