@meistrari/agent-sdk 0.5.0 → 0.6.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/README.md CHANGED
@@ -91,7 +91,7 @@ Multi-turn lifecycle rules:
91
91
  - Continue only after the stream reaches a `result` event with `status: 'waiting_messages'`.
92
92
  - Continuations while the session is `pending` or `running` fail with `409`.
93
93
  - Treat `completed`, `failed`, and `cancelled` as non-normal follow-up states in SDK consumers.
94
- - The SDK v4 path does not use the legacy `/v3/sessions/{sessionId}/continue` endpoint.
94
+ - Continue by calling `executeAgent()` again with `sessionId`; consume the updated run through `streamSession()`.
95
95
 
96
96
  ### Cancel a running session
97
97
 
@@ -132,16 +132,19 @@ const { success, sessionId } = await client.executeAgent({
132
132
 
133
133
  Webhook semantics (full contract in [`docs/webhooks.md`](../../docs/webhooks.md)):
134
134
 
135
- - Available on the v4 execute path only; up to **5 webhooks** per session.
135
+ - Available on the v4 execute path only; up to **5 webhooks** per run.
136
136
  - URLs must be HTTPS; localhost, `.local`/`.internal`, and private/loopback IP hosts are rejected.
137
137
  - `events` defaults to **all `session.*` events** (`started`, `completed`, `failed`,
138
138
  `cancelled`, `waiting_messages`); `subagent.started`/`subagent.completed` must be opted into.
139
- - Passing `webhooks` on a continuation **replaces** the registered set; omitting it keeps
140
- the existing registration.
139
+ - Webhooks are runtime-only and per-run. A continuation must pass `webhooks` again to
140
+ receive callbacks; omitting it or passing `webhooks: []` means no callbacks for that
141
+ continuation run.
141
142
  - Deliveries are **at-least-once** with retries — make handlers idempotent.
142
- - The payload (`SessionWebhookEventPayload`) is lightweight metadata: `eventType`,
143
- `sessionId`, `runId`, `status`, `error`, `usage`, `subagent`, `deliveryId`. Fetch content
144
- with `streamSession` or `fetchTimeline`.
143
+ - The payload (`SessionWebhookEventPayload`) includes `eventType`, `sessionId`, `runId`,
144
+ `status`, `error`, `usage`, `subagent`, `deliveryId`, and `result` on
145
+ `session.completed`. `result` is the postprocessed output: structured JSON when present,
146
+ otherwise text, otherwise `null`. Fetch the full stream with `streamSession` and timeline
147
+ summary with `fetchTimeline`.
145
148
 
146
149
  When a `secret` is configured, verify the `x-tela-agent-webhook-signature` header with the bundled
147
150
  helper (Web Crypto, works in Node/Bun/edge runtimes):
@@ -167,8 +170,7 @@ app.post('/hooks/agent-session', async (req) => {
167
170
 
168
171
  For [Trigger.dev wait-for-token](../../docs/trigger-dev-wait-token.md) flows, pass the
169
172
  token's callback URL as a webhook filtered to terminal events — no `secret` needed (auth
170
- is embedded in the token URL), and the waiting task resumes with the payload as the token
171
- output.
173
+ is embedded in the token URL), and pass a fresh token URL on each continuation turn.
172
174
 
173
175
  ### Update an agent model
174
176
 
@@ -202,24 +204,11 @@ console.log(timeline.status, timeline.metrics, timeline.spans)
202
204
  `prompt`, and `spans`. It does not return per-event detail. Consumers that need timeline
203
205
  events should consume `streamSession` and merge stream-derived timeline events locally.
204
206
 
205
- ### Fetch captured session files
207
+ ### Fetch artifacts
206
208
 
207
- ```ts
208
- const files = await client.listSessionFiles(sessionId, { signal })
209
-
210
- for (const file of files.tree) {
211
- console.log(file.path, file.size)
212
- }
213
-
214
- const report = await client.fetchSessionFile(sessionId, 'output/report.md', { signal })
215
-
216
- if (report.encoding === 'raw')
217
- console.log(report.content)
218
- ```
219
-
220
- `listSessionFiles` returns the file tree captured from the source sandbox after execution.
221
- `fetchSessionFile` returns a single captured file. Text-like files are returned as
222
- `encoding: 'raw'`; binary files are returned as base64.
209
+ Artifact payloads are exposed as `vault://` references in `streamSession()` events.
210
+ Read the session stream, pick the reference you need from a step or result event, then
211
+ call `resolveReference()` to download the bytes, stream, or JSON payload.
223
212
 
224
213
  ### Resolve Vault references
225
214
 
@@ -245,6 +234,6 @@ This package mirrors `@meistrari/vault-sdk` and is published as `UNLICENSED`.
245
234
 
246
235
  Focused on sandbox execution and the public v4 consumer paths: `executeAgent` (including
247
236
  session webhook registration), `streamSession`, `cancelSession`, `updateAgentModel`,
248
- `fetchTimeline`, `listSessionFiles`, `fetchSessionFile`, `resolveReference`, and webhook
249
- signature verification via `verifyWebhookSignature`. Agent CRUD, legacy polling, and the
250
- internal sandbox timeline callback are intentionally out of scope.
237
+ `fetchTimeline`, `resolveReference`, and webhook signature verification via
238
+ `verifyWebhookSignature`. Agent CRUD, legacy polling, and the internal sandbox timeline
239
+ callback are intentionally out of scope.
package/dist/index.cjs CHANGED
@@ -231,25 +231,14 @@ function agentClient(config) {
231
231
  });
232
232
  return schemas.sessionTimelineResponseSchema.parse(await response.json());
233
233
  }
