@anthropic-ai/claude-agent-sdk 0.3.237 → 0.3.238

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
@@ -146,6 +146,18 @@ export type AttachBridgeSessionOptions = {
146
146
  onPermissionResponse?: (res: SDKControlResponse) => boolean | void;
147
147
  /** `interrupt` control_request from claude.ai. Already auto-replied-to. */
148
148
  onInterrupt?: () => void;
149
+ /**
150
+ * `stop_task` control_request from claude.ai — per-task Stop from the
151
+ * client's tasks panel. Resolve = stopped (hosts should treat a task the
152
+ * process no longer tracks or that already finished as stopped and
153
+ * resolve, so the client prunes the stale row — but NOT a live paused or
154
+ * pending task, nor an ambiguous name matching several live tasks: those
155
+ * should reject so the user sees an accurate
156
+ * refusal); reject = error control_response with the
157
+ * rejection's message. Omit if the host has no task registry — the CLI
158
+ * then answers with a "not supported in this context" error.
159
+ */
160
+ onStopTask?: (taskId: string) => Promise<void>;
149
161
  onSetModel?: (model: string | undefined) => {
150
162
  ok: true;
151
163
  } | {
@@ -229,7 +241,19 @@ export type CredentialsFailure = {
229
241
  reason: 'untrusted_device' | 'session_stale_relogin' | 'invalid_session_id';
230
242
  } | {
231
243
  terminal: true;
232
- reason: 'request_rejected' | 'malformed_response';
244
+ reason: 'request_rejected';
245
+ /** HTTP status, for the debug trail and user-facing hints. */
246
+ status: number;
247
+ /**
248
+ * 403 only: who wrote the rejection, from response headers — the
249
+ * origin (`request-id: req_…`), a Cloudflare edge before it, or a hop
250
+ * that never reached Anthropic. Attribution for telemetry/copy; not a
251
+ * verdict on ownership.
252
+ */
253
+ source?: 'origin' | 'nonorigin_cf' | 'nonorigin_other';
254
+ } | {
255
+ terminal: true;
256
+ reason: 'malformed_response';
233
257
  /** HTTP status, for the debug trail and user-facing hints. */
234
258
  status: number;
235
259
  };