@anthropic-ai/claude-agent-sdk 0.2.90 → 0.2.91

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.
package/bridge.d.ts CHANGED
@@ -180,6 +180,21 @@ export type RemoteCredentials = {
180
180
  expires_in: number;
181
181
  worker_epoch: number;
182
182
  };
183
+ /**
184
+ * Terminal authz failure from `POST /bridge` — retrying with the same inputs
185
+ * is guaranteed to fail. Returned for 403 `error.resource: "untrusted_device"`
186
+ * when `X-Trusted-Device-Token` is missing or revoked.
187
+ * @alpha
188
+ */
189
+ export type CredentialsFailure = {
190
+ terminal: true;
191
+ reason: 'untrusted_device';
192
+ };
193
+ /**
194
+ * Type guard for `fetchRemoteCredentials` results.
195
+ * @alpha
196
+ */
197
+ export declare function isCredentialsFailure(r: RemoteCredentials | CredentialsFailure | null): r is CredentialsFailure;
183
198
  /**
184
199
  * `POST /v1/code/sessions` — create a fresh CCR session. Returns the `cse_*`
185
200
  * session id, or null on any failure (HTTP error, malformed response).
@@ -191,13 +206,15 @@ export type RemoteCredentials = {
191
206
  export declare function createCodeSession(baseUrl: string, accessToken: string, title: string, timeoutMs: number, tags?: string[]): Promise<string | null>;
192
207
  /**
193
208
  * `POST /v1/code/sessions/{id}/bridge` — mint a worker JWT for the session.
194
- * Returns credentials or null on failure. The call IS the worker register
195
- * (bumps epoch server-side), so pass `epoch: creds.worker_epoch` to
196
- * `attachBridgeSession` to skip a redundant register.
209
+ * Returns credentials, a `CredentialsFailure` for terminal authz failures
210
+ * (don't retry — re-enroll the device), or null on transient failure.
211
+ * The call IS the worker register (bumps epoch server-side), so pass
212
+ * `epoch: creds.worker_epoch` to `attachBridgeSession` to skip a redundant
213
+ * register.
197
214
  *
198
215
  * `trustedDeviceToken` sets the `X-Trusted-Device-Token` header. Required
199
216
  * when the server's `sessions_elevated_auth_enforcement` flag is on
200
217
  * (bridge sessions are SecurityTier=ELEVATED). See anthropics/anthropic#274559.
201
218
  * @alpha
202
219
  */
203
- export declare function fetchRemoteCredentials(sessionId: string, baseUrl: string, accessToken: string, timeoutMs: number, trustedDeviceToken?: string): Promise<RemoteCredentials | null>;
220
+ export declare function fetchRemoteCredentials(sessionId: string, baseUrl: string, accessToken: string, timeoutMs: number, trustedDeviceToken?: string): Promise<RemoteCredentials | CredentialsFailure | null>;