234
- async function listSessionFiles(sessionId, options) {
234
+ async function fetchThread(sessionId, options) {
235
235
  const parsedSessionId = schemas.sessionTimelineIdSchema.parse(sessionId);
236
236
  const response = await request({
237
237
  method: "GET",
238
- path: `/v3/sessions/${encodeURIComponent(parsedSessionId)}/files`,
238
+ path: `/v4/sessions/${encodeURIComponent(parsedSessionId)}/thread`,
239
239
  signal: options?.signal
240
240
  });
241
- return schemas.sessionFilesTreeResponseSchema.parse(await response.json());
242
- }
243
- async function fetchSessionFile(sessionId, filePath, options) {
244
- const parsedSessionId = schemas.sessionTimelineIdSchema.parse(sessionId);
245
- if (!filePath)
246
- throw new Error("filePath is required");
247
- const response = await request({
248
- method: "GET",
249
- path: `/v3/sessions/${encodeURIComponent(parsedSessionId)}/files/${encodeURIComponent(filePath)}`,
250
- signal: options?.signal
251
- });
252
- return schemas.sessionFileContentResponseSchema.parse(await response.json());
241
+ return schemas.sessionThreadResponseSchema.parse(await response.json());
253
242
  }
254
243
  async function cancelSession(sessionId) {
255
244
  const parsedSessionId = schemas.sessionTimelineIdSchema.parse(sessionId);
@@ -299,8 +288,7 @@ function agentClient(config) {
299
288
  executeAgent,
300
289
  updateAgentModel,
301
290
  fetchTimeline,
302
- listSessionFiles,
303
- fetchSessionFile,
291
+ fetchThread,
304
292
  cancelSession,
305
293
  streamSession,
306
294
  resolveReference
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { E as ExecuteAgentRequest, a as ExecuteAgentResponse, U as UpdateAgentModelRequest, b as UpdateAgentModelResponse, S as SessionTimelineResponse, c as SessionFilesTreeResponse, d as SessionFileContentResponse, C as CancelSessionResponse, e as SessionStreamEvent } from './shared/agent-sdk.ed11095c.cjs';
2
- export { A as AgentInput, f as SessionStatus, g as SessionWebhookConfig, h as SessionWebhookEventPayload, i as SessionWebhookEventType, j as SessionWebhookSubagent, k as SessionWebhookUsage, T as TimelineEvent, l as TimelineMetrics, m as TimelinePrompt, n as TimelineRunTurnMetrics, o as TimelineSpan, p as TimelineToolResult } from './shared/agent-sdk.ed11095c.cjs';
1
+ import { E as ExecuteAgentRequest, a as ExecuteAgentResponse, U as UpdateAgentModelRequest, b as UpdateAgentModelResponse, S as SessionTimelineResponse, c as SessionThreadResponse, C as CancelSessionResponse, d as SessionStreamEvent } from './shared/agent-sdk.d26e6678.cjs';
2
+ export { A as AgentInput, e as SessionStatus, f as SessionWebhookConfig, g as SessionWebhookEventPayload, h as SessionWebhookEventType, i as SessionWebhookSubagent, j as SessionWebhookUsage, T as TimelineEvent, k as TimelineMetrics, l as TimelinePrompt, m as TimelineRunTurnMetrics, n as TimelineSpan, o as TimelineToolResult } from './shared/agent-sdk.d26e6678.cjs';
3
3
  import 'zod';
4
4
 
5
5
  interface AuthStrategy {
@@ -38,12 +38,7 @@ declare function agentClient(config: AgentClientConfig): {
38
38
  executeAgent: (input: ExecuteAgentRequest) => Promise<ExecuteAgentResponse>;
39
39
  updateAgentModel: (input: UpdateAgentModelRequest) => Promise<UpdateAgentModelResponse>;
40
40
  fetchTimeline: (sessionId: string, options?: FetchTimelineOptions) => Promise<SessionTimelineResponse>;
41
- listSessionFiles: (sessionId: string, options?: {
42
- signal?: AbortSignal;
43
- }) => Promise<SessionFilesTreeResponse>;
44
- fetchSessionFile: (sessionId: string, filePath: string, options?: {
45
- signal?: AbortSignal;
46
- }) => Promise<SessionFileContentResponse>;
41
+ fetchThread: (sessionId: string, options?: FetchTimelineOptions) => Promise<SessionThreadResponse>;
47
42
  cancelSession: (sessionId: string) => Promise<CancelSessionResponse>;
48
43
  streamSession: (sessionId: string, options?: StreamSessionOptions) => Promise<AsyncIterable<SessionStreamEvent>>;
49
44
  resolveReference: {
@@ -87,5 +82,5 @@ declare function parseSessionStream(stream: ReadableStream<Uint8Array>): AsyncIt
87
82
 
88
83
  declare function verifyWebhookSignature(rawBody: string | Uint8Array, signatureHeader: string | null | undefined, secret: string): Promise<boolean>;
89
84
 
90
- export { APIKeyAuthStrategy, CancelSessionResponse, DataTokenAuthStrategy, ExecuteAgentRequest, ExecuteAgentResponse, FetchError, NetworkError, SessionFileContentResponse, SessionFilesTreeResponse, SessionStreamEvent, SessionTimelineResponse, UpdateAgentModelRequest, UpdateAgentModelResponse, agentClient, isFetchError, isNetworkError, parseSessionStream, verifyWebhookSignature };
85
+ export { APIKeyAuthStrategy, CancelSessionResponse, DataTokenAuthStrategy, ExecuteAgentRequest, ExecuteAgentResponse, FetchError, NetworkError, SessionStreamEvent, SessionTimelineResponse, UpdateAgentModelRequest, UpdateAgentModelResponse, agentClient, isFetchError, isNetworkError, parseSessionStream, verifyWebhookSignature };
91
86
  export type { AgentClient, AgentClientConfig, AgentRequestError, AuthStrategy, FetchTimelineOptions, ResolveReferenceAs, ResolveReferenceOptions, StreamSessionOptions };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { E as ExecuteAgentRequest, a as ExecuteAgentResponse, U as UpdateAgentModelRequest, b as UpdateAgentModelResponse, S as SessionTimelineResponse, c as SessionFilesTreeResponse, d as SessionFileContentResponse, C as CancelSessionResponse, e as SessionStreamEvent } from './shared/agent-sdk.ed11095c.mjs';
2
- export { A as AgentInput, f as SessionStatus, g as SessionWebhookConfig, h as SessionWebhookEventPayload, i as SessionWebhookEventType, j as SessionWebhookSubagent, k as SessionWebhookUsage, T as TimelineEvent, l as TimelineMetrics, m as TimelinePrompt, n as TimelineRunTurnMetrics, o as TimelineSpan, p as TimelineToolResult } from './shared/agent-sdk.ed11095c.mjs';
1
+ import { E as ExecuteAgentRequest, a as ExecuteAgentResponse, U as UpdateAgentModelRequest, b as UpdateAgentModelResponse, S as SessionTimelineResponse, c as SessionThreadResponse, C as CancelSessionResponse, d as SessionStreamEvent } from './shared/agent-sdk.d26e6678.mjs';
2
+ export { A as AgentInput, e as SessionStatus, f as SessionWebhookConfig, g as SessionWebhookEventPayload, h as SessionWebhookEventType, i as SessionWebhookSubagent, j as SessionWebhookUsage, T as TimelineEvent, k as TimelineMetrics, l as TimelinePrompt, m as TimelineRunTurnMetrics, n as TimelineSpan, o as TimelineToolResult } from './shared/agent-sdk.d26e6678.mjs';
3
3
  import 'zod';
4
4
 
5
5
  interface AuthStrategy {
@@ -38,12 +38,7 @@ declare function agentClient(config: AgentClientConfig): {
38
38
  executeAgent: (input: ExecuteAgentRequest) => Promise<ExecuteAgentResponse>;
39
39
  updateAgentModel: (input: UpdateAgentModelRequest) => Promise<UpdateAgentModelResponse>;
40
40
  fetchTimeline: (sessionId: string, options?: FetchTimelineOptions) => Promise<SessionTimelineResponse>;
41
- listSessionFiles: (sessionId: string, options?: {
42
- signal?: AbortSignal;
43
- }) => Promise<SessionFilesTreeResponse>;
44
- fetchSessionFile: (sessionId: string, filePath: string, options?: {
45
- signal?: AbortSignal;
46
- }) => Promise<SessionFileContentResponse>;
41
+ fetchThread: (sessionId: string, options?: FetchTimelineOptions) => Promise<SessionThreadResponse>;
47
42
  cancelSession: (sessionId: string) => Promise<CancelSessionResponse>;
48
43
  streamSession: (sessionId: string, options?: StreamSessionOptions) => Promise<AsyncIterable<SessionStreamEvent>>;
49
44
  resolveReference: {
@@ -87,5 +82,5 @@ declare function parseSessionStream(stream: ReadableStream<Uint8Array>): AsyncIt
87
82
 
88
83
  declare function verifyWebhookSignature(rawBody: string | Uint8Array, signatureHeader: string | null | undefined, secret: string): Promise<boolean>;
89
84
 
90
- export { APIKeyAuthStrategy, CancelSessionResponse, DataTokenAuthStrategy, ExecuteAgentRequest, ExecuteAgentResponse, FetchError, NetworkError, SessionFileContentResponse, SessionFilesTreeResponse, SessionStreamEvent, SessionTimelineResponse, UpdateAgentModelRequest, UpdateAgentModelResponse, agentClient, isFetchError, isNetworkError, parseSessionStream, verifyWebhookSignature };
85
+ export { APIKeyAuthStrategy, CancelSessionResponse, DataTokenAuthStrategy, ExecuteAgentRequest, ExecuteAgentResponse, FetchError, NetworkError, SessionStreamEvent, SessionTimelineResponse, UpdateAgentModelRequest, UpdateAgentModelResponse, agentClient, isFetchError, isNetworkError, parseSessionStream, verifyWebhookSignature };
91
86
  export type { AgentClient, AgentClientConfig, AgentRequestError, AuthStrategy, FetchTimelineOptions, ResolveReferenceAs, ResolveReferenceOptions, StreamSessionOptions };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { E as ExecuteAgentRequest, a as ExecuteAgentResponse, U as UpdateAgentModelRequest, b as UpdateAgentModelResponse, S as SessionTimelineResponse, c as SessionFilesTreeResponse, d as SessionFileContentResponse, C as CancelSessionResponse, e as SessionStreamEvent } from './shared/agent-sdk.ed11095c.js';
2
- export { A as AgentInput, f as SessionStatus, g as SessionWebhookConfig, h as SessionWebhookEventPayload, i as SessionWebhookEventType, j as SessionWebhookSubagent, k as SessionWebhookUsage, T as TimelineEvent, l as TimelineMetrics, m as TimelinePrompt, n as TimelineRunTurnMetrics, o as TimelineSpan, p as TimelineToolResult } from './shared/agent-sdk.ed11095c.js';
1
+ import { E as ExecuteAgentRequest, a as ExecuteAgentResponse, U as UpdateAgentModelRequest, b as UpdateAgentModelResponse, S as SessionTimelineResponse, c as SessionThreadResponse, C as CancelSessionResponse, d as SessionStreamEvent } from './shared/agent-sdk.d26e6678.js';
2
+ export { A as AgentInput, e as SessionStatus, f as SessionWebhookConfig, g as SessionWebhookEventPayload, h as SessionWebhookEventType, i as SessionWebhookSubagent, j as SessionWebhookUsage, T as TimelineEvent, k as TimelineMetrics, l as TimelinePrompt, m as TimelineRunTurnMetrics, n as TimelineSpan, o as TimelineToolResult } from './shared/agent-sdk.d26e6678.js';
3
3
  import 'zod';
4
4
 
5
5
  interface AuthStrategy {
@@ -38,12 +38,7 @@ declare function agentClient(config: AgentClientConfig): {
38
38
  executeAgent: (input: ExecuteAgentRequest) => Promise<ExecuteAgentResponse>;
39
39
  updateAgentModel: (input: UpdateAgentModelRequest) => Promise<UpdateAgentModelResponse>;
40
40
  fetchTimeline: (sessionId: string, options?: FetchTimelineOptions) => Promise<SessionTimelineResponse>;
41
- listSessionFiles: (sessionId: string, options?: {
42
- signal?: AbortSignal;
43
- }) => Promise<SessionFilesTreeResponse>;
44
- fetchSessionFile: (sessionId: string, filePath: string, options?: {
45
- signal?: AbortSignal;
46
- }) => Promise<SessionFileContentResponse>;
41
+ fetchThread: (sessionId: string, options?: FetchTimelineOptions) => Promise<SessionThreadResponse>;
47
42
  cancelSession: (sessionId: string) => Promise<CancelSessionResponse>;
48
43
  streamSession: (sessionId: string, options?: StreamSessionOptions) => Promise<AsyncIterable<SessionStreamEvent>>;
49
44
  resolveReference: {
@@ -87,5 +82,5 @@ declare function parseSessionStream(stream: ReadableStream<Uint8Array>): AsyncIt
87
82
 
88
83
  declare function verifyWebhookSignature(rawBody: string | Uint8Array, signatureHeader: string | null | undefined, secret: string): Promise<boolean>;
89
84
 
90
- export { APIKeyAuthStrategy, CancelSessionResponse, DataTokenAuthStrategy, ExecuteAgentRequest, ExecuteAgentResponse, FetchError, NetworkError, SessionFileContentResponse, SessionFilesTreeResponse, SessionStreamEvent, SessionTimelineResponse, UpdateAgentModelRequest, UpdateAgentModelResponse, agentClient, isFetchError, isNetworkError, parseSessionStream, verifyWebhookSignature };
85
+ export { APIKeyAuthStrategy, CancelSessionResponse, DataTokenAuthStrategy, ExecuteAgentRequest, ExecuteAgentResponse, FetchError, NetworkError, SessionStreamEvent, SessionTimelineResponse, UpdateAgentModelRequest, UpdateAgentModelResponse, agentClient, isFetchError, isNetworkError, parseSessionStream, verifyWebhookSignature };
91
86
  export type { AgentClient, AgentClientConfig, AgentRequestError, AuthStrategy, FetchTimelineOptions, ResolveReferenceAs, ResolveReferenceOptions, StreamSessionOptions };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VaultFile } from '@meistrari/vault-sdk';
2
- import { SESSION_STREAM_EVENT_KINDS, sessionStreamEventSchema, executeAgentRequestSchema, executeAgentResponseSchema, updateAgentModelRequestSchema, updateAgentModelResponseSchema, sessionTimelineIdSchema, sessionTimelineResponseSchema, sessionFilesTreeResponseSchema, sessionFileContentResponseSchema, cancelSessionResponseSchema } from './schemas.mjs';
2
+ import { SESSION_STREAM_EVENT_KINDS, sessionStreamEventSchema, executeAgentRequestSchema, executeAgentResponseSchema, updateAgentModelRequestSchema, updateAgentModelResponseSchema, sessionTimelineIdSchema, sessionTimelineResponseSchema, sessionThreadResponseSchema, cancelSessionResponseSchema } from './schemas.mjs';
3
3
  import 'zod';
4
4
 
5
5
  var __defProp$1 = Object.defineProperty;
@@ -229,25 +229,14 @@ function agentClient(config) {
229
229
  });
230
230
  return sessionTimelineResponseSchema.parse(await response.json());
231
231
  }
232
- async function listSessionFiles(sessionId, options) {
232
+ async function fetchThread(sessionId, options) {
233
233
  const parsedSessionId = sessionTimelineIdSchema.parse(sessionId);
234
234
  const response = await request({
235
235
  method: "GET",
236
- path: `/v3/sessions/${encodeURIComponent(parsedSessionId)}/files`,
236
+ path: `/v4/sessions/${encodeURIComponent(parsedSessionId)}/thread`,
237
237
  signal: options?.signal
238
238
  });
239
- return sessionFilesTreeResponseSchema.parse(await response.json());
240
- }
241
- async function fetchSessionFile(sessionId, filePath, options) {
242
- const parsedSessionId = sessionTimelineIdSchema.parse(sessionId);
243
- if (!filePath)
244
- throw new Error("filePath is required");
245
- const response = await request({
246
- method: "GET",
247
- path: `/v3/sessions/${encodeURIComponent(parsedSessionId)}/files/${encodeURIComponent(filePath)}`,
248
- signal: options?.signal
249
- });
250
- return sessionFileContentResponseSchema.parse(await response.json());
239
+ return sessionThreadResponseSchema.parse(await response.json());
251
240
  }
252
241
  async function cancelSession(sessionId) {
253
242
  const parsedSessionId = sessionTimelineIdSchema.parse(sessionId);
@@ -297,8 +286,7 @@ function agentClient(config) {
297
286
  executeAgent,
298
287
  updateAgentModel,
299
288
  fetchTimeline,
300
- listSessionFiles,
301
- fetchSessionFile,
289
+ fetchThread,
302
290
  cancelSession,
303
291
  streamSession,
304
292
  resolveReference
package/dist/schemas.cjs CHANGED
@@ -429,6 +429,7 @@ const openrouterCatalog = /*@__PURE__*/getDefaultExportFromCjs(openrouterModels)
429
429
  const nativeAnthropicModelIds = [
430
430
  "claude-sonnet-4-5",
431
431
  "claude-sonnet-4-6",
432
+ "claude-sonnet-5",
432
433
  "claude-haiku-4-5",
433
434
  "claude-fable-5",
434
435
  "claude-opus-4-6",
@@ -526,6 +527,11 @@ const sessionWebhookUsageSchema = zod.z.object({
526
527
  durationMs: zod.z.number().int().nonnegative().optional(),
527
528
  numTurns: zod.z.number().int().nonnegative().optional()
528
529
  }).strict();
530
+ const sessionWebhookResultSchema = zod.z.union([
531
+ zod.z.string(),
532
+ zod.z.record(zod.z.string(), zod.z.unknown()),
533
+ zod.z.null()
534
+ ]);
529
535
  const sessionWebhookSubagentSchema = zod.z.object({
530
536
  callId: zod.z.string().min(1).max(256),
531
537
  subagentType: zod.z.string().max(256).optional(),
@@ -539,7 +545,10 @@ const sessionWebhookEventPayloadSchema = zod.z.object({
539
545
  runId: zod.z.string().optional(),
540
546
  status: zod.z.string(),
541
547
  error: zod.z.string().optional(),
548
+ interrupted: zod.z.boolean().optional(),
549
+ failReason: zod.z.string().optional(),
542
550
  usage: sessionWebhookUsageSchema.optional(),
551
+ result: sessionWebhookResultSchema.optional(),
543
552
  subagent: sessionWebhookSubagentSchema.optional(),
544
553
  timestamp: zod.z.string(),
545
554
  apiVersion: zod.z.literal("v4"),
@@ -604,8 +613,8 @@ const executeAgentResponseSchema = zod.z.discriminatedUnion("success", [
604
613
  const repositoryNameSchema = zod.z.string().min(1, "Repository is required").max(200, "Repository must be 200 characters or less").regex(/^[\w.-]+$/, "Repository contains unsupported characters");
605
614
  const updateAgentModelRequestSchema = zod.z.object({
606
615
  repository: repositoryNameSchema,
607
- model: modelSchema,
608
- commitMessage: zod.z.string().max(4096, "Commit message must be 4096 characters or less").optional()
616
+ model: modelSchema.describe("Supported agent model id. The model prefix selects the provider template."),
617
+ commitMessage: zod.z.string().max(4096, "Commit message must be 4096 characters or less").optional().describe("Optional commit message for the model/template update")
609
618
  }).strict();
610
619
  const updateAgentModelSuccessResponseSchema = zod.z.object({
611
620
  success: zod.z.literal(true).describe("Whether the model update succeeded"),
@@ -700,6 +709,34 @@ const sessionTimelineResponseSchema = zod.z.object({
700
709
  prompt: timelinePromptSchema,
701
710
  spans: zod.z.array(timelineSpanSchema)
702
711
  });
712
+ const sessionThreadUserMessageSchema = zod.z.object({
713
+ text: zod.z.string().nullable(),
714
+ attachments: zod.z.unknown().nullable().optional()
715
+ });
716
+ const sessionThreadAssistantMessageSchema = zod.z.object({
717
+ status: zod.z.string().nullable(),
718
+ text: zod.z.string().nullable(),
719
+ structuredContent: zod.z.unknown().nullable().optional(),
720
+ events: zod.z.array(timelineEventSchema).nullable().optional(),
721
+ attachments: zod.z.unknown().nullable().optional(),
722
+ usage: zod.z.unknown().nullable().optional()
723
+ });
724
+ const sessionThreadTurnSchema = zod.z.object({
725
+ runId: zod.z.string(),
726
+ index: zod.z.number().int().nonnegative(),
727
+ isContinuation: zod.z.boolean(),
728
+ status: zod.z.string().nullable(),
729
+ createdAt: zod.z.number().nullable(),
730
+ finishedAt: zod.z.number().nullable(),
731
+ user: sessionThreadUserMessageSchema.nullable(),
732
+ assistant: sessionThreadAssistantMessageSchema.nullable()
733
+ });
734
+ const sessionThreadResponseSchema = zod.z.object({
735
+ sessionId: zod.z.string(),
736
+ status: zod.z.string(),
737
+ turnCount: zod.z.number().int().nonnegative(),
738
+ turns: zod.z.array(sessionThreadTurnSchema)
739
+ });
703
740
  const sessionFilesTreeResponseSchema = zod.z.object({
704
741
  sessionId: zod.z.string(),
705
742
  tree: zod.z.array(zod.z.object({
@@ -791,11 +828,16 @@ exports.sessionFileContentResponseSchema = sessionFileContentResponseSchema;
791
828
  exports.sessionFilesTreeResponseSchema = sessionFilesTreeResponseSchema;
792
829
  exports.sessionStatusSchema = sessionStatusSchema;
793
830
  exports.sessionStreamEventSchema = sessionStreamEventSchema;
831
+ exports.sessionThreadAssistantMessageSchema = sessionThreadAssistantMessageSchema;
832
+ exports.sessionThreadResponseSchema = sessionThreadResponseSchema;
833
+ exports.sessionThreadTurnSchema = sessionThreadTurnSchema;
834
+ exports.sessionThreadUserMessageSchema = sessionThreadUserMessageSchema;
794
835
  exports.sessionTimelineIdSchema = sessionTimelineIdSchema;
795
836
  exports.sessionTimelineResponseSchema = sessionTimelineResponseSchema;
796
837
  exports.sessionWebhookConfigSchema = sessionWebhookConfigSchema;
797
838
  exports.sessionWebhookEventPayloadSchema = sessionWebhookEventPayloadSchema;
798
839
  exports.sessionWebhookEventTypeSchema = sessionWebhookEventTypeSchema;
840
+ exports.sessionWebhookResultSchema = sessionWebhookResultSchema;
799
841
  exports.sessionWebhookSubagentSchema = sessionWebhookSubagentSchema;
800
842
  exports.sessionWebhookUsageSchema = sessionWebhookUsageSchema;
801
843
  exports.sessionWebhooksSchema = sessionWebhooksSchema;
@@ -1,12 +1,13 @@
1
- export { A as AgentInput, C as CancelSessionResponse, E as ExecuteAgentRequest, a as ExecuteAgentResponse, O as SESSION_STREAM_EVENT_KINDS, R as SESSION_WEBHOOK_DEFAULT_EVENTS, a1 as SessionAgentEvent, d as SessionFileContentResponse, c as SessionFilesTreeResponse, f as SessionStatus, e as SessionStreamEvent, S as SessionTimelineResponse, g as SessionWebhookConfig, h as SessionWebhookEventPayload, i as SessionWebhookEventType, j as SessionWebhookSubagent, k as SessionWebhookUsage, T as TimelineEvent, l as TimelineMetrics, m as TimelinePrompt, n as TimelineRunTurnMetrics, o as TimelineSpan, p as TimelineToolResult, U as UpdateAgentModelRequest, b as UpdateAgentModelResponse, q as agentInputSchema, P as cancelSessionResponseSchema, t as executeAgentErrorResponseSchema, r as executeAgentRequestSchema, u as executeAgentResponseSchema, s as executeAgentSuccessResponseSchema, V as isBlockedWebhookHostname, a0 as sessionAgentEventSchema, a2 as sessionAgentEventsSchema, M as sessionFileContentResponseSchema, L as sessionFilesTreeResponseSchema, z as sessionStatusSchema, N as sessionStreamEventSchema, B as sessionTimelineIdSchema, K as sessionTimelineResponseSchema, X as sessionWebhookConfigSchema, $ as sessionWebhookEventPayloadSchema, Q as sessionWebhookEventTypeSchema, _ as sessionWebhookSubagentSchema, Z as sessionWebhookUsageSchema, Y as sessionWebhooksSchema, I as timelineEventSchema, D as timelineMetricsSchema, F as timelinePromptSchema, H as timelineRunTurnMetricsSchema, J as timelineSpanSchema, G as timelineToolResultSchema, x as updateAgentModelErrorResponseSchema, v as updateAgentModelRequestSchema, y as updateAgentModelResponseSchema, w as updateAgentModelSuccessResponseSchema, W as validateWebhookUrl } from './shared/agent-sdk.ed11095c.cjs';
1
+ export { A as AgentInput, C as CancelSessionResponse, E as ExecuteAgentRequest, a as ExecuteAgentResponse, X as SESSION_STREAM_EVENT_KINDS, _ as SESSION_WEBHOOK_DEFAULT_EVENTS, a9 as SessionAgentEvent, V as SessionFileContentResponse, Q as SessionFilesTreeResponse, e as SessionStatus, d as SessionStreamEvent, c as SessionThreadResponse, N as SessionThreadTurn, S as SessionTimelineResponse, f as SessionWebhookConfig, g as SessionWebhookEventPayload, h as SessionWebhookEventType, a5 as SessionWebhookResult, i as SessionWebhookSubagent, j as SessionWebhookUsage, T as TimelineEvent, k as TimelineMetrics, l as TimelinePrompt, m as TimelineRunTurnMetrics, n as TimelineSpan, o as TimelineToolResult, U as UpdateAgentModelRequest, b as UpdateAgentModelResponse, p as agentInputSchema, Y as cancelSessionResponseSchema, s as executeAgentErrorResponseSchema, q as executeAgentRequestSchema, t as executeAgentResponseSchema, r as executeAgentSuccessResponseSchema, $ as isBlockedWebhookHostname, a8 as sessionAgentEventSchema, aa as sessionAgentEventsSchema, R as sessionFileContentResponseSchema, P as sessionFilesTreeResponseSchema, y as sessionStatusSchema, W as sessionStreamEventSchema, L as sessionThreadAssistantMessageSchema, O as sessionThreadResponseSchema, M as sessionThreadTurnSchema, K as sessionThreadUserMessageSchema, z as sessionTimelineIdSchema, J as sessionTimelineResponseSchema, a1 as sessionWebhookConfigSchema, a7 as sessionWebhookEventPayloadSchema, Z as sessionWebhookEventTypeSchema, a4 as sessionWebhookResultSchema, a6 as sessionWebhookSubagentSchema, a3 as sessionWebhookUsageSchema, a2 as sessionWebhooksSchema, H as timelineEventSchema, B as timelineMetricsSchema, D as timelinePromptSchema, G as timelineRunTurnMetricsSchema, I as timelineSpanSchema, F as timelineToolResultSchema, w as updateAgentModelErrorResponseSchema, u as updateAgentModelRequestSchema, x as updateAgentModelResponseSchema, v as updateAgentModelSuccessResponseSchema, a0 as validateWebhookUrl } from './shared/agent-sdk.d26e6678.cjs';
2
2
  import { z } from 'zod';
3
3
 
4
- declare const nativeAnthropicModelIds: readonly ["claude-sonnet-4-5", "claude-sonnet-4-6", "claude-haiku-4-5", "claude-fable-5", "claude-opus-4-6", "claude-opus-4-7", "claude-opus-4-8"];
4
+ declare const nativeAnthropicModelIds: readonly ["claude-sonnet-4-5", "claude-sonnet-4-6", "claude-sonnet-5", "claude-haiku-4-5", "claude-fable-5", "claude-opus-4-6", "claude-opus-4-7", "claude-opus-4-8"];
5
5
  type NativeAnthropicModelId = typeof nativeAnthropicModelIds[number];
6
6
  type V3Provider = 'anthropic' | 'vertex-ai' | 'openrouter' | 'bedrock' | 'tela-claude-agent-gateway';
7
7
  declare const nativeModelSchema: z.ZodEnum<{
8
8
  "claude-sonnet-4-5": "claude-sonnet-4-5";
9
9
  "claude-sonnet-4-6": "claude-sonnet-4-6";
10
+ "claude-sonnet-5": "claude-sonnet-5";
10
11
  "claude-haiku-4-5": "claude-haiku-4-5";
11
12
  "claude-fable-5": "claude-fable-5";
12
13
  "claude-opus-4-6": "claude-opus-4-6";
@@ -1,12 +1,13 @@
1
- export { A as AgentInput, C as CancelSessionResponse, E as ExecuteAgentRequest, a as ExecuteAgentResponse, O as SESSION_STREAM_EVENT_KINDS, R as SESSION_WEBHOOK_DEFAULT_EVENTS, a1 as SessionAgentEvent, d as SessionFileContentResponse, c as SessionFilesTreeResponse, f as SessionStatus, e as SessionStreamEvent, S as SessionTimelineResponse, g as SessionWebhookConfig, h as SessionWebhookEventPayload, i as SessionWebhookEventType, j as SessionWebhookSubagent, k as SessionWebhookUsage, T as TimelineEvent, l as TimelineMetrics, m as TimelinePrompt, n as TimelineRunTurnMetrics, o as TimelineSpan, p as TimelineToolResult, U as UpdateAgentModelRequest, b as UpdateAgentModelResponse, q as agentInputSchema, P as cancelSessionResponseSchema, t as executeAgentErrorResponseSchema, r as executeAgentRequestSchema, u as executeAgentResponseSchema, s as executeAgentSuccessResponseSchema, V as isBlockedWebhookHostname, a0 as sessionAgentEventSchema, a2 as sessionAgentEventsSchema, M as sessionFileContentResponseSchema, L as sessionFilesTreeResponseSchema, z as sessionStatusSchema, N as sessionStreamEventSchema, B as sessionTimelineIdSchema, K as sessionTimelineResponseSchema, X as sessionWebhookConfigSchema, $ as sessionWebhookEventPayloadSchema, Q as sessionWebhookEventTypeSchema, _ as sessionWebhookSubagentSchema, Z as sessionWebhookUsageSchema, Y as sessionWebhooksSchema, I as timelineEventSchema, D as timelineMetricsSchema, F as timelinePromptSchema, H as timelineRunTurnMetricsSchema, J as timelineSpanSchema, G as timelineToolResultSchema, x as updateAgentModelErrorResponseSchema, v as updateAgentModelRequestSchema, y as updateAgentModelResponseSchema, w as updateAgentModelSuccessResponseSchema, W as validateWebhookUrl } from './shared/agent-sdk.ed11095c.mjs';
1
+ export { A as AgentInput, C as CancelSessionResponse, E as ExecuteAgentRequest, a as ExecuteAgentResponse, X as SESSION_STREAM_EVENT_KINDS, _ as SESSION_WEBHOOK_DEFAULT_EVENTS, a9 as SessionAgentEvent, V as SessionFileContentResponse, Q as SessionFilesTreeResponse, e as SessionStatus, d as SessionStreamEvent, c as SessionThreadResponse, N as SessionThreadTurn, S as SessionTimelineResponse, f as SessionWebhookConfig, g as SessionWebhookEventPayload, h as SessionWebhookEventType, a5 as SessionWebhookResult, i as SessionWebhookSubagent, j as SessionWebhookUsage, T as TimelineEvent, k as TimelineMetrics, l as TimelinePrompt, m as TimelineRunTurnMetrics, n as TimelineSpan, o as TimelineToolResult, U as UpdateAgentModelRequest, b as UpdateAgentModelResponse, p as agentInputSchema, Y as cancelSessionResponseSchema, s as executeAgentErrorResponseSchema, q as executeAgentRequestSchema, t as executeAgentResponseSchema, r as executeAgentSuccessResponseSchema, $ as isBlockedWebhookHostname, a8 as sessionAgentEventSchema, aa as sessionAgentEventsSchema, R as sessionFileContentResponseSchema, P as sessionFilesTreeResponseSchema, y as sessionStatusSchema, W as sessionStreamEventSchema, L as sessionThreadAssistantMessageSchema, O as sessionThreadResponseSchema, M as sessionThreadTurnSchema, K as sessionThreadUserMessageSchema, z as sessionTimelineIdSchema, J as sessionTimelineResponseSchema, a1 as sessionWebhookConfigSchema, a7 as sessionWebhookEventPayloadSchema, Z as sessionWebhookEventTypeSchema, a4 as sessionWebhookResultSchema, a6 as sessionWebhookSubagentSchema, a3 as sessionWebhookUsageSchema, a2 as sessionWebhooksSchema, H as timelineEventSchema, B as timelineMetricsSchema, D as timelinePromptSchema, G as timelineRunTurnMetricsSchema, I as timelineSpanSchema, F as timelineToolResultSchema, w as updateAgentModelErrorResponseSchema, u as updateAgentModelRequestSchema, x as updateAgentModelResponseSchema, v as updateAgentModelSuccessResponseSchema, a0 as validateWebhookUrl } from './shared/agent-sdk.d26e6678.mjs';
2
2
  import { z } from 'zod';
3
3
 
4
- declare const nativeAnthropicModelIds: readonly ["claude-sonnet-4-5", "claude-sonnet-4-6", "claude-haiku-4-5", "claude-fable-5", "claude-opus-4-6", "claude-opus-4-7", "claude-opus-4-8"];
4
+ declare const nativeAnthropicModelIds: readonly ["claude-sonnet-4-5", "claude-sonnet-4-6", "claude-sonnet-5", "claude-haiku-4-5", "claude-fable-5", "claude-opus-4-6", "claude-opus-4-7", "claude-opus-4-8"];
5
5
  type NativeAnthropicModelId = typeof nativeAnthropicModelIds[number];
6
6
  type V3Provider = 'anthropic' | 'vertex-ai' | 'openrouter' | 'bedrock' | 'tela-claude-agent-gateway';
7
7
  declare const nativeModelSchema: z.ZodEnum<{
8
8
  "claude-sonnet-4-5": "claude-sonnet-4-5";
9
9
  "claude-sonnet-4-6": "claude-sonnet-4-6";
10
+ "claude-sonnet-5": "claude-sonnet-5";
10
11
  "claude-haiku-4-5": "claude-haiku-4-5";
11
12
  "claude-fable-5": "claude-fable-5";
12
13
  "claude-opus-4-6": "claude-opus-4-6";
package/dist/schemas.d.ts CHANGED
@@ -1,12 +1,13 @@
1
- export { A as AgentInput, C as CancelSessionResponse, E as ExecuteAgentRequest, a as ExecuteAgentResponse, O as SESSION_STREAM_EVENT_KINDS, R as SESSION_WEBHOOK_DEFAULT_EVENTS, a1 as SessionAgentEvent, d as SessionFileContentResponse, c as SessionFilesTreeResponse, f as SessionStatus, e as SessionStreamEvent, S as SessionTimelineResponse, g as SessionWebhookConfig, h as SessionWebhookEventPayload, i as SessionWebhookEventType, j as SessionWebhookSubagent, k as SessionWebhookUsage, T as TimelineEvent, l as TimelineMetrics, m as TimelinePrompt, n as TimelineRunTurnMetrics, o as TimelineSpan, p as TimelineToolResult, U as UpdateAgentModelRequest, b as UpdateAgentModelResponse, q as agentInputSchema, P as cancelSessionResponseSchema, t as executeAgentErrorResponseSchema, r as executeAgentRequestSchema, u as executeAgentResponseSchema, s as executeAgentSuccessResponseSchema, V as isBlockedWebhookHostname, a0 as sessionAgentEventSchema, a2 as sessionAgentEventsSchema, M as sessionFileContentResponseSchema, L as sessionFilesTreeResponseSchema, z as sessionStatusSchema, N as sessionStreamEventSchema, B as sessionTimelineIdSchema, K as sessionTimelineResponseSchema, X as sessionWebhookConfigSchema, $ as sessionWebhookEventPayloadSchema, Q as sessionWebhookEventTypeSchema, _ as sessionWebhookSubagentSchema, Z as sessionWebhookUsageSchema, Y as sessionWebhooksSchema, I as timelineEventSchema, D as timelineMetricsSchema, F as timelinePromptSchema, H as timelineRunTurnMetricsSchema, J as timelineSpanSchema, G as timelineToolResultSchema, x as updateAgentModelErrorResponseSchema, v as updateAgentModelRequestSchema, y as updateAgentModelResponseSchema, w as updateAgentModelSuccessResponseSchema, W as validateWebhookUrl } from './shared/agent-sdk.ed11095c.js';
1
+ export { A as AgentInput, C as CancelSessionResponse, E as ExecuteAgentRequest, a as ExecuteAgentResponse, X as SESSION_STREAM_EVENT_KINDS, _ as SESSION_WEBHOOK_DEFAULT_EVENTS, a9 as SessionAgentEvent, V as SessionFileContentResponse, Q as SessionFilesTreeResponse, e as SessionStatus, d as SessionStreamEvent, c as SessionThreadResponse, N as SessionThreadTurn, S as SessionTimelineResponse, f as SessionWebhookConfig, g as SessionWebhookEventPayload, h as SessionWebhookEventType, a5 as SessionWebhookResult, i as SessionWebhookSubagent, j as SessionWebhookUsage, T as TimelineEvent, k as TimelineMetrics, l as TimelinePrompt, m as TimelineRunTurnMetrics, n as TimelineSpan, o as TimelineToolResult, U as UpdateAgentModelRequest, b as UpdateAgentModelResponse, p as agentInputSchema, Y as cancelSessionResponseSchema, s as executeAgentErrorResponseSchema, q as executeAgentRequestSchema, t as executeAgentResponseSchema, r as executeAgentSuccessResponseSchema, $ as isBlockedWebhookHostname, a8 as sessionAgentEventSchema, aa as sessionAgentEventsSchema, R as sessionFileContentResponseSchema, P as sessionFilesTreeResponseSchema, y as sessionStatusSchema, W as sessionStreamEventSchema, L as sessionThreadAssistantMessageSchema, O as sessionThreadResponseSchema, M as sessionThreadTurnSchema, K as sessionThreadUserMessageSchema, z as sessionTimelineIdSchema, J as sessionTimelineResponseSchema, a1 as sessionWebhookConfigSchema, a7 as sessionWebhookEventPayloadSchema, Z as sessionWebhookEventTypeSchema, a4 as sessionWebhookResultSchema, a6 as sessionWebhookSubagentSchema, a3 as sessionWebhookUsageSchema, a2 as sessionWebhooksSchema, H as timelineEventSchema, B as timelineMetricsSchema, D as timelinePromptSchema, G as timelineRunTurnMetricsSchema, I as timelineSpanSchema, F as timelineToolResultSchema, w as updateAgentModelErrorResponseSchema, u as updateAgentModelRequestSchema, x as updateAgentModelResponseSchema, v as updateAgentModelSuccessResponseSchema, a0 as validateWebhookUrl } from './shared/agent-sdk.d26e6678.js';
2
2
  import { z } from 'zod';
3
3
 
4
- declare const nativeAnthropicModelIds: readonly ["claude-sonnet-4-5", "claude-sonnet-4-6", "claude-haiku-4-5", "claude-fable-5", "claude-opus-4-6", "claude-opus-4-7", "claude-opus-4-8"];
4
+ declare const nativeAnthropicModelIds: readonly ["claude-sonnet-4-5", "claude-sonnet-4-6", "claude-sonnet-5", "claude-haiku-4-5", "claude-fable-5", "claude-opus-4-6", "claude-opus-4-7", "claude-opus-4-8"];
5
5
  type NativeAnthropicModelId = typeof nativeAnthropicModelIds[number];
6
6
  type V3Provider = 'anthropic' | 'vertex-ai' | 'openrouter' | 'bedrock' | 'tela-claude-agent-gateway';
7
7
  declare const nativeModelSchema: z.ZodEnum<{
8
8
  "claude-sonnet-4-5": "claude-sonnet-4-5";
9
9
  "claude-sonnet-4-6": "claude-sonnet-4-6";
10
+ "claude-sonnet-5": "claude-sonnet-5";
10
11
  "claude-haiku-4-5": "claude-haiku-4-5";
11
12
  "claude-fable-5": "claude-fable-5";
12
13
  "claude-opus-4-6": "claude-opus-4-6";
package/dist/schemas.mjs CHANGED
@@ -427,6 +427,7 @@ const openrouterCatalog = /*@__PURE__*/getDefaultExportFromCjs(openrouterModels)
427
427
  const nativeAnthropicModelIds = [
428
428
  "claude-sonnet-4-5",
429
429
  "claude-sonnet-4-6",
430
+ "claude-sonnet-5",
430
431
  "claude-haiku-4-5",
431
432
  "claude-fable-5",
432
433
  "claude-opus-4-6",
@@ -524,6 +525,11 @@ const sessionWebhookUsageSchema = z.object({
524
525
  durationMs: z.number().int().nonnegative().optional(),
525
526
  numTurns: z.number().int().nonnegative().optional()
526
527
  }).strict();
528
+ const sessionWebhookResultSchema = z.union([
529
+ z.string(),
530
+ z.record(z.string(), z.unknown()),
531
+ z.null()
532
+ ]);
527
533
  const sessionWebhookSubagentSchema = z.object({
528
534
  callId: z.string().min(1).max(256),
529
535
  subagentType: z.string().max(256).optional(),
@@ -537,7 +543,10 @@ const sessionWebhookEventPayloadSchema = z.object({
537
543
  runId: z.string().optional(),
538
544
  status: z.string(),
539
545
  error: z.string().optional(),
546
+ interrupted: z.boolean().optional(),
547
+ failReason: z.string().optional(),
540
548
  usage: sessionWebhookUsageSchema.optional(),
549
+ result: sessionWebhookResultSchema.optional(),
541
550
  subagent: sessionWebhookSubagentSchema.optional(),
542
551
  timestamp: z.string(),
543
552
  apiVersion: z.literal("v4"),
@@ -602,8 +611,8 @@ const executeAgentResponseSchema = z.discriminatedUnion("success", [
602
611
  const repositoryNameSchema = z.string().min(1, "Repository is required").max(200, "Repository must be 200 characters or less").regex(/^[\w.-]+$/, "Repository contains unsupported characters");
603
612
  const updateAgentModelRequestSchema = z.object({
604
613
  repository: repositoryNameSchema,
605
- model: modelSchema,
606
- commitMessage: z.string().max(4096, "Commit message must be 4096 characters or less").optional()
614
+ model: modelSchema.describe("Supported agent model id. The model prefix selects the provider template."),
615
+ commitMessage: z.string().max(4096, "Commit message must be 4096 characters or less").optional().describe("Optional commit message for the model/template update")
607
616
  }).strict();
608
617
  const updateAgentModelSuccessResponseSchema = z.object({
609
618
  success: z.literal(true).describe("Whether the model update succeeded"),
@@ -698,6 +707,34 @@ const sessionTimelineResponseSchema = z.object({
698
707
  prompt: timelinePromptSchema,
699
708
  spans: z.array(timelineSpanSchema)
700
709
  });
710
+ const sessionThreadUserMessageSchema = z.object({
711
+ text: z.string().nullable(),
712
+ attachments: z.unknown().nullable().optional()
713
+ });
714
+ const sessionThreadAssistantMessageSchema = z.object({
715
+ status: z.string().nullable(),
716
+ text: z.string().nullable(),
717
+ structuredContent: z.unknown().nullable().optional(),
718
+ events: z.array(timelineEventSchema).nullable().optional(),
719
+ attachments: z.unknown().nullable().optional(),
720
+ usage: z.unknown().nullable().optional()
721
+ });
722
+ const sessionThreadTurnSchema = z.object({
723
+ runId: z.string(),
724
+ index: z.number().int().nonnegative(),
725
+ isContinuation: z.boolean(),
726
+ status: z.string().nullable(),
727
+ createdAt: z.number().nullable(),
728
+ finishedAt: z.number().nullable(),
729
+ user: sessionThreadUserMessageSchema.nullable(),
730
+ assistant: sessionThreadAssistantMessageSchema.nullable()
731
+ });
732
+ const sessionThreadResponseSchema = z.object({
733
+ sessionId: z.string(),
734
+ status: z.string(),
735
+ turnCount: z.number().int().nonnegative(),
736
+ turns: z.array(sessionThreadTurnSchema)
737
+ });
701
738
  const sessionFilesTreeResponseSchema = z.object({
702
739
  sessionId: z.string(),
703
740
  tree: z.array(z.object({
@@ -769,4 +806,4 @@ const cancelSessionResponseSchema = z.discriminatedUnion("success", [
769
806
  z.object({ success: z.literal(false), error: z.string() })
770
807
  ]);
771
808
 
772
- export { SESSION_STREAM_EVENT_KINDS, SESSION_WEBHOOK_DEFAULT_EVENTS, agentInputSchema, cancelSessionResponseSchema, executeAgentErrorResponseSchema, executeAgentRequestSchema, executeAgentResponseSchema, executeAgentSuccessResponseSchema, isBlockedWebhookHostname, modelSchema, nativeAnthropicModelIds, nativeModelSchema, openrouterModelCatalog, openrouterModelIds, sessionAgentEventSchema, sessionAgentEventsSchema, sessionFileContentResponseSchema, sessionFilesTreeResponseSchema, sessionStatusSchema, sessionStreamEventSchema, sessionTimelineIdSchema, sessionTimelineResponseSchema, sessionWebhookConfigSchema, sessionWebhookEventPayloadSchema, sessionWebhookEventTypeSchema, sessionWebhookSubagentSchema, sessionWebhookUsageSchema, sessionWebhooksSchema, timelineEventSchema, timelineMetricsSchema, timelinePromptSchema, timelineRunTurnMetricsSchema, timelineSpanSchema, timelineToolResultSchema, updateAgentModelErrorResponseSchema, updateAgentModelRequestSchema, updateAgentModelResponseSchema, updateAgentModelSuccessResponseSchema, validateWebhookUrl };
809
+ export { SESSION_STREAM_EVENT_KINDS, SESSION_WEBHOOK_DEFAULT_EVENTS, agentInputSchema, cancelSessionResponseSchema, executeAgentErrorResponseSchema, executeAgentRequestSchema, executeAgentResponseSchema, executeAgentSuccessResponseSchema, isBlockedWebhookHostname, modelSchema, nativeAnthropicModelIds, nativeModelSchema, openrouterModelCatalog, openrouterModelIds, sessionAgentEventSchema, sessionAgentEventsSchema, sessionFileContentResponseSchema, sessionFilesTreeResponseSchema, sessionStatusSchema, sessionStreamEventSchema, sessionThreadAssistantMessageSchema, sessionThreadResponseSchema, sessionThreadTurnSchema, sessionThreadUserMessageSchema, sessionTimelineIdSchema, sessionTimelineResponseSchema, sessionWebhookConfigSchema, sessionWebhookEventPayloadSchema, sessionWebhookEventTypeSchema, sessionWebhookResultSchema, sessionWebhookSubagentSchema, sessionWebhookUsageSchema, sessionWebhooksSchema, timelineEventSchema, timelineMetricsSchema, timelinePromptSchema, timelineRunTurnMetricsSchema, timelineSpanSchema, timelineToolResultSchema, updateAgentModelErrorResponseSchema, updateAgentModelRequestSchema, updateAgentModelResponseSchema, updateAgentModelSuccessResponseSchema, validateWebhookUrl };