@gea-ai/agent-sdk 0.1.261010-alpha.0 → 0.1.261014-alpha.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.
Files changed (64) hide show
  1. package/dist/agent-ai.d.ts +1 -0
  2. package/dist/agent-ai.js +11 -4
  3. package/dist/agent-call.d.ts +224 -26
  4. package/dist/agent-call.js +233 -35
  5. package/dist/agent-channel-api.js +53 -28
  6. package/dist/agent-channel-author-runtime.js +21 -10
  7. package/dist/agent-channel-control.d.ts +4 -0
  8. package/dist/agent-channel-control.js +336 -0
  9. package/dist/agent-channel-receiver.js +24 -8
  10. package/dist/agent-channel-runtime.js +46 -11
  11. package/dist/agent-channel-worker.js +2 -1
  12. package/dist/agent-computer-http.d.ts +6 -2
  13. package/dist/agent-computer-http.js +31 -12
  14. package/dist/agent-computer-protocol.d.ts +8 -0
  15. package/dist/agent-computer-protocol.js +126 -0
  16. package/dist/agent-computer-scope.d.ts +1 -0
  17. package/dist/agent-computer-scope.js +18 -1
  18. package/dist/agent-computer-session.d.ts +5 -0
  19. package/dist/agent-computer-session.js +149 -25
  20. package/dist/agent-run-host.d.ts +12 -1
  21. package/dist/agent-run-host.js +58 -5
  22. package/dist/agent-session-authority.d.ts +7 -0
  23. package/dist/agent-session-authority.js +1127 -0
  24. package/dist/agent-session-children.js +3 -1
  25. package/dist/agent-session-execution.d.ts +119 -1
  26. package/dist/agent-session-execution.js +409 -59
  27. package/dist/agent-session-executor.d.ts +518 -0
  28. package/dist/agent-session-executor.js +293 -0
  29. package/dist/agent-session-inbox.d.ts +168 -1
  30. package/dist/agent-session-inbox.js +1084 -54
  31. package/dist/agent-session-runner.d.ts +5 -0
  32. package/dist/agent-session-runner.js +38 -0
  33. package/dist/agent-session-stale-run.d.ts +33 -0
  34. package/dist/agent-session-stale-run.js +44 -0
  35. package/dist/agent-session.d.ts +14 -0
  36. package/dist/agent-session.js +229 -12
  37. package/dist/agent-stream-coalescing.d.ts +11 -0
  38. package/dist/agent-stream-coalescing.js +158 -0
  39. package/dist/agent-worker-context.d.ts +4 -0
  40. package/dist/agent-worker-context.js +18 -0
  41. package/dist/agent-worker.d.ts +6 -0
  42. package/dist/agent-worker.js +839 -433
  43. package/dist/channels/index.d.ts +7 -2
  44. package/dist/channels/index.js +3 -0
  45. package/dist/context-runtime.d.ts +1 -0
  46. package/dist/context-runtime.js +1 -0
  47. package/dist/evals.d.ts +8 -0
  48. package/dist/evals.js +96 -2
  49. package/dist/index.d.ts +1 -0
  50. package/dist/session-authority.d.ts +49 -1
  51. package/dist/session-authority.js +2 -2
  52. package/dist/version.d.ts +1 -1
  53. package/dist/version.js +1 -1
  54. package/package.json +6 -8
  55. package/dist/channels/feishu-codec.d.ts +0 -17
  56. package/dist/channels/feishu-codec.js +0 -108
  57. package/dist/channels/feishu-inbound.d.ts +0 -34
  58. package/dist/channels/feishu-inbound.js +0 -135
  59. package/dist/channels/feishu-output.d.ts +0 -427
  60. package/dist/channels/feishu-output.js +0 -852
  61. package/dist/channels/feishu-websocket.d.ts +0 -4
  62. package/dist/channels/feishu-websocket.js +0 -423
  63. package/dist/channels/feishu.d.ts +0 -145
  64. package/dist/channels/feishu.js +0 -85
