@acosmi/sdk-ts 1.0.2 → 1.2.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.
package/dist/index.mjs CHANGED
@@ -1013,6 +1013,45 @@ var init_adapters = __esm({
1013
1013
 
1014
1014
  // src/index.ts
1015
1015
  init_types();
1016
+
1017
+ // src/model-helpers.ts
1018
+ function modelSupportsInputModality(model, modality) {
1019
+ if (!model) return false;
1020
+ const mods = model.inputModalities;
1021
+ if (!Array.isArray(mods)) return false;
1022
+ return mods.includes(modality);
1023
+ }
1024
+ function modelSupportsImageInput(model) {
1025
+ return modelSupportsInputModality(model, "image");
1026
+ }
1027
+ function findFirstModelByInputModality(models, modality) {
1028
+ if (!Array.isArray(models)) return null;
1029
+ for (const m of models) {
1030
+ if (!m) continue;
1031
+ if (m.isEnabled === false) continue;
1032
+ if (!modelSupportsInputModality(m, modality)) continue;
1033
+ return m;
1034
+ }
1035
+ return null;
1036
+ }
1037
+ function findDesktopVisualUnderstandingModel(models) {
1038
+ if (!Array.isArray(models)) return null;
1039
+ const candidates = [];
1040
+ for (const m of models) {
1041
+ if (!m) continue;
1042
+ if (m.isEnabled === false) continue;
1043
+ if (m.capabilities?.supports_desktop_visual_understanding !== true) continue;
1044
+ if (!modelSupportsInputModality(m, "image")) continue;
1045
+ candidates.push(m);
1046
+ }
1047
+ if (candidates.length === 0) return null;
1048
+ for (const m of candidates) {
1049
+ if (m.isDefault === true) return m;
1050
+ }
1051
+ return candidates[0];
1052
+ }
1053
+
1054
+ // src/index.ts
1016
1055
  init_adapters();
1017
1056
 
1018
1057
  // src/auth.ts
@@ -1972,8 +2011,25 @@ function extractAnthropicBlockMeta(eventType, data, blockTypeMap) {
1972
2011
  }
1973
2012
  }
1974
2013
 
1975
- // src/index.ts
1976
- init_betas();
2014
+ // src/agent-runs-types.ts
2015
+ var AgentRunStreamError = class extends Error {
2016
+ event;
2017
+ code;
2018
+ stage;
2019
+ retryable;
2020
+ constructor(event) {
2021
+ const err = event.error;
2022
+ super(err.stage ? `agent run failed: ${err.stage}: ${err.message}` : `agent run failed: ${err.message}`);
2023
+ this.name = "AgentRunStreamError";
2024
+ this.event = event;
2025
+ this.code = err.code ?? "";
2026
+ this.stage = err.stage ?? "";
2027
+ this.retryable = err.retryable ?? false;
2028
+ }
2029
+ };
2030
+
2031
+ // src/client/agent-runs.ts
2032
+ init_types();
1977
2033
 
1978
2034
  // src/client.ts
1979
2035
  init_types();
@@ -2571,14 +2627,15 @@ var Client = class _Client {
2571
2627
  null,
2572
2628
  signal
2573
2629
  );
2574
- this.modelCache = result.data;
2630
+ const normalized = normalizeInputModalities(result.data);
2631
+ this.modelCache = normalized;
2575
2632
  this.modelCacheTimeMs = Date.now();
2576
2633
  let status = "";
2577
2634
  if (headers) {
2578
2635
  const h = headers.get("X-Entitlement-Filter-Status");
2579
2636
  if (h) status = h;
2580
2637
  }
2581
- return { models: result.data, status };
2638
+ return { models: normalized, status };
2582
2639
  }
2583
2640
  /** 查询当前用户账户级权益总览 (v0.19+) */
2584
2641
  async getQuotaSummary(signal) {
@@ -3211,9 +3268,24 @@ function zeroModelCapabilities() {
3211
3268
  supports_token_efficient: false,
3212
3269
  supports_redact_thinking: false,
3213
3270
  max_input_tokens: 0,
3214
- max_output_tokens: 0
3271
+ max_output_tokens: 0,
3272
+ supports_desktop_visual_understanding: false
3215
3273
  };
3216
3274
  }
3275
+ function normalizeInputModalities(models) {
3276
+ if (!Array.isArray(models)) return models;
3277
+ for (const m of models) {
3278
+ if (!m || typeof m !== "object") continue;
3279
+ if (Array.isArray(m.inputModalities)) continue;
3280
+ const snake = m.input_modalities;
3281
+ if (Array.isArray(snake)) {
3282
+ m.inputModalities = snake.filter(
3283
+ (v) => v === "text" || v === "image"
3284
+ );
3285
+ }
3286
+ }
3287
+ return models;
3288
+ }
3217
3289
  function withRequestTimeout(ms, parent) {
3218
3290
  const ctl = new AbortController();
3219
3291
  const timer = setTimeout(() => ctl.abort(), ms);
@@ -3254,6 +3326,487 @@ async function sleep(ms, signal) {
3254
3326
  });
3255
3327
  }
3256
3328
 
3329
+ // src/client/agent-runs.ts
3330
+ var agentRunsByClient = /* @__PURE__ */ new WeakMap();
3331
+ Object.defineProperty(Client.prototype, "agentRuns", {
3332
+ configurable: true,
3333
+ enumerable: false,
3334
+ get() {
3335
+ let existing = agentRunsByClient.get(this);
3336
+ if (!existing) {
3337
+ existing = new AgentRunsClient(this);
3338
+ agentRunsByClient.set(this, existing);
3339
+ }
3340
+ return existing;
3341
+ }
3342
+ });
3343
+ var AgentRunsClient = class {
3344
+ constructor(client) {
3345
+ this.client = client;
3346
+ }
3347
+ client;
3348
+ async create(req, signal) {
3349
+ const resp = await this.requestAPI(
3350
+ "POST",
3351
+ "/agent-runs",
3352
+ toWireCreateRequest(req),
3353
+ signal,
3354
+ { retryOn401: false }
3355
+ );
3356
+ return fromWireCreateResponse(resp);
3357
+ }
3358
+ get(runId, signal) {
3359
+ return this.requestAPI(
3360
+ "GET",
3361
+ `/agent-runs/${encodeURIComponent(runId)}`,
3362
+ null,
3363
+ signal,
3364
+ { retryOn401: true }
3365
+ ).then(fromWireRun);
3366
+ }
3367
+ stream(runId, opts = {}, signal) {
3368
+ return {
3369
+ [Symbol.asyncIterator]: () => this.streamGen(runId, opts, signal)
3370
+ };
3371
+ }
3372
+ cancel(runId, signal) {
3373
+ return this.requestAPI(
3374
+ "POST",
3375
+ `/agent-runs/${encodeURIComponent(runId)}/cancel`,
3376
+ {},
3377
+ signal,
3378
+ { retryOn401: false }
3379
+ ).then(fromWireRun);
3380
+ }
3381
+ listArtifacts(runId, signal) {
3382
+ return this.requestAPI(
3383
+ "GET",
3384
+ `/agent-runs/${encodeURIComponent(runId)}/artifacts`,
3385
+ null,
3386
+ signal,
3387
+ { retryOn401: true }
3388
+ ).then((r) => (r.artifacts ?? []).map(fromWireArtifact));
3389
+ }
3390
+ async downloadArtifact(runId, artifactId, signal) {
3391
+ const resp = await this.requestRaw(
3392
+ "GET",
3393
+ `/agent-runs/${encodeURIComponent(runId)}/artifacts/${encodeURIComponent(artifactId)}`,
3394
+ null,
3395
+ signal,
3396
+ { retryOn401: true }
3397
+ );
3398
+ const contentType = resp.headers.get("Content-Type") ?? void 0;
3399
+ const filename = filenameFromContentDisposition(resp.headers.get("Content-Disposition")) ?? artifactId;
3400
+ const data = await readLimited(resp.body, maxDownloadSize);
3401
+ return { data, filename, contentType };
3402
+ }
3403
+ submitLocalToolResult(runId, result, signal) {
3404
+ return this.requestAPI(
3405
+ "POST",
3406
+ `/agent-runs/${encodeURIComponent(runId)}/local-tool-results`,
3407
+ toWireLocalToolResult(result),
3408
+ signal,
3409
+ { retryOn401: false }
3410
+ ).then(fromWireRun);
3411
+ }
3412
+ run(req, opts = {}, signal) {
3413
+ return {
3414
+ [Symbol.asyncIterator]: () => this.runGen(req, opts, signal)
3415
+ };
3416
+ }
3417
+ runWithLocalTools(req, handlers, opts = {}, signal) {
3418
+ return {
3419
+ [Symbol.asyncIterator]: () => this.runWithLocalToolsGen(req, handlers, opts, signal)
3420
+ };
3421
+ }
3422
+ async *runGen(req, opts, signal) {
3423
+ const created = await this.create(req, signal);
3424
+ yield* this.stream(created.runId, opts, signal);
3425
+ }
3426
+ async *runWithLocalToolsGen(req, handlers, opts, signal) {
3427
+ let currentRunId = "";
3428
+ for await (const event of this.run(req, opts, signal)) {
3429
+ if (event.type === "run_started") {
3430
+ currentRunId = event.runId;
3431
+ }
3432
+ if (opts.onEvent) await opts.onEvent(event);
3433
+ let localToolTask;
3434
+ if (event.type === "local_tool_request") {
3435
+ if (currentRunId === "") {
3436
+ throw new Error("local tool request arrived before run_started");
3437
+ }
3438
+ localToolTask = this.invokeLocalTool(currentRunId, event, handlers, opts.timeoutMs, signal).then(async (result) => {
3439
+ await this.submitLocalToolResult(currentRunId, result, signal);
3440
+ });
3441
+ }
3442
+ yield event;
3443
+ if (localToolTask) await localToolTask;
3444
+ }
3445
+ }
3446
+ async invokeLocalTool(runId, event, handlers, timeoutMs = 3e4, signal) {
3447
+ const handler = handlers[event.name];
3448
+ if (!handler) {
3449
+ return {
3450
+ requestId: event.requestId,
3451
+ ok: false,
3452
+ error: `local tool rejected: no handler for ${event.name}`
3453
+ };
3454
+ }
3455
+ const ctl = new AbortController();
3456
+ const timer = setTimeout(() => ctl.abort(), timeoutMs);
3457
+ let parentAbort;
3458
+ if (signal) {
3459
+ if (signal.aborted) ctl.abort();
3460
+ else {
3461
+ parentAbort = () => ctl.abort();
3462
+ signal.addEventListener("abort", parentAbort);
3463
+ }
3464
+ }
3465
+ try {
3466
+ const content = await handler(event.input, {
3467
+ runId,
3468
+ requestId: event.requestId,
3469
+ name: event.name,
3470
+ signal: ctl.signal
3471
+ });
3472
+ return { requestId: event.requestId, ok: true, content };
3473
+ } catch (e) {
3474
+ if (signal?.aborted) throw e;
3475
+ const timedOut = ctl.signal.aborted;
3476
+ return {
3477
+ requestId: event.requestId,
3478
+ ok: false,
3479
+ error: timedOut ? `local tool timed out after ${timeoutMs}ms` : errorMessage(e)
3480
+ };
3481
+ } finally {
3482
+ clearTimeout(timer);
3483
+ if (parentAbort && signal) signal.removeEventListener("abort", parentAbort);
3484
+ }
3485
+ }
3486
+ async *streamGen(runId, opts, signal) {
3487
+ const resp = await this.requestRaw(
3488
+ "GET",
3489
+ `/agent-runs/${encodeURIComponent(runId)}/stream`,
3490
+ null,
3491
+ signal,
3492
+ { retryOn401: true, accept: "text/event-stream" }
3493
+ );
3494
+ if (!resp.body) {
3495
+ throw new Error("agent run stream: empty response body");
3496
+ }
3497
+ for await (const event of readAgentRunEvents(resp.body)) {
3498
+ if (event.type === "error" && opts.throwOnError !== false) {
3499
+ throw new AgentRunStreamError(event);
3500
+ }
3501
+ yield event;
3502
+ }
3503
+ }
3504
+ async requestAPI(method, path, body, signal, opts) {
3505
+ const resp = await this.requestRaw(method, path, body, signal, opts);
3506
+ const text = await resp.text();
3507
+ const result = JSON.parse(text);
3508
+ const bizErr = apiResponseBusinessError(result);
3509
+ if (bizErr) throw bizErr;
3510
+ return result.data;
3511
+ }
3512
+ async requestRaw(method, path, body, signal, opts, retried = false) {
3513
+ const token = await this.client.ensureToken(signal);
3514
+ const url = this.client.apiURL(path);
3515
+ const headers = {
3516
+ Authorization: `Bearer ${token}`,
3517
+ Accept: opts.accept ?? "application/json"
3518
+ };
3519
+ let bodyStr;
3520
+ if (body != null) {
3521
+ bodyStr = typeof body === "string" ? body : JSON.stringify(body);
3522
+ headers["Content-Type"] = "application/json";
3523
+ }
3524
+ const resp = await this.client.doRequest({ method, url, headers, body: bodyStr }, signal);
3525
+ if (resp.status === 401 && opts.retryOn401 && !retried) {
3526
+ try {
3527
+ await resp.body?.cancel();
3528
+ } catch {
3529
+ }
3530
+ await this.client.forceRefresh(signal);
3531
+ return this.requestRaw(method, path, body, signal, opts, true);
3532
+ }
3533
+ if (resp.status < 200 || resp.status >= 300) {
3534
+ const bodyBytes = resp.body ? await readLimited(resp.body, maxErrorBodySize) : new Uint8Array();
3535
+ throw parseHTTPErrorWithHeader(resp.status, bodyBytes, resp.headers);
3536
+ }
3537
+ return resp;
3538
+ }
3539
+ };
3540
+ function toWireCreateRequest(req) {
3541
+ return {
3542
+ app_id: req.appId,
3543
+ mode: req.mode,
3544
+ session_id: req.sessionId,
3545
+ input: req.input,
3546
+ messages: req.messages,
3547
+ model: req.model,
3548
+ active_skill_ids: req.activeSkillIds,
3549
+ knowledge_base_ids: req.knowledgeBaseIds,
3550
+ metadata: req.metadata,
3551
+ local_context_policy: req.localContextPolicy ? {
3552
+ enabled: req.localContextPolicy.enabled,
3553
+ readonly: req.localContextPolicy.readonly,
3554
+ max_bytes: req.localContextPolicy.maxBytes,
3555
+ allowed_tools: req.localContextPolicy.allowedTools
3556
+ } : void 0,
3557
+ artifact_policy: req.artifactPolicy ? {
3558
+ enabled: req.artifactPolicy.enabled,
3559
+ max_files: req.artifactPolicy.maxFiles
3560
+ } : void 0
3561
+ };
3562
+ }
3563
+ function toWireLocalToolResult(result) {
3564
+ return {
3565
+ request_id: result.requestId,
3566
+ ok: result.ok,
3567
+ content: result.content,
3568
+ error: result.error
3569
+ };
3570
+ }
3571
+ function fromWireCreateResponse(resp) {
3572
+ return {
3573
+ runId: resp.run_id ?? "",
3574
+ sessionId: resp.session_id ?? "",
3575
+ status: toStatus(resp.status)
3576
+ };
3577
+ }
3578
+ function fromWireRun(resp) {
3579
+ return {
3580
+ runId: resp.run_id ?? "",
3581
+ sessionId: resp.session_id ?? "",
3582
+ appId: resp.app_id,
3583
+ mode: resp.mode,
3584
+ status: toStatus(resp.status),
3585
+ createdAt: resp.created_at,
3586
+ startedAt: resp.started_at,
3587
+ completedAt: resp.completed_at,
3588
+ error: normalizeError(resp.error),
3589
+ metadata: resp.metadata
3590
+ };
3591
+ }
3592
+ function fromWireArtifact(resp) {
3593
+ return {
3594
+ id: resp.id ?? resp.artifact_id ?? "",
3595
+ filename: resp.filename ?? resp.name ?? resp.id ?? resp.artifact_id ?? "artifact",
3596
+ contentType: resp.content_type ?? resp.mime_type,
3597
+ size: typeof resp.size === "number" ? resp.size : void 0,
3598
+ type: resp.type,
3599
+ metadata: resp.metadata
3600
+ };
3601
+ }
3602
+ async function* readAgentRunEvents(body) {
3603
+ let eventName = "";
3604
+ let dataLines = [];
3605
+ const flush = () => {
3606
+ if (dataLines.length === 0) return null;
3607
+ const data = dataLines.join("\n");
3608
+ dataLines = [];
3609
+ if (data === "[DONE]") return null;
3610
+ return parseAgentRunEvent(eventName, data);
3611
+ };
3612
+ for await (const line of iterSSELines(body)) {
3613
+ if (line === "") {
3614
+ const event2 = flush();
3615
+ eventName = "";
3616
+ if (event2) yield event2;
3617
+ continue;
3618
+ }
3619
+ if (line.startsWith(":")) continue;
3620
+ if (line.startsWith("event:")) {
3621
+ eventName = line.slice("event:".length).trim();
3622
+ continue;
3623
+ }
3624
+ if (line.startsWith("data:")) {
3625
+ dataLines.push(line.slice("data:".length).trimStart());
3626
+ }
3627
+ }
3628
+ const event = flush();
3629
+ if (event) yield event;
3630
+ }
3631
+ function parseAgentRunEvent(eventName, data) {
3632
+ const payload = JSON.parse(data);
3633
+ const obj = isRecord(payload) ? payload : { type: eventName, data: payload };
3634
+ const type = stringField(obj, "type") || eventName;
3635
+ switch (type) {
3636
+ case "run_started":
3637
+ return {
3638
+ type: "run_started",
3639
+ runId: stringField(obj, "run_id", "runId"),
3640
+ sessionId: stringField(obj, "session_id", "sessionId")
3641
+ };
3642
+ case "status":
3643
+ return {
3644
+ type: "status",
3645
+ status: stringField(obj, "status"),
3646
+ message: optionalStringField(obj, "message")
3647
+ };
3648
+ case "text_delta":
3649
+ return { type: "text_delta", text: stringField(obj, "text") };
3650
+ case "reasoning_delta":
3651
+ return { type: "reasoning_delta", text: stringField(obj, "text") };
3652
+ case "tool_call":
3653
+ return {
3654
+ type: "tool_call",
3655
+ id: stringField(obj, "id"),
3656
+ name: stringField(obj, "name"),
3657
+ input: obj.input
3658
+ };
3659
+ case "tool_result":
3660
+ return {
3661
+ type: "tool_result",
3662
+ id: stringField(obj, "id"),
3663
+ name: optionalStringField(obj, "name"),
3664
+ result: obj.result,
3665
+ error: optionalStringField(obj, "error")
3666
+ };
3667
+ case "local_tool_request":
3668
+ return {
3669
+ type: "local_tool_request",
3670
+ requestId: stringField(obj, "request_id", "requestId"),
3671
+ name: stringField(obj, "name"),
3672
+ input: obj.input
3673
+ };
3674
+ case "artifact":
3675
+ return {
3676
+ type: "artifact",
3677
+ artifact: fromWireArtifact(isRecord(obj.artifact) ? obj.artifact : obj)
3678
+ };
3679
+ case "sources":
3680
+ return { type: "sources", sources: obj.sources };
3681
+ case "usage":
3682
+ return {
3683
+ type: "usage",
3684
+ usage: normalizeUsage(isRecord(obj.usage) ? obj.usage : obj)
3685
+ };
3686
+ case "settle":
3687
+ return {
3688
+ type: "settle",
3689
+ settlement: normalizeSettlement(isRecord(obj.settlement) ? obj.settlement : obj)
3690
+ };
3691
+ case "error":
3692
+ return { type: "error", error: normalizeError(obj.error) ?? normalizeError(obj) };
3693
+ case "done":
3694
+ return {
3695
+ type: "done",
3696
+ runId: stringField(obj, "run_id", "runId"),
3697
+ status: stringField(obj, "status")
3698
+ };
3699
+ default:
3700
+ return {
3701
+ type: "error",
3702
+ error: {
3703
+ code: "unknown_event",
3704
+ message: `unknown agent run event: ${type}`,
3705
+ raw: obj
3706
+ }
3707
+ };
3708
+ }
3709
+ }
3710
+ function normalizeUsage(value) {
3711
+ return {
3712
+ ...value,
3713
+ inputTokens: numberField(value, "input_tokens", "inputTokens"),
3714
+ outputTokens: numberField(value, "output_tokens", "outputTokens"),
3715
+ totalTokens: numberField(value, "total_tokens", "totalTokens"),
3716
+ cacheReadTokens: numberField(value, "cache_read_tokens", "cacheReadTokens"),
3717
+ cacheCreateTokens: numberField(value, "cache_create_tokens", "cacheCreateTokens"),
3718
+ exact: booleanField(value, "exact"),
3719
+ source: optionalStringField(value, "source")
3720
+ };
3721
+ }
3722
+ function normalizeSettlement(value) {
3723
+ return {
3724
+ ...value,
3725
+ requestId: optionalStringField(value, "request_id", "requestId"),
3726
+ status: optionalStringField(value, "status"),
3727
+ consumeStatus: optionalStringField(value, "consume_status", "consumeStatus"),
3728
+ inputTokens: numberField(value, "input_tokens", "inputTokens"),
3729
+ outputTokens: numberField(value, "output_tokens", "outputTokens"),
3730
+ totalTokens: numberField(value, "total_tokens", "totalTokens"),
3731
+ cacheReadTokens: numberField(value, "cache_read_tokens", "cacheReadTokens"),
3732
+ cacheCreateTokens: numberField(value, "cache_create_tokens", "cacheCreateTokens"),
3733
+ tokenRemaining: numberField(value, "token_remaining", "tokenRemaining"),
3734
+ callRemaining: numberField(value, "call_remaining", "callRemaining"),
3735
+ retryQueued: booleanField(value, "retry_queued", "retryQueued"),
3736
+ exact: booleanField(value, "exact")
3737
+ };
3738
+ }
3739
+ function normalizeError(value) {
3740
+ if (value == null) return void 0;
3741
+ if (typeof value === "string") return { message: value, raw: value };
3742
+ if (!isRecord(value)) return { message: String(value), raw: value };
3743
+ return {
3744
+ code: optionalStringField(value, "code", "error_code", "errorCode"),
3745
+ message: stringField(value, "message", "error") || "agent run failed",
3746
+ stage: optionalStringField(value, "stage"),
3747
+ retryable: typeof value.retryable === "boolean" ? value.retryable : void 0,
3748
+ raw: value
3749
+ };
3750
+ }
3751
+ function toStatus(status) {
3752
+ switch (status) {
3753
+ case "running":
3754
+ case "completed":
3755
+ case "failed":
3756
+ case "cancelled":
3757
+ return status;
3758
+ default:
3759
+ return "queued";
3760
+ }
3761
+ }
3762
+ function isRecord(value) {
3763
+ return value != null && typeof value === "object" && !Array.isArray(value);
3764
+ }
3765
+ function stringField(obj, ...keys) {
3766
+ for (const key of keys) {
3767
+ const value = obj[key];
3768
+ if (typeof value === "string") return value;
3769
+ }
3770
+ return "";
3771
+ }
3772
+ function optionalStringField(obj, ...keys) {
3773
+ const value = stringField(obj, ...keys);
3774
+ return value === "" ? void 0 : value;
3775
+ }
3776
+ function numberField(obj, ...keys) {
3777
+ for (const key of keys) {
3778
+ const value = obj[key];
3779
+ if (typeof value === "number" && Number.isFinite(value)) return value;
3780
+ }
3781
+ return void 0;
3782
+ }
3783
+ function booleanField(obj, ...keys) {
3784
+ for (const key of keys) {
3785
+ const value = obj[key];
3786
+ if (typeof value === "boolean") return value;
3787
+ }
3788
+ return void 0;
3789
+ }
3790
+ function filenameFromContentDisposition(value) {
3791
+ if (!value) return null;
3792
+ const utf8 = /filename\*=UTF-8''([^;]+)/i.exec(value);
3793
+ if (utf8?.[1]) {
3794
+ try {
3795
+ return decodeURIComponent(utf8[1]);
3796
+ } catch {
3797
+ return utf8[1];
3798
+ }
3799
+ }
3800
+ const plain = /filename="?([^";]+)"?/i.exec(value);
3801
+ return plain?.[1] ?? null;
3802
+ }
3803
+ function errorMessage(e) {
3804
+ return e instanceof Error ? e.message : String(e);
3805
+ }
3806
+
3807
+ // src/index.ts
3808
+ init_betas();
3809
+
3257
3810
  // src/client/entitlements.ts
3258
3811
  Client.prototype.getBalance = async function(signal) {
3259
3812
  const resp = await this.doJSON(
@@ -4078,6 +4631,6 @@ Client.prototype.getBugReport = async function(bugID, signal) {
4078
4631
  return resp.data;
4079
4632
  };
4080
4633
 
4081
- export { AnthropicAdapter, BucketClassCommercial, BucketClassGeneric, BusinessError, Client, DefaultRetryPolicy, ErrAuthDenied, ErrBrowserOpen, ErrDiscovery, ErrRegistration, ErrSSLProxy, ErrTimeout, ErrTokenExchange, EventAuthURL, EventComplete, EventError, FileTokenStore, FilterStatusAdminBypass, FilterStatusDisabledByFlag, FilterStatusFallbackMissingUser, FilterStatusFallbackNoBuckets, FilterStatusFallbackTkdistError, FilterStatusFallbackTkdistSkew, FilterStatusInternalBypass, FilterStatusOK, FilterStatusUnknown, HTTPError, InMemoryTokenStore, LocalStorageTokenStore, ModelNotFoundError, NetworkError, OpenAIAdapter, OrderTerminalError, ProviderFormat, RateLimitError, ScopeAI, ScopeAccount, ScopeEntitlements, ScopeModels, ScopeModelsChat, ScopeProfile, ScopeSkillStore, ScopeSkills, ScopeTokenPackages, ScopeTools, ScopeToolsExecute, ScopeWallet, ScopeWalletReadonly, ServerToolTypeWebSearch, StreamError, ThinkingHigh, ThinkingHighMinMaxTokens, ThinkingMax, ThinkingMaxFallbackMaxTokens, ThinkingOff, allScopes, anthropicResponseTextContent, anthropicResponseThinkingContent, anthropicResponseToolUseBlocks, apiResponseBusinessError, apiResponseGetMessage, authorize, bucketInfoIsCommercial, bucketRowIsCommercial, buildBetas, commerceScopes, computeBackoff, defaultRetryable, defaultSafeToRetry, discover, effectivePolicy, exchangeCode, extractAnthropicBlockMeta, fileLockDefaults, getAdapter, getAdapterForModel, isSSLError, modelScopes, newFileTokenStore, newThinkingConfig, newTokenSet, newWebSearchTool, parseNotificationEvent, parseSettlement, parseSourcesEvent, refreshToken, register, revokeToken, sanitize_exports as sanitize, skillScopes, tokenSetIsExpired, uniqueMerge };
4634
+ export { AgentRunStreamError, AgentRunsClient, AnthropicAdapter, BucketClassCommercial, BucketClassGeneric, BusinessError, Client, DefaultRetryPolicy, ErrAuthDenied, ErrBrowserOpen, ErrDiscovery, ErrRegistration, ErrSSLProxy, ErrTimeout, ErrTokenExchange, EventAuthURL, EventComplete, EventError, FileTokenStore, FilterStatusAdminBypass, FilterStatusDisabledByFlag, FilterStatusFallbackMissingUser, FilterStatusFallbackNoBuckets, FilterStatusFallbackTkdistError, FilterStatusFallbackTkdistSkew, FilterStatusInternalBypass, FilterStatusOK, FilterStatusUnknown, HTTPError, InMemoryTokenStore, LocalStorageTokenStore, ModelNotFoundError, NetworkError, OpenAIAdapter, OrderTerminalError, ProviderFormat, RateLimitError, ScopeAI, ScopeAccount, ScopeEntitlements, ScopeModels, ScopeModelsChat, ScopeProfile, ScopeSkillStore, ScopeSkills, ScopeTokenPackages, ScopeTools, ScopeToolsExecute, ScopeWallet, ScopeWalletReadonly, ServerToolTypeWebSearch, StreamError, ThinkingHigh, ThinkingHighMinMaxTokens, ThinkingMax, ThinkingMaxFallbackMaxTokens, ThinkingOff, allScopes, anthropicResponseTextContent, anthropicResponseThinkingContent, anthropicResponseToolUseBlocks, apiResponseBusinessError, apiResponseGetMessage, authorize, bucketInfoIsCommercial, bucketRowIsCommercial, buildBetas, commerceScopes, computeBackoff, defaultRetryable, defaultSafeToRetry, discover, effectivePolicy, exchangeCode, extractAnthropicBlockMeta, fileLockDefaults, findDesktopVisualUnderstandingModel, findFirstModelByInputModality, getAdapter, getAdapterForModel, isSSLError, modelScopes, modelSupportsImageInput, modelSupportsInputModality, newFileTokenStore, newThinkingConfig, newTokenSet, newWebSearchTool, parseNotificationEvent, parseSettlement, parseSourcesEvent, refreshToken, register, revokeToken, sanitize_exports as sanitize, skillScopes, tokenSetIsExpired, uniqueMerge };
4082
4635
  //# sourceMappingURL=index.mjs.map
4083
4636
  //# sourceMappingURL=index.mjs.map