@meistrari/agent-sdk 0.2.0 → 0.3.1

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.d.cts CHANGED
@@ -1,4 +1,6 @@
1
- import { z } from 'zod';
1
+ import { E as ExecuteAgentRequest, a as ExecuteAgentResponse, U as UpdateAgentModelRequest, b as UpdateAgentModelResponse, S as SessionTimelineResponse, c as SessionStreamEvent } from './shared/agent-sdk.3fcc7aba.cjs';
2
+ export { A as AgentInput, d as SessionStatus, T as TimelineEvent, e as TimelineMetrics, f as TimelinePrompt, g as TimelineRunTurnMetrics, h as TimelineSpan, i as TimelineToolResult } from './shared/agent-sdk.3fcc7aba.cjs';
3
+ import 'zod';
2
4
 
3
5
  interface AuthStrategy {
4
6
  getHeaders: () => Headers;
@@ -14,141 +16,6 @@ declare class APIKeyAuthStrategy implements AuthStrategy {
14
16
  getHeaders(): Headers;
15
17
  }
16
18
 
17
- declare const agentInputSchema: z.ZodObject<{
18
- vaultRef: z.ZodString;
19
- filename: z.ZodString;
20
- metadata: z.ZodOptional<z.ZodString>;
21
- }, z.core.$strict>;
22
- type AgentInput = z.infer<typeof agentInputSchema>;
23
- declare const executeAgentRequestSchema: z.ZodObject<{
24
- sessionId: z.ZodOptional<z.ZodString>;
25
- organizationName: z.ZodOptional<z.ZodString>;
26
- repository: z.ZodOptional<z.ZodString>;
27
- ref: z.ZodOptional<z.ZodString>;
28
- message: z.ZodOptional<z.ZodString>;
29
- inputs: z.ZodOptional<z.ZodArray<z.ZodObject<{
30
- vaultRef: z.ZodString;
31
- filename: z.ZodString;
32
- metadata: z.ZodOptional<z.ZodString>;
33
- }, z.core.$strict>>>;
34
- environmentVariables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
35
- recover: z.ZodOptional<z.ZodBoolean>;
36
- }, z.core.$strict>;
37
- type ExecuteAgentRequest = z.infer<typeof executeAgentRequestSchema>;
38
- declare const executeAgentResponseSchema: z.ZodObject<{
39
- success: z.ZodBoolean;
40
- sessionId: z.ZodOptional<z.ZodString>;
41
- error: z.ZodOptional<z.ZodString>;
42
- }, z.core.$strip>;
43
- type ExecuteAgentResponse = z.infer<typeof executeAgentResponseSchema>;
44
- declare const updateAgentModelRequestSchema: z.ZodObject<{
45
- repository: z.ZodString;
46
- model: z.ZodEnum<{
47
- [x: string]: string;
48
- }>;
49
- commitMessage: z.ZodOptional<z.ZodString>;
50
- }, z.core.$strict>;
51
- type UpdateAgentModelRequest = z.infer<typeof updateAgentModelRequestSchema>;
52
- declare const updateAgentModelResponseSchema: z.ZodObject<{
53
- success: z.ZodBoolean;
54
- organizationName: z.ZodOptional<z.ZodString>;
55
- repository: z.ZodOptional<z.ZodString>;
56
- branch: z.ZodOptional<z.ZodString>;
57
- commitHash: z.ZodOptional<z.ZodString>;
58
- model: z.ZodOptional<z.ZodEnum<{
59
- [x: string]: string;
60
- }>>;
61
- providerTemplate: z.ZodOptional<z.ZodString>;
62
- templateSynced: z.ZodOptional<z.ZodBoolean>;
63
- files: z.ZodOptional<z.ZodArray<z.ZodString>>;
64
- deletedFiles: z.ZodOptional<z.ZodArray<z.ZodString>>;
65
- error: z.ZodOptional<z.ZodString>;
66
- }, z.core.$strip>;
67
- type UpdateAgentModelResponse = z.infer<typeof updateAgentModelResponseSchema>;
68
-
69
- declare const sessionStatusSchema: z.ZodEnum<{
70
- pending: "pending";
71
- running: "running";
72
- completed: "completed";
73
- failed: "failed";
74
- waiting_messages: "waiting_messages";
75
- cancelled: "cancelled";
76
- }>;
77
- type SessionStatus = z.infer<typeof sessionStatusSchema>;
78
- declare const sessionTimelineIdSchema: z.ZodString;
79
- declare const sessionTimelineResponseSchema: z.ZodObject<{
80
- sessionId: z.ZodString;
81
- status: z.ZodString;
82
- metrics: z.ZodRecord<z.ZodString, z.ZodUnknown>;
83
- prompt: z.ZodRecord<z.ZodString, z.ZodUnknown>;
84
- spans: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
85
- }, z.core.$strip>;
86
- type SessionTimelineResponse = z.infer<typeof sessionTimelineResponseSchema>;
87
- declare const sessionStreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
88
- kind: z.ZodLiteral<"status">;
89
- sessionId: z.ZodString;
90
- status: z.ZodEnum<{
91
- pending: "pending";
92
- running: "running";
93
- completed: "completed";
94
- failed: "failed";
95
- waiting_messages: "waiting_messages";
96
- cancelled: "cancelled";
97
- }>;
98
- error: z.ZodOptional<z.ZodString>;
99
- createdAt: z.ZodNumber;
100
- updatedAt: z.ZodNumber;
101
- }, z.core.$strip>, z.ZodObject<{
102
- kind: z.ZodLiteral<"steps">;
103
- sessionId: z.ZodString;
104
- status: z.ZodEnum<{
105
- pending: "pending";
106
- running: "running";
107
- completed: "completed";
108
- failed: "failed";
109
- waiting_messages: "waiting_messages";
110
- cancelled: "cancelled";
111
- }>;
112
- steps: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
113
- nextCursor: z.ZodNullable<z.ZodNumber>;
114
- createdAt: z.ZodNumber;
115
- updatedAt: z.ZodNumber;
116
- }, z.core.$strip>, z.ZodObject<{
117
- kind: z.ZodLiteral<"result">;
118
- sessionId: z.ZodString;
119
- status: z.ZodEnum<{
120
- completed: "completed";
121
- waiting_messages: "waiting_messages";
122
- }>;
123
- result: z.ZodRecord<z.ZodString, z.ZodUnknown>;
124
- nextCursor: z.ZodNullable<z.ZodNumber>;
125
- createdAt: z.ZodNumber;
126
- updatedAt: z.ZodNumber;
127
- }, z.core.$strip>, z.ZodObject<{
128
- kind: z.ZodLiteral<"timeline-finalize">;
129
- sessionId: z.ZodString;
130
- status: z.ZodEnum<{
131
- pending: "pending";
132
- running: "running";
133
- completed: "completed";
134
- failed: "failed";
135
- waiting_messages: "waiting_messages";
136
- cancelled: "cancelled";
137
- }>;
138
- metrics: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
139
- prompt: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
140
- spans: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
141
- events: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
142
- continuation: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
143
- createdAt: z.ZodNumber;
144
- updatedAt: z.ZodNumber;
145
- }, z.core.$strip>, z.ZodObject<{
146
- kind: z.ZodLiteral<"error">;
147
- sessionId: z.ZodString;
148
- error: z.ZodString;
149
- }, z.core.$strip>], "kind">;
150
- type SessionStreamEvent = z.infer<typeof sessionStreamEventSchema>;
151
-
152
19
  interface AgentClientConfig {
153
20
  baseUrl: string;
154
21
  authStrategy: AuthStrategy;
@@ -194,11 +61,22 @@ declare class FetchError extends Error {
194
61
  readonly url: string;
195
62
  readonly method: string;
196
63
  readonly response: Response;
64
+ readonly kind: "http";
197
65
  constructor(message: string, url: string, method: string, response: Response);
198
66
  static from(url: string, method: string, response: Response): Promise<FetchError>;
199
67
  }
68
+ declare class NetworkError extends Error {
69
+ readonly url: string;
70
+ readonly method: string;
71
+ readonly cause: unknown;
72
+ readonly kind: "network";
73
+ constructor(url: string, method: string, cause: unknown);
74
+ }
75
+ type AgentRequestError = FetchError | NetworkError;
76
+ declare function isFetchError(error: unknown): error is FetchError;
77
+ declare function isNetworkError(error: unknown): error is NetworkError;
200
78
 
201
79
  declare function parseSessionStream(stream: ReadableStream<Uint8Array>): AsyncIterable<SessionStreamEvent>;
202
80
 
203
- export { APIKeyAuthStrategy, DataTokenAuthStrategy, FetchError, agentClient, agentInputSchema, executeAgentRequestSchema, executeAgentResponseSchema, parseSessionStream, sessionStatusSchema, sessionStreamEventSchema, sessionTimelineIdSchema, sessionTimelineResponseSchema, updateAgentModelRequestSchema, updateAgentModelResponseSchema };
204
- export type { AgentClient, AgentClientConfig, AgentInput, AuthStrategy, ExecuteAgentRequest, ExecuteAgentResponse, FetchTimelineOptions, ResolveReferenceAs, ResolveReferenceOptions, SessionStatus, SessionStreamEvent, SessionTimelineResponse, StreamSessionOptions, UpdateAgentModelRequest, UpdateAgentModelResponse };
81
+ export { APIKeyAuthStrategy, DataTokenAuthStrategy, ExecuteAgentRequest, ExecuteAgentResponse, FetchError, NetworkError, SessionStreamEvent, SessionTimelineResponse, UpdateAgentModelRequest, UpdateAgentModelResponse, agentClient, isFetchError, isNetworkError, parseSessionStream };
82
+ export type { AgentClient, AgentClientConfig, AgentRequestError, AuthStrategy, FetchTimelineOptions, ResolveReferenceAs, ResolveReferenceOptions, StreamSessionOptions };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,6 @@
1
- import { z } from 'zod';
1
+ import { E as ExecuteAgentRequest, a as ExecuteAgentResponse, U as UpdateAgentModelRequest, b as UpdateAgentModelResponse, S as SessionTimelineResponse, c as SessionStreamEvent } from './shared/agent-sdk.3fcc7aba.mjs';
2
+ export { A as AgentInput, d as SessionStatus, T as TimelineEvent, e as TimelineMetrics, f as TimelinePrompt, g as TimelineRunTurnMetrics, h as TimelineSpan, i as TimelineToolResult } from './shared/agent-sdk.3fcc7aba.mjs';
3
+ import 'zod';
2
4
 
3
5
  interface AuthStrategy {
4
6
  getHeaders: () => Headers;
@@ -14,141 +16,6 @@ declare class APIKeyAuthStrategy implements AuthStrategy {
14
16
  getHeaders(): Headers;
15
17
  }
16
18
 
17
- declare const agentInputSchema: z.ZodObject<{
18
- vaultRef: z.ZodString;
19
- filename: z.ZodString;
20
- metadata: z.ZodOptional<z.ZodString>;
21
- }, z.core.$strict>;
22
- type AgentInput = z.infer<typeof agentInputSchema>;
23
- declare const executeAgentRequestSchema: z.ZodObject<{
24
- sessionId: z.ZodOptional<z.ZodString>;
25
- organizationName: z.ZodOptional<z.ZodString>;
26
- repository: z.ZodOptional<z.ZodString>;
27
- ref: z.ZodOptional<z.ZodString>;
28
- message: z.ZodOptional<z.ZodString>;
29
- inputs: z.ZodOptional<z.ZodArray<z.ZodObject<{
30
- vaultRef: z.ZodString;
31
- filename: z.ZodString;
32
- metadata: z.ZodOptional<z.ZodString>;
33
- }, z.core.$strict>>>;
34
- environmentVariables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
35
- recover: z.ZodOptional<z.ZodBoolean>;
36
- }, z.core.$strict>;
37
- type ExecuteAgentRequest = z.infer<typeof executeAgentRequestSchema>;
38
- declare const executeAgentResponseSchema: z.ZodObject<{
39
- success: z.ZodBoolean;
40
- sessionId: z.ZodOptional<z.ZodString>;
41
- error: z.ZodOptional<z.ZodString>;
42
- }, z.core.$strip>;
43
- type ExecuteAgentResponse = z.infer<typeof executeAgentResponseSchema>;
44
- declare const updateAgentModelRequestSchema: z.ZodObject<{
45
- repository: z.ZodString;
46
- model: z.ZodEnum<{
47
- [x: string]: string;
48
- }>;
49
- commitMessage: z.ZodOptional<z.ZodString>;
50
- }, z.core.$strict>;
51
- type UpdateAgentModelRequest = z.infer<typeof updateAgentModelRequestSchema>;
52
- declare const updateAgentModelResponseSchema: z.ZodObject<{
53
- success: z.ZodBoolean;
54
- organizationName: z.ZodOptional<z.ZodString>;
55
- repository: z.ZodOptional<z.ZodString>;
56
- branch: z.ZodOptional<z.ZodString>;
57
- commitHash: z.ZodOptional<z.ZodString>;
58
- model: z.ZodOptional<z.ZodEnum<{
59
- [x: string]: string;
60
- }>>;
61
- providerTemplate: z.ZodOptional<z.ZodString>;
62
- templateSynced: z.ZodOptional<z.ZodBoolean>;
63
- files: z.ZodOptional<z.ZodArray<z.ZodString>>;
64
- deletedFiles: z.ZodOptional<z.ZodArray<z.ZodString>>;
65
- error: z.ZodOptional<z.ZodString>;
66
- }, z.core.$strip>;
67
- type UpdateAgentModelResponse = z.infer<typeof updateAgentModelResponseSchema>;
68
-
69
- declare const sessionStatusSchema: z.ZodEnum<{
70
- pending: "pending";
71
- running: "running";
72
- completed: "completed";
73
- failed: "failed";
74
- waiting_messages: "waiting_messages";
75
- cancelled: "cancelled";
76
- }>;
77
- type SessionStatus = z.infer<typeof sessionStatusSchema>;
78
- declare const sessionTimelineIdSchema: z.ZodString;
79
- declare const sessionTimelineResponseSchema: z.ZodObject<{
80
- sessionId: z.ZodString;
81
- status: z.ZodString;
82
- metrics: z.ZodRecord<z.ZodString, z.ZodUnknown>;
83
- prompt: z.ZodRecord<z.ZodString, z.ZodUnknown>;
84
- spans: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
85
- }, z.core.$strip>;
86
- type SessionTimelineResponse = z.infer<typeof sessionTimelineResponseSchema>;
87
- declare const sessionStreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
88
- kind: z.ZodLiteral<"status">;
89
- sessionId: z.ZodString;
90
- status: z.ZodEnum<{
91
- pending: "pending";
92
- running: "running";
93
- completed: "completed";
94
- failed: "failed";
95
- waiting_messages: "waiting_messages";
96
- cancelled: "cancelled";
97
- }>;
98
- error: z.ZodOptional<z.ZodString>;
99
- createdAt: z.ZodNumber;
100
- updatedAt: z.ZodNumber;
101
- }, z.core.$strip>, z.ZodObject<{
102
- kind: z.ZodLiteral<"steps">;
103
- sessionId: z.ZodString;
104
- status: z.ZodEnum<{
105
- pending: "pending";
106
- running: "running";
107
- completed: "completed";
108
- failed: "failed";
109
- waiting_messages: "waiting_messages";
110
- cancelled: "cancelled";
111
- }>;
112
- steps: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
113
- nextCursor: z.ZodNullable<z.ZodNumber>;
114
- createdAt: z.ZodNumber;
115
- updatedAt: z.ZodNumber;
116
- }, z.core.$strip>, z.ZodObject<{
117
- kind: z.ZodLiteral<"result">;
118
- sessionId: z.ZodString;
119
- status: z.ZodEnum<{
120
- completed: "completed";
121
- waiting_messages: "waiting_messages";
122
- }>;
123
- result: z.ZodRecord<z.ZodString, z.ZodUnknown>;
124
- nextCursor: z.ZodNullable<z.ZodNumber>;
125
- createdAt: z.ZodNumber;
126
- updatedAt: z.ZodNumber;
127
- }, z.core.$strip>, z.ZodObject<{
128
- kind: z.ZodLiteral<"timeline-finalize">;
129
- sessionId: z.ZodString;
130
- status: z.ZodEnum<{
131
- pending: "pending";
132
- running: "running";
133
- completed: "completed";
134
- failed: "failed";
135
- waiting_messages: "waiting_messages";
136
- cancelled: "cancelled";
137
- }>;
138
- metrics: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
139
- prompt: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
140
- spans: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
141
- events: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
142
- continuation: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
143
- createdAt: z.ZodNumber;
144
- updatedAt: z.ZodNumber;
145
- }, z.core.$strip>, z.ZodObject<{
146
- kind: z.ZodLiteral<"error">;
147
- sessionId: z.ZodString;
148
- error: z.ZodString;
149
- }, z.core.$strip>], "kind">;
150
- type SessionStreamEvent = z.infer<typeof sessionStreamEventSchema>;
151
-
152
19
  interface AgentClientConfig {
153
20
  baseUrl: string;
154
21
  authStrategy: AuthStrategy;
@@ -194,11 +61,22 @@ declare class FetchError extends Error {
194
61
  readonly url: string;
195
62
  readonly method: string;
196
63
  readonly response: Response;
64
+ readonly kind: "http";
197
65
  constructor(message: string, url: string, method: string, response: Response);
198
66
  static from(url: string, method: string, response: Response): Promise<FetchError>;
199
67
  }
68
+ declare class NetworkError extends Error {
69
+ readonly url: string;
70
+ readonly method: string;
71
+ readonly cause: unknown;
72
+ readonly kind: "network";
73
+ constructor(url: string, method: string, cause: unknown);
74
+ }
75
+ type AgentRequestError = FetchError | NetworkError;
76
+ declare function isFetchError(error: unknown): error is FetchError;
77
+ declare function isNetworkError(error: unknown): error is NetworkError;
200
78
 
201
79
  declare function parseSessionStream(stream: ReadableStream<Uint8Array>): AsyncIterable<SessionStreamEvent>;
202
80
 
203
- export { APIKeyAuthStrategy, DataTokenAuthStrategy, FetchError, agentClient, agentInputSchema, executeAgentRequestSchema, executeAgentResponseSchema, parseSessionStream, sessionStatusSchema, sessionStreamEventSchema, sessionTimelineIdSchema, sessionTimelineResponseSchema, updateAgentModelRequestSchema, updateAgentModelResponseSchema };
204
- export type { AgentClient, AgentClientConfig, AgentInput, AuthStrategy, ExecuteAgentRequest, ExecuteAgentResponse, FetchTimelineOptions, ResolveReferenceAs, ResolveReferenceOptions, SessionStatus, SessionStreamEvent, SessionTimelineResponse, StreamSessionOptions, UpdateAgentModelRequest, UpdateAgentModelResponse };
81
+ export { APIKeyAuthStrategy, DataTokenAuthStrategy, ExecuteAgentRequest, ExecuteAgentResponse, FetchError, NetworkError, SessionStreamEvent, SessionTimelineResponse, UpdateAgentModelRequest, UpdateAgentModelResponse, agentClient, isFetchError, isNetworkError, parseSessionStream };
82
+ export type { AgentClient, AgentClientConfig, AgentRequestError, AuthStrategy, FetchTimelineOptions, ResolveReferenceAs, ResolveReferenceOptions, StreamSessionOptions };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
- import { z } from 'zod';
1
+ import { E as ExecuteAgentRequest, a as ExecuteAgentResponse, U as UpdateAgentModelRequest, b as UpdateAgentModelResponse, S as SessionTimelineResponse, c as SessionStreamEvent } from './shared/agent-sdk.3fcc7aba.js';
2
+ export { A as AgentInput, d as SessionStatus, T as TimelineEvent, e as TimelineMetrics, f as TimelinePrompt, g as TimelineRunTurnMetrics, h as TimelineSpan, i as TimelineToolResult } from './shared/agent-sdk.3fcc7aba.js';
3
+ import 'zod';
2
4
 
3
5
  interface AuthStrategy {
4
6
  getHeaders: () => Headers;
@@ -14,141 +16,6 @@ declare class APIKeyAuthStrategy implements AuthStrategy {
14
16
  getHeaders(): Headers;
15
17
  }
16
18
 
17
- declare const agentInputSchema: z.ZodObject<{
18
- vaultRef: z.ZodString;
19
- filename: z.ZodString;
20
- metadata: z.ZodOptional<z.ZodString>;
21
- }, z.core.$strict>;
22
- type AgentInput = z.infer<typeof agentInputSchema>;
23
- declare const executeAgentRequestSchema: z.ZodObject<{
24
- sessionId: z.ZodOptional<z.ZodString>;
25
- organizationName: z.ZodOptional<z.ZodString>;
26
- repository: z.ZodOptional<z.ZodString>;
27
- ref: z.ZodOptional<z.ZodString>;
28
- message: z.ZodOptional<z.ZodString>;
29
- inputs: z.ZodOptional<z.ZodArray<z.ZodObject<{
30
- vaultRef: z.ZodString;
31
- filename: z.ZodString;
32
- metadata: z.ZodOptional<z.ZodString>;
33
- }, z.core.$strict>>>;
34
- environmentVariables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
35
- recover: z.ZodOptional<z.ZodBoolean>;
36
- }, z.core.$strict>;
37
- type ExecuteAgentRequest = z.infer<typeof executeAgentRequestSchema>;
38
- declare const executeAgentResponseSchema: z.ZodObject<{
39
- success: z.ZodBoolean;
40
- sessionId: z.ZodOptional<z.ZodString>;
41
- error: z.ZodOptional<z.ZodString>;
42
- }, z.core.$strip>;
43
- type ExecuteAgentResponse = z.infer<typeof executeAgentResponseSchema>;
44
- declare const updateAgentModelRequestSchema: z.ZodObject<{
45
- repository: z.ZodString;
46
- model: z.ZodEnum<{
47
- [x: string]: string;
48
- }>;
49
- commitMessage: z.ZodOptional<z.ZodString>;
50
- }, z.core.$strict>;
51
- type UpdateAgentModelRequest = z.infer<typeof updateAgentModelRequestSchema>;
52
- declare const updateAgentModelResponseSchema: z.ZodObject<{
53
- success: z.ZodBoolean;
54
- organizationName: z.ZodOptional<z.ZodString>;
55
- repository: z.ZodOptional<z.ZodString>;
56
- branch: z.ZodOptional<z.ZodString>;
57
- commitHash: z.ZodOptional<z.ZodString>;
58
- model: z.ZodOptional<z.ZodEnum<{
59
- [x: string]: string;
60
- }>>;
61
- providerTemplate: z.ZodOptional<z.ZodString>;
62
- templateSynced: z.ZodOptional<z.ZodBoolean>;
63
- files: z.ZodOptional<z.ZodArray<z.ZodString>>;
64
- deletedFiles: z.ZodOptional<z.ZodArray<z.ZodString>>;
65
- error: z.ZodOptional<z.ZodString>;
66
- }, z.core.$strip>;
67
- type UpdateAgentModelResponse = z.infer<typeof updateAgentModelResponseSchema>;
68
-
69
- declare const sessionStatusSchema: z.ZodEnum<{
70
- pending: "pending";
71
- running: "running";
72
- completed: "completed";
73
- failed: "failed";
74
- waiting_messages: "waiting_messages";
75
- cancelled: "cancelled";
76
- }>;
77
- type SessionStatus = z.infer<typeof sessionStatusSchema>;
78
- declare const sessionTimelineIdSchema: z.ZodString;
79
- declare const sessionTimelineResponseSchema: z.ZodObject<{
80
- sessionId: z.ZodString;
81
- status: z.ZodString;
82
- metrics: z.ZodRecord<z.ZodString, z.ZodUnknown>;
83
- prompt: z.ZodRecord<z.ZodString, z.ZodUnknown>;
84
- spans: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
85
- }, z.core.$strip>;
86
- type SessionTimelineResponse = z.infer<typeof sessionTimelineResponseSchema>;
87
- declare const sessionStreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
88
- kind: z.ZodLiteral<"status">;
89
- sessionId: z.ZodString;
90
- status: z.ZodEnum<{
91
- pending: "pending";
92
- running: "running";
93
- completed: "completed";
94
- failed: "failed";
95
- waiting_messages: "waiting_messages";
96
- cancelled: "cancelled";
97
- }>;
98
- error: z.ZodOptional<z.ZodString>;
99
- createdAt: z.ZodNumber;
100
- updatedAt: z.ZodNumber;
101
- }, z.core.$strip>, z.ZodObject<{
102
- kind: z.ZodLiteral<"steps">;
103
- sessionId: z.ZodString;
104
- status: z.ZodEnum<{
105
- pending: "pending";
106
- running: "running";
107
- completed: "completed";
108
- failed: "failed";
109
- waiting_messages: "waiting_messages";
110
- cancelled: "cancelled";
111
- }>;
112
- steps: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
113
- nextCursor: z.ZodNullable<z.ZodNumber>;
114
- createdAt: z.ZodNumber;
115
- updatedAt: z.ZodNumber;
116
- }, z.core.$strip>, z.ZodObject<{
117
- kind: z.ZodLiteral<"result">;
118
- sessionId: z.ZodString;
119
- status: z.ZodEnum<{
120
- completed: "completed";
121
- waiting_messages: "waiting_messages";
122
- }>;
123
- result: z.ZodRecord<z.ZodString, z.ZodUnknown>;
124
- nextCursor: z.ZodNullable<z.ZodNumber>;
125
- createdAt: z.ZodNumber;
126
- updatedAt: z.ZodNumber;
127
- }, z.core.$strip>, z.ZodObject<{
128
- kind: z.ZodLiteral<"timeline-finalize">;
129
- sessionId: z.ZodString;
130
- status: z.ZodEnum<{
131
- pending: "pending";
132
- running: "running";
133
- completed: "completed";
134
- failed: "failed";
135
- waiting_messages: "waiting_messages";
136
- cancelled: "cancelled";
137
- }>;
138
- metrics: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
139
- prompt: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
140
- spans: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
141
- events: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
142
- continuation: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
143
- createdAt: z.ZodNumber;
144
- updatedAt: z.ZodNumber;
145
- }, z.core.$strip>, z.ZodObject<{
146
- kind: z.ZodLiteral<"error">;
147
- sessionId: z.ZodString;
148
- error: z.ZodString;
149
- }, z.core.$strip>], "kind">;
150
- type SessionStreamEvent = z.infer<typeof sessionStreamEventSchema>;
151
-
152
19
  interface AgentClientConfig {
153
20
  baseUrl: string;
154
21
  authStrategy: AuthStrategy;
@@ -194,11 +61,22 @@ declare class FetchError extends Error {
194
61
  readonly url: string;
195
62
  readonly method: string;
196
63
  readonly response: Response;
64
+ readonly kind: "http";
197
65
  constructor(message: string, url: string, method: string, response: Response);
198
66
  static from(url: string, method: string, response: Response): Promise<FetchError>;
199
67
  }
68
+ declare class NetworkError extends Error {
69
+ readonly url: string;
70
+ readonly method: string;
71
+ readonly cause: unknown;
72
+ readonly kind: "network";
73
+ constructor(url: string, method: string, cause: unknown);
74
+ }
75
+ type AgentRequestError = FetchError | NetworkError;
76
+ declare function isFetchError(error: unknown): error is FetchError;
77
+ declare function isNetworkError(error: unknown): error is NetworkError;
200
78
 
201
79
  declare function parseSessionStream(stream: ReadableStream<Uint8Array>): AsyncIterable<SessionStreamEvent>;
202
80
 
203
- export { APIKeyAuthStrategy, DataTokenAuthStrategy, FetchError, agentClient, agentInputSchema, executeAgentRequestSchema, executeAgentResponseSchema, parseSessionStream, sessionStatusSchema, sessionStreamEventSchema, sessionTimelineIdSchema, sessionTimelineResponseSchema, updateAgentModelRequestSchema, updateAgentModelResponseSchema };
204
- export type { AgentClient, AgentClientConfig, AgentInput, AuthStrategy, ExecuteAgentRequest, ExecuteAgentResponse, FetchTimelineOptions, ResolveReferenceAs, ResolveReferenceOptions, SessionStatus, SessionStreamEvent, SessionTimelineResponse, StreamSessionOptions, UpdateAgentModelRequest, UpdateAgentModelResponse };
81
+ export { APIKeyAuthStrategy, DataTokenAuthStrategy, ExecuteAgentRequest, ExecuteAgentResponse, FetchError, NetworkError, SessionStreamEvent, SessionTimelineResponse, UpdateAgentModelRequest, UpdateAgentModelResponse, agentClient, isFetchError, isNetworkError, parseSessionStream };
82
+ export type { AgentClient, AgentClientConfig, AgentRequestError, AuthStrategy, FetchTimelineOptions, ResolveReferenceAs, ResolveReferenceOptions, StreamSessionOptions };