@@ -6,4 +6,5 @@ export declare function createAgentAI(input: {
6
6
  modelId: string;
7
7
  signal(): AbortSignal;
8
8
  recordUsage(entry: AgentContextUsage): void;
9
+ startUsage?(callId: string, model: string): Promise<void>;
9
10
  }): AgentAI;
package/dist/agent-ai.js CHANGED
@@ -29,9 +29,9 @@ export function createAgentAI(input) {
29
29
  };
30
30
  // The binding owns the model span. Forward the active SDK parent so generic
31
31
  // native calls and Agent-owned calls share the same trace without two model spans.
32
- const observe = (options, result) => result.then((value) => {
32
+ const observe = (options, result, callId) => result.then((value) => {
33
33
  input.recordUsage({
34
- callId: value.callId,
34
+ callId: callId ?? value.callId,
35
35
  model: value.model,
36
36
  label: options.label,
37
37
  usage: value.usage,
@@ -40,6 +40,7 @@ export function createAgentAI(input) {
40
40
  return value;
41
41
  }, (error) => {
42
42
  input.recordUsage({
43
+ callId,
43
44
  model: options.model,
44
45
  label: options.label,
45
46
  usage: null,
@@ -53,20 +54,26 @@ export function createAgentAI(input) {
53
54
  return {
54
55
  async generateText(options) {
55
56
  const parameters = prepare(options);
57
+ const callId = input.startUsage ? crypto.randomUUID() : undefined;
58
+ if (callId)
59
+ await input.startUsage(callId, parameters.model);
56
60
  return observe(parameters, (async () => {
57
61
  if (!input.binding.generateText)
58
62
  throw new Error("AI generation binding is unavailable. Update Worker Runtime.");
59
63
  return input.binding.generateText(parameters);
60
- })());
64
+ })(), callId);
61
65
  },
62
66
  async streamText(options) {
63
67
  const parameters = prepare(options);
68
+ const callId = input.startUsage ? crypto.randomUUID() : undefined;
69
+ if (callId)
70
+ await input.startUsage(callId, parameters.model);
64
71
  const opened = (async () => {
65
72
  if (!input.binding.streamText)
66
73
  throw new Error("AI generation binding is unavailable. Update Worker Runtime.");
67
74
  return input.binding.streamText(parameters);
68
75
  })();
69
- const result = observe(parameters, opened.then((call) => call.result));
76
+ const result = observe(parameters, opened.then((call) => call.result), callId);
70
77
  result.catch(() => { });
71
78
  const call = await opened;
72
79
  return { stream: call.stream, result };
@@ -1,10 +1,37 @@
1
+ import { z } from "zod";
1
2
  import { type AgentWorkerToolInitialization } from "@gea-ai/contract/agent-worker-tools";
2
3
  import type { AgentHostBinding } from "./agent-worker.js";
3
4
  import type { StudioArtifactScope } from "@gea-ai/contract/studio-artifacts";
5
+ /** Fresh Sessions keep the declared-target rule. A resume only needs sessionId. */
6
+ export declare function workerAgentToolInputSchema(input: {
7
+ agents: NonNullable<AgentWorkerToolInitialization["agents"]>;
8
+ canCopy?: boolean;
9
+ artifactScope?: StudioArtifactScope;
10
+ }): z.ZodObject<{
11
+ sessionId: z.ZodOptional<z.ZodUUID>;
12
+ target: z.ZodOptional<z.ZodString>;
13
+ message: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
14
+ role: z.ZodLiteral<"user">;
15
+ parts: z.ZodArray<z.ZodObject<{
16
+ type: z.ZodLiteral<"text">;
17
+ text: z.ZodString;
18
+ }, z.core.$strict>>;
19
+ }, z.core.$strict>]> | z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
20
+ role: z.ZodLiteral<"user">;
21
+ parts: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
22
+ type: z.ZodLiteral<"text">;
23
+ text: z.ZodString;
24
+ }, z.core.$strict>, z.ZodObject<{
25
+ type: z.ZodLiteral<"file">;
26
+ file_id: z.ZodUUID;
27
+ }, z.core.$strict>]>>;
28
+ }, z.core.$strict>]>;
29
+ }, z.core.$strip>;
4
30
  /** The host opens a fresh Worker invocation; only its visible answer returns to the caller. */
5
31
  export declare function createWorkerAgentTool(input: {
6
32
  agents: NonNullable<AgentWorkerToolInitialization["agents"]>;
7
33
  host: AgentHostBinding;
34
+ runId?: string;
8
35
  canCopy?: boolean;
9
36
  artifactScope?: StudioArtifactScope;
10
37
  }): ({
@@ -14,7 +41,7 @@ export declare function createWorkerAgentTool(input: {
14
41
  metadata?: import("@ai-sdk/provider").JSONObject;
15
42
  inputSchema: import("ai").FlexibleSchema<{
16
43
  sessionId?: string | undefined;
17
- target: string | undefined;
44
+ target?: string | undefined;
18
45
  message: string | {
19
46
  role: "user";
20
47
  parts: ({
@@ -35,7 +62,7 @@ export declare function createWorkerAgentTool(input: {
35
62
  contextSchema?: import("ai").FlexibleSchema<import("@ai-sdk/provider-utils").Context> | undefined;
36
63
  needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
37
64
  sessionId?: string | undefined;
38
- target: string | undefined;
65
+ target?: string | undefined;
39
66
  message: string | {
40
67
  role: "user";
41
68
  parts: ({
@@ -60,7 +87,7 @@ export declare function createWorkerAgentTool(input: {
60
87
  onInputAvailable?: ((options: {
61
88
  input: {
62
89
  sessionId?: string | undefined;
63
- target: string | undefined;
90
+ target?: string | undefined;
64
91
  message: string | {
65
92
  role: "user";
66
93
  parts: ({
@@ -83,7 +110,7 @@ export declare function createWorkerAgentTool(input: {
83
110
  toolCallId: string;
84
111
  input: {
85
112
  sessionId?: string | undefined;
86
- target: string | undefined;
113
+ target?: string | undefined;
87
114
  message: string | {
88
115
  role: "user";
89
116
  parts: ({
@@ -120,6 +147,16 @@ export declare function createWorkerAgentTool(input: {
120
147
  } | {
121
148
  error: string;
122
149
  message: string;
150
+ } | {
151
+ code: "UPSTREAM_HTTP_ERROR";
152
+ status: number;
153
+ message: string;
154
+ } | {
155
+ code: string;
156
+ reason: string;
157
+ status: number;
158
+ requestId?: string | undefined;
159
+ message: string;
123
160
  }>;
124
161
  }) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
125
162
  } & {
@@ -142,10 +179,20 @@ export declare function createWorkerAgentTool(input: {
142
179
  } | {
143
180
  error: string;
144
181
  message: string;
182
+ } | {
183
+ code: "UPSTREAM_HTTP_ERROR";
184
+ status: number;
185
+ message: string;
186
+ } | {
187
+ code: string;
188
+ reason: string;
189
+ status: number;
190
+ requestId?: string | undefined;
191
+ message: string;
145
192
  }> | undefined;
146
193
  execute: import("ai").ToolExecuteFunction<{
147
194
  sessionId?: string | undefined;
148
- target: string | undefined;
195
+ target?: string | undefined;
149
196
  message: string | {
150
197
  role: "user";
151
198
  parts: ({
@@ -181,6 +228,16 @@ export declare function createWorkerAgentTool(input: {
181
228
  } | {
182
229
  error: string;
183
230
  message: string;
231
+ } | {
232
+ code: "UPSTREAM_HTTP_ERROR";
233
+ status: number;
234
+ message: string;
235
+ } | {
236
+ code: string;
237
+ reason: string;
238
+ status: number;
239
+ requestId?: string | undefined;
240
+ message: string;
184
241
  }, NoInfer<import("@ai-sdk/provider-utils").Context>>;
185
242
  } & {
186
243
  description?: string | ((options: {
@@ -191,7 +248,7 @@ export declare function createWorkerAgentTool(input: {
191
248
  inputExamples?: {
192
249
  input: NoInfer<{
193
250
  sessionId?: string | undefined;
194
- target: string | undefined;
251
+ target?: string | undefined;
195
252
  message: string | {
196
253
  role: "user";
197
254
  parts: ({
@@ -219,7 +276,7 @@ export declare function createWorkerAgentTool(input: {
219
276
  } & {
220
277
  execute: import("ai").ToolExecuteFunction<{
221
278
  sessionId?: string | undefined;
222
- target: string | undefined;
279
+ target?: string | undefined;
223
280
  message: string | {
224
281
  role: "user";
225
282
  parts: ({
@@ -255,6 +312,16 @@ export declare function createWorkerAgentTool(input: {
255
312
  } | {
256
313
  error: string;
257
314
  message: string;
315
+ } | {
316
+ code: "UPSTREAM_HTTP_ERROR";
317
+ status: number;
318
+ message: string;
319
+ } | {
320
+ code: string;
321
+ reason: string;
322
+ status: number;
323
+ requestId?: string | undefined;
324
+ message: string;
258
325
  }, NoInfer<import("@ai-sdk/provider-utils").Context>>;
259
326
  }) | ({
260
327
  deferLoading?: boolean;
@@ -263,7 +330,7 @@ export declare function createWorkerAgentTool(input: {
263
330
  metadata?: import("@ai-sdk/provider").JSONObject;
264
331
  inputSchema: import("ai").FlexibleSchema<{
265
332
  sessionId?: string | undefined;
266
- target: string | undefined;
333
+ target?: string | undefined;
267
334
  message: string | {
268
335
  role: "user";
269
336
  parts: ({
@@ -284,7 +351,7 @@ export declare function createWorkerAgentTool(input: {
284
351
  contextSchema?: import("ai").FlexibleSchema<import("@ai-sdk/provider-utils").Context> | undefined;
285
352
  needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
286
353
  sessionId?: string | undefined;
287
- target: string | undefined;
354
+ target?: string | undefined;
288
355
  message: string | {
289
356
  role: "user";
290
357
  parts: ({
@@ -309,7 +376,7 @@ export declare function createWorkerAgentTool(input: {
309
376
  onInputAvailable?: ((options: {
310
377
  input: {
311
378
  sessionId?: string | undefined;
312
- target: string | undefined;
379
+ target?: string | undefined;
313
380
  message: string | {
314
381
  role: "user";
315
382
  parts: ({
@@ -332,7 +399,7 @@ export declare function createWorkerAgentTool(input: {
332
399
  toolCallId: string;
333
400
  input: {
334
401
  sessionId?: string | undefined;
335
- target: string | undefined;
402
+ target?: string | undefined;
336
403
  message: string | {
337
404
  role: "user";
338
405
  parts: ({
@@ -369,6 +436,16 @@ export declare function createWorkerAgentTool(input: {
369
436
  } | {
370
437
  error: string;
371
438
  message: string;
439
+ } | {
440
+ code: "UPSTREAM_HTTP_ERROR";
441
+ status: number;
442
+ message: string;
443
+ } | {
444
+ code: string;
445
+ reason: string;
446
+ status: number;
447
+ requestId?: string | undefined;
448
+ message: string;
372
449
  }>;
373
450
  }) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
374
451
  } & {
@@ -391,10 +468,20 @@ export declare function createWorkerAgentTool(input: {
391
468
  } | {
392
469
  error: string;
393
470
  message: string;
471
+ } | {
472
+ code: "UPSTREAM_HTTP_ERROR";
473
+ status: number;
474
+ message: string;
475
+ } | {
476
+ code: string;
477
+ reason: string;
478
+ status: number;
479
+ requestId?: string | undefined;
480
+ message: string;
394
481
  }> | undefined;
395
482
  execute: import("ai").ToolExecuteFunction<{
396
483
  sessionId?: string | undefined;
397
- target: string | undefined;
484
+ target?: string | undefined;
398
485
  message: string | {
399
486
  role: "user";
400
487
  parts: ({
@@ -430,6 +517,16 @@ export declare function createWorkerAgentTool(input: {
430
517
  } | {
431
518
  error: string;
432
519
  message: string;
520
+ } | {
521
+ code: "UPSTREAM_HTTP_ERROR";
522
+ status: number;
523
+ message: string;
524
+ } | {
525
+ code: string;
526
+ reason: string;
527
+ status: number;
528
+ requestId?: string | undefined;
529
+ message: string;
433
530
  }, NoInfer<import("@ai-sdk/provider-utils").Context>>;
434
531
  } & {
435
532
  description?: string | ((options: {
@@ -440,7 +537,7 @@ export declare function createWorkerAgentTool(input: {
440
537
  inputExamples?: {
441
538
  input: NoInfer<{
442
539
  sessionId?: string | undefined;
443
- target: string | undefined;
540
+ target?: string | undefined;
444
541
  message: string | {
445
542
  role: "user";
446
543
  parts: ({
@@ -468,7 +565,7 @@ export declare function createWorkerAgentTool(input: {
468
565
  } & {
469
566
  execute: import("ai").ToolExecuteFunction<{
470
567
  sessionId?: string | undefined;
471
- target: string | undefined;
568
+ target?: string | undefined;
472
569
  message: string | {
473
570
  role: "user";
474
571
  parts: ({
@@ -504,6 +601,16 @@ export declare function createWorkerAgentTool(input: {
504
601
  } | {
505
602
  error: string;
506
603
  message: string;
604
+ } | {
605
+ code: "UPSTREAM_HTTP_ERROR";
606
+ status: number;
607
+ message: string;
608
+ } | {
609
+ code: string;
610
+ reason: string;
611
+ status: number;
612
+ requestId?: string | undefined;
613
+ message: string;
507
614
  }, NoInfer<import("@ai-sdk/provider-utils").Context>>;
508
615
  }) | ({
509
616
  deferLoading?: boolean;
@@ -512,7 +619,7 @@ export declare function createWorkerAgentTool(input: {
512
619
  metadata?: import("@ai-sdk/provider").JSONObject;
513
620
  inputSchema: import("ai").FlexibleSchema<{
514
621
  sessionId?: string | undefined;
515
- target: string | undefined;
622
+ target?: string | undefined;
516
623
  message: string | {
517
624
  role: "user";
518
625
  parts: ({
@@ -533,7 +640,7 @@ export declare function createWorkerAgentTool(input: {
533
640
  contextSchema?: import("ai").FlexibleSchema<import("@ai-sdk/provider-utils").Context> | undefined;
534
641
  needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
535
642
  sessionId?: string | undefined;
536
- target: string | undefined;
643
+ target?: string | undefined;
537
644
  message: string | {
538
645
  role: "user";
539
646
  parts: ({
@@ -558,7 +665,7 @@ export declare function createWorkerAgentTool(input: {
558
665
  onInputAvailable?: ((options: {
559
666
  input: {
560
667
  sessionId?: string | undefined;
561
- target: string | undefined;
668
+ target?: string | undefined;
562
669
  message: string | {
563
670
  role: "user";
564
671
  parts: ({
@@ -581,7 +688,7 @@ export declare function createWorkerAgentTool(input: {
581
688
  toolCallId: string;
582
689
  input: {
583
690
  sessionId?: string | undefined;
584
- target: string | undefined;
691
+ target?: string | undefined;
585
692
  message: string | {
586
693
  role: "user";
587
694
  parts: ({
@@ -618,6 +725,16 @@ export declare function createWorkerAgentTool(input: {
618
725
  } | {
619
726
  error: string;
620
727
  message: string;
728
+ } | {
729
+ code: "UPSTREAM_HTTP_ERROR";
730
+ status: number;
731
+ message: string;
732
+ } | {
733
+ code: string;
734
+ reason: string;
735
+ status: number;
736
+ requestId?: string | undefined;
737
+ message: string;
621
738
  }>;
622
739
  }) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
623
740
  } & {
@@ -640,10 +757,20 @@ export declare function createWorkerAgentTool(input: {
640
757
  } | {
641
758
  error: string;
642
759
  message: string;
760
+ } | {
761
+ code: "UPSTREAM_HTTP_ERROR";
762
+ status: number;
763
+ message: string;
764
+ } | {
765
+ code: string;
766
+ reason: string;
767
+ status: number;
768
+ requestId?: string | undefined;
769
+ message: string;
643
770
  }> | undefined;
644
771
  execute: import("ai").ToolExecuteFunction<{
645
772
  sessionId?: string | undefined;
646
- target: string | undefined;
773
+ target?: string | undefined;
647
774
  message: string | {
648
775
  role: "user";
649
776
  parts: ({
@@ -679,6 +806,16 @@ export declare function createWorkerAgentTool(input: {
679
806
  } | {
680
807
  error: string;
681
808
  message: string;
809
+ } | {
810
+ code: "UPSTREAM_HTTP_ERROR";
811
+ status: number;
812
+ message: string;
813
+ } | {
814
+ code: string;
815
+ reason: string;
816
+ status: number;
817
+ requestId?: string | undefined;
818
+ message: string;
682
819
  }, NoInfer<import("@ai-sdk/provider-utils").Context>>;
683
820
  } & {
684
821
  type: 'provider';
@@ -693,7 +830,7 @@ export declare function createWorkerAgentTool(input: {
693
830
  } & {
694
831
  execute: import("ai").ToolExecuteFunction<{
695
832
  sessionId?: string | undefined;
696
- target: string | undefined;
833
+ target?: string | undefined;
697
834
  message: string | {
698
835
  role: "user";
699
836
  parts: ({
@@ -729,6 +866,16 @@ export declare function createWorkerAgentTool(input: {
729
866
  } | {
730
867
  error: string;
731
868
  message: string;
869
+ } | {
870
+ code: "UPSTREAM_HTTP_ERROR";
871
+ status: number;
872
+ message: string;
873
+ } | {
874
+ code: string;
875
+ reason: string;
876
+ status: number;
877
+ requestId?: string | undefined;
878
+ message: string;
732
879
  }, NoInfer<import("@ai-sdk/provider-utils").Context>>;
733
880
  }) | ({
734
881
  deferLoading?: boolean;
@@ -737,7 +884,7 @@ export declare function createWorkerAgentTool(input: {
737
884
  metadata?: import("@ai-sdk/provider").JSONObject;
738
885
  inputSchema: import("ai").FlexibleSchema<{
739
886
  sessionId?: string | undefined;
740
- target: string | undefined;
887
+ target?: string | undefined;
741
888
  message: string | {
742
889
  role: "user";
743
890
  parts: ({
@@ -758,7 +905,7 @@ export declare function createWorkerAgentTool(input: {
758
905
  contextSchema?: import("ai").FlexibleSchema<import("@ai-sdk/provider-utils").Context> | undefined;
759
906
  needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
760
907
  sessionId?: string | undefined;
761
- target: string | undefined;
908
+ target?: string | undefined;
762
909
  message: string | {
763
910
  role: "user";
764
911
  parts: ({
@@ -783,7 +930,7 @@ export declare function createWorkerAgentTool(input: {
783
930
  onInputAvailable?: ((options: {
784
931
  input: {
785
932
  sessionId?: string | undefined;
786
- target: string | undefined;
933
+ target?: string | undefined;
787
934
  message: string | {
788
935
  role: "user";
789
936
  parts: ({
@@ -806,7 +953,7 @@ export declare function createWorkerAgentTool(input: {
806
953
  toolCallId: string;
807
954
  input: {
808
955
  sessionId?: string | undefined;
809
- target: string | undefined;
956
+ target?: string | undefined;
810
957
  message: string | {
811
958
  role: "user";
812
959
  parts: ({
@@ -843,6 +990,16 @@ export declare function createWorkerAgentTool(input: {
843
990
  } | {
844
991
  error: string;
845
992
  message: string;
993
+ } | {
994
+ code: "UPSTREAM_HTTP_ERROR";
995
+ status: number;
996
+ message: string;
997
+ } | {
998
+ code: string;
999
+ reason: string;
1000
+ status: number;
1001
+ requestId?: string | undefined;
1002
+ message: string;
846
1003
  }>;
847
1004
  }) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
848
1005
  } & {
@@ -865,10 +1022,20 @@ export declare function createWorkerAgentTool(input: {
865
1022
  } | {
866
1023
  error: string;
867
1024
  message: string;
1025
+ } | {
1026
+ code: "UPSTREAM_HTTP_ERROR";
1027
+ status: number;
1028
+ message: string;
1029
+ } | {
1030
+ code: string;
1031
+ reason: string;
1032
+ status: number;
1033
+ requestId?: string | undefined;
1034
+ message: string;
868
1035
  }> | undefined;
869
1036
  execute: import("ai").ToolExecuteFunction<{
870
1037
  sessionId?: string | undefined;
871
- target: string | undefined;
1038
+ target?: string | undefined;
872
1039
  message: string | {
873
1040
  role: "user";
874
1041
  parts: ({
@@ -904,6 +1071,16 @@ export declare function createWorkerAgentTool(input: {
904
1071
  } | {
905
1072
  error: string;
906
1073
  message: string;
1074
+ } | {
1075
+ code: "UPSTREAM_HTTP_ERROR";
1076
+ status: number;
1077
+ message: string;
1078
+ } | {
1079
+ code: string;
1080
+ reason: string;
1081
+ status: number;
1082
+ requestId?: string | undefined;
1083
+ message: string;
907
1084
  }, NoInfer<import("@ai-sdk/provider-utils").Context>>;
908
1085
  } & {
909
1086
  type: 'provider';
@@ -918,7 +1095,7 @@ export declare function createWorkerAgentTool(input: {
918
1095
  } & {
919
1096
  execute: import("ai").ToolExecuteFunction<{
920
1097
  sessionId?: string | undefined;
921
- target: string | undefined;
1098
+ target?: string | undefined;
922
1099
  message: string | {
923
1100
  role: "user";
924
1101
  parts: ({
@@ -954,6 +1131,16 @@ export declare function createWorkerAgentTool(input: {
954
1131
  } | {
955
1132
  error: string;
956
1133
  message: string;
1134
+ } | {
1135
+ code: "UPSTREAM_HTTP_ERROR";
1136
+ status: number;
1137
+ message: string;
1138
+ } | {
1139
+ code: string;
1140
+ reason: string;
1141
+ status: number;
1142
+ requestId?: string | undefined;
1143
+ message: string;
957
1144
  }, NoInfer<import("@ai-sdk/provider-utils").Context>>;
958
1145
  });
959
1146
  export declare function createWorkerRunCancelTool({ host, }: {
@@ -1225,7 +1412,18 @@ export declare function createWorkerRunCancelTool({ host, }: {
1225
1412
  status: "abort_requested" | "not_running";
1226
1413
  }, NoInfer<import("@ai-sdk/provider-utils").Context>>;
1227
1414
  });
1415
+ export declare function readChildHttpRejection(response: Response): Promise<{
1416
+ body: unknown;
1417
+ bodyPrefix: string;
1418
+ bodyState: string;
1419
+ logReason: string;
1420
+ code: string;
1421
+ reason: string;
1422
+ requestId: string | undefined;
1423
+ }>;
1228
1424
  export declare function readWorkerAgentResponse(response: Response, options?: {
1425
+ runId?: string;
1426
+ requestPath?: string;
1229
1427
  persistedSessionWaiting?: () => Promise<boolean>;
1230
1428
  }): Promise<{
1231
1429
  status: "completed" | "suspended";