@meistrari/agent-sdk 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/schemas.mjs CHANGED
@@ -428,6 +428,7 @@ const nativeAnthropicModelIds = [
428
428
  "claude-sonnet-4-5",
429
429
  "claude-sonnet-4-6",
430
430
  "claude-haiku-4-5",
431
+ "claude-fable-5",
431
432
  "claude-opus-4-6",
432
433
  "claude-opus-4-7",
433
434
  "claude-opus-4-8"
@@ -440,6 +441,118 @@ const modelSchema = z.enum([
440
441
  ...openrouterModelIds
441
442
  ]);
442
443
 
444
+ const sessionWebhookEventTypeSchema = z.enum([
445
+ "session.started",
446
+ "session.completed",
447
+ "session.failed",
448
+ "session.cancelled",
449
+ "session.waiting_messages",
450
+ "subagent.started",
451
+ "subagent.completed"
452
+ ]);
453
+ const SESSION_WEBHOOK_DEFAULT_EVENTS = [
454
+ "session.started",
455
+ "session.completed",
456
+ "session.failed",
457
+ "session.cancelled",
458
+ "session.waiting_messages"
459
+ ];
460
+ const BLOCKED_HOSTNAME_SUFFIXES = [".localhost", ".local", ".internal"];
461
+ const BLOCKED_HOSTNAMES = /* @__PURE__ */ new Set(["localhost", "metadata.google.internal"]);
462
+ function isPrivateIpv4(hostname) {
463
+ const match = hostname.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);
464
+ if (!match) {
465
+ return false;
466
+ }
467
+ const octets = match.slice(1).map(Number);
468
+ if (octets.some((octet) => octet > 255)) {
469
+ return true;
470
+ }
471
+ const a = octets[0] ?? 0;
472
+ const b = octets[1] ?? 0;
473
+ return a === 0 || a === 10 || a === 127 || a === 100 && b >= 64 && b <= 127 || a === 169 && b === 254 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168;
474
+ }
475
+ function isPrivateIpv6(hostname) {
476
+ const normalized = hostname.replace(/^\[|\]$/g, "").toLowerCase();
477
+ if (!normalized.includes(":")) {
478
+ return false;
479
+ }
480
+ return normalized === "::" || normalized === "::1" || normalized.startsWith("fc") || normalized.startsWith("fd") || normalized.startsWith("fe8") || normalized.startsWith("fe9") || normalized.startsWith("fea") || normalized.startsWith("feb") || normalized.startsWith("::ffff:");
481
+ }
482
+ function isBlockedWebhookHostname(hostname) {
483
+ const normalized = hostname.toLowerCase();
484
+ if (BLOCKED_HOSTNAMES.has(normalized)) {
485
+ return true;
486
+ }
487
+ if (BLOCKED_HOSTNAME_SUFFIXES.some((suffix) => normalized.endsWith(suffix))) {
488
+ return true;
489
+ }
490
+ return isPrivateIpv4(normalized) || isPrivateIpv6(normalized);
491
+ }
492
+ function validateWebhookUrl(value) {
493
+ let parsed;
494
+ try {
495
+ parsed = new URL(value);
496
+ } catch {
497
+ return "Webhook URL is invalid";
498
+ }
499
+ if (parsed.protocol !== "https:") {
500
+ return "Webhook URLs must use https";
501
+ }
502
+ if (isBlockedWebhookHostname(parsed.hostname)) {
503
+ return "Webhook URL host is not allowed";
504
+ }
505
+ return null;
506
+ }
507
+ const sessionWebhookConfigSchema = z.object({
508
+ url: z.string().max(2048).superRefine((value, ctx) => {
509
+ const error = validateWebhookUrl(value);
510
+ if (error) {
511
+ ctx.addIssue({ code: "custom", message: error });
512
+ }
513
+ }).describe("HTTPS endpoint that receives lifecycle event POSTs (e.g. a Trigger.dev wait-token URL)"),
514
+ events: z.array(sessionWebhookEventTypeSchema).min(1).optional().describe("Event filter; defaults to all session.* events (subagent.* events must be opted into)"),
515
+ secret: z.string().min(8).max(256).optional().describe("Optional HMAC-SHA256 signing secret used for the x-tela-agent-webhook-signature header")
516
+ }).strict();
517
+ const sessionWebhooksSchema = z.array(sessionWebhookConfigSchema).max(5).describe("Webhook endpoints notified about session lifecycle and subagent events");
518
+ const sessionWebhookUsageSchema = z.object({
519
+ inputTokens: z.number().int().nonnegative().optional(),
520
+ outputTokens: z.number().int().nonnegative().optional(),
521
+ cacheReadInputTokens: z.number().int().nonnegative().optional(),
522
+ cacheCreationInputTokens: z.number().int().nonnegative().optional(),
523
+ totalCostUsd: z.number().nullable().optional(),
524
+ durationMs: z.number().int().nonnegative().optional(),
525
+ numTurns: z.number().int().nonnegative().optional()
526
+ }).strict();
527
+ const sessionWebhookSubagentSchema = z.object({
528
+ callId: z.string().min(1).max(256),
529
+ subagentType: z.string().max(256).optional(),
530
+ status: z.enum(["success", "failed"]).optional(),
531
+ durationMs: z.number().int().nonnegative().optional()
532
+ }).strict();
533
+ const sessionWebhookEventPayloadSchema = z.object({
534
+ eventType: sessionWebhookEventTypeSchema,
535
+ sessionId: z.string(),
536
+ workspaceId: z.string().optional(),
537
+ runId: z.string().optional(),
538
+ status: z.string(),
539
+ error: z.string().optional(),
540
+ usage: sessionWebhookUsageSchema.optional(),
541
+ subagent: sessionWebhookSubagentSchema.optional(),
542
+ timestamp: z.string(),
543
+ apiVersion: z.literal("v4"),
544
+ deliveryId: z.string()
545
+ });
546
+ const sessionAgentEventSchema = z.object({
547
+ type: z.enum(["subagent.started", "subagent.completed"]),
548
+ callId: z.string().min(1).max(256),
549
+ subagentType: z.string().max(256).optional(),
550
+ status: z.enum(["success", "failed"]).optional(),
551
+ durationMs: z.number().int().nonnegative().optional(),
552
+ timestamp: z.number().int().nonnegative()
553
+ }).strict();
554
+ const sessionAgentEventsSchema = z.array(sessionAgentEventSchema).max(20);
555
+
443
556
  const vaultReferenceSchema = z.string().regex(/^vault:\/\/\S+$/, "vaultRef must start with vault:// and cannot contain whitespace");
444
557
  const agentInputSchema = z.object({
445
558
  vaultRef: vaultReferenceSchema,
@@ -454,7 +567,8 @@ const executeAgentRequestSchema = z.object({
454
567
  message: z.string().min(1).max(8e5).optional(),
455
568
  inputs: z.array(agentInputSchema).optional(),
456
569
  environmentVariables: z.record(z.string(), z.string()).optional(),
457
- recover: z.boolean().optional()
570
+ recover: z.boolean().optional(),
571
+ webhooks: sessionWebhooksSchema.optional()
458
572
  }).strict().superRefine((data, ctx) => {
459
573
  if (!data.sessionId) {
460
574
  if (!data.organizationName) {
@@ -493,15 +607,15 @@ const updateAgentModelRequestSchema = z.object({
493
607
  }).strict();
494
608
  const updateAgentModelSuccessResponseSchema = z.object({
495
609
  success: z.literal(true).describe("Whether the model update succeeded"),
496
- organizationName: z.string().optional().describe("Resolved Forgejo organization name"),
497
- repository: z.string().optional().describe("Forgejo repository name"),
498
- branch: z.string().optional().describe("Branch written to"),
499
- commitHash: z.string().optional().describe("Commit hash after update"),
500
- model: modelSchema.optional().describe("Configured model after update"),
501
- providerTemplate: z.string().optional().describe("Provider template selected from the model prefix"),
502
- templateSynced: z.boolean().optional().describe("Whether managed template files were synchronized"),
503
- files: z.array(z.string()).optional().describe("Files written by the update"),
504
- deletedFiles: z.array(z.string()).optional().describe("Files deleted by the update")
610
+ organizationName: z.string().describe("Resolved Forgejo organization name"),
611
+ repository: z.string().describe("Forgejo repository name"),
612
+ branch: z.string().describe("Branch written to"),
613
+ commitHash: z.string().describe("Commit hash after update"),
614
+ model: modelSchema.describe("Configured model after update"),
615
+ providerTemplate: z.string().describe("Provider template selected from the model prefix"),
616
+ templateSynced: z.boolean().describe("Whether managed template files were synchronized"),
617
+ files: z.array(z.string()).describe("Files written by the update"),
618
+ deletedFiles: z.array(z.string()).describe("Files deleted by the update")
505
619
  });
506
620
  const updateAgentModelErrorResponseSchema = z.object({
507
621
  success: z.literal(false).describe("Whether the model update succeeded"),
@@ -635,5 +749,9 @@ const sessionStreamEventSchema = z.discriminatedUnion("kind", [
635
749
  sessionErrorEventSchema
636
750
  ]);
637
751
  const SESSION_STREAM_EVENT_KINDS = /* @__PURE__ */ new Set(["status", "steps", "result", "timeline-finalize", "error"]);
752
+ const cancelSessionResponseSchema = z.discriminatedUnion("success", [
753
+ z.object({ success: z.literal(true), message: z.string() }),
754
+ z.object({ success: z.literal(false), error: z.string() })
755
+ ]);
638
756
 
639
- export { SESSION_STREAM_EVENT_KINDS, agentInputSchema, executeAgentErrorResponseSchema, executeAgentRequestSchema, executeAgentResponseSchema, executeAgentSuccessResponseSchema, modelSchema, nativeAnthropicModelIds, nativeModelSchema, openrouterModelCatalog, openrouterModelIds, sessionStatusSchema, sessionStreamEventSchema, sessionTimelineIdSchema, sessionTimelineResponseSchema, timelineEventSchema, timelineMetricsSchema, timelinePromptSchema, timelineRunTurnMetricsSchema, timelineSpanSchema, timelineToolResultSchema, updateAgentModelErrorResponseSchema, updateAgentModelRequestSchema, updateAgentModelResponseSchema, updateAgentModelSuccessResponseSchema };
757
+ export { SESSION_STREAM_EVENT_KINDS, SESSION_WEBHOOK_DEFAULT_EVENTS, agentInputSchema, cancelSessionResponseSchema, executeAgentErrorResponseSchema, executeAgentRequestSchema, executeAgentResponseSchema, executeAgentSuccessResponseSchema, isBlockedWebhookHostname, modelSchema, nativeAnthropicModelIds, nativeModelSchema, openrouterModelCatalog, openrouterModelIds, sessionAgentEventSchema, sessionAgentEventsSchema, sessionStatusSchema, sessionStreamEventSchema, sessionTimelineIdSchema, sessionTimelineResponseSchema, sessionWebhookConfigSchema, sessionWebhookEventPayloadSchema, sessionWebhookEventTypeSchema, sessionWebhookSubagentSchema, sessionWebhookUsageSchema, sessionWebhooksSchema, timelineEventSchema, timelineMetricsSchema, timelinePromptSchema, timelineRunTurnMetricsSchema, timelineSpanSchema, timelineToolResultSchema, updateAgentModelErrorResponseSchema, updateAgentModelRequestSchema, updateAgentModelResponseSchema, updateAgentModelSuccessResponseSchema, validateWebhookUrl };
@@ -19,6 +19,19 @@ declare const executeAgentRequestSchema: z.ZodObject<{
19
19
  }, z.core.$strict>>>;
20
20
  environmentVariables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
21
21
  recover: z.ZodOptional<z.ZodBoolean>;
22
+ webhooks: z.ZodOptional<z.ZodArray<z.ZodObject<{
23
+ url: z.ZodString;
24
+ events: z.ZodOptional<z.ZodArray<z.ZodEnum<{
25
+ "session.started": "session.started";
26
+ "session.completed": "session.completed";
27
+ "session.failed": "session.failed";
28
+ "session.cancelled": "session.cancelled";
29
+ "session.waiting_messages": "session.waiting_messages";
30
+ "subagent.started": "subagent.started";
31
+ "subagent.completed": "subagent.completed";
32
+ }>>>;
33
+ secret: z.ZodOptional<z.ZodString>;
34
+ }, z.core.$strict>>>;
22
35
  }, z.core.$strict>;
23
36
  type ExecuteAgentRequest = z.infer<typeof executeAgentRequestSchema>;
24
37
  declare const executeAgentSuccessResponseSchema: z.ZodObject<{
@@ -47,17 +60,17 @@ declare const updateAgentModelRequestSchema: z.ZodObject<{
47
60
  type UpdateAgentModelRequest = z.infer<typeof updateAgentModelRequestSchema>;
48
61
  declare const updateAgentModelSuccessResponseSchema: z.ZodObject<{
49
62
  success: z.ZodLiteral<true>;
50
- organizationName: z.ZodOptional<z.ZodString>;
51
- repository: z.ZodOptional<z.ZodString>;
52
- branch: z.ZodOptional<z.ZodString>;
53
- commitHash: z.ZodOptional<z.ZodString>;
54
- model: z.ZodOptional<z.ZodEnum<{
63
+ organizationName: z.ZodString;
64
+ repository: z.ZodString;
65
+ branch: z.ZodString;
66
+ commitHash: z.ZodString;
67
+ model: z.ZodEnum<{
55
68
  [x: string]: string;
56
- }>>;
57
- providerTemplate: z.ZodOptional<z.ZodString>;
58
- templateSynced: z.ZodOptional<z.ZodBoolean>;
59
- files: z.ZodOptional<z.ZodArray<z.ZodString>>;
60
- deletedFiles: z.ZodOptional<z.ZodArray<z.ZodString>>;
69
+ }>;
70
+ providerTemplate: z.ZodString;
71
+ templateSynced: z.ZodBoolean;
72
+ files: z.ZodArray<z.ZodString>;
73
+ deletedFiles: z.ZodArray<z.ZodString>;
61
74
  }, z.core.$strip>;
62
75
  declare const updateAgentModelErrorResponseSchema: z.ZodObject<{
63
76
  success: z.ZodLiteral<false>;
@@ -65,17 +78,17 @@ declare const updateAgentModelErrorResponseSchema: z.ZodObject<{
65
78
  }, z.core.$strip>;
66
79
  declare const updateAgentModelResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
67
80
  success: z.ZodLiteral<true>;
68
- organizationName: z.ZodOptional<z.ZodString>;
69
- repository: z.ZodOptional<z.ZodString>;
70
- branch: z.ZodOptional<z.ZodString>;
71
- commitHash: z.ZodOptional<z.ZodString>;
72
- model: z.ZodOptional<z.ZodEnum<{
81
+ organizationName: z.ZodString;
82
+ repository: z.ZodString;
83
+ branch: z.ZodString;
84
+ commitHash: z.ZodString;
85
+ model: z.ZodEnum<{
73
86
  [x: string]: string;
74
- }>>;
75
- providerTemplate: z.ZodOptional<z.ZodString>;
76
- templateSynced: z.ZodOptional<z.ZodBoolean>;
77
- files: z.ZodOptional<z.ZodArray<z.ZodString>>;
78
- deletedFiles: z.ZodOptional<z.ZodArray<z.ZodString>>;
87
+ }>;
88
+ providerTemplate: z.ZodString;
89
+ templateSynced: z.ZodBoolean;
90
+ files: z.ZodArray<z.ZodString>;
91
+ deletedFiles: z.ZodArray<z.ZodString>;
79
92
  }, z.core.$strip>, z.ZodObject<{
80
93
  success: z.ZodLiteral<false>;
81
94
  error: z.ZodString;
@@ -367,6 +380,142 @@ declare const sessionStreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
367
380
  }, z.core.$strip>], "kind">;
368
381
  type SessionStreamEvent = z.infer<typeof sessionStreamEventSchema>;
369
382
  declare const SESSION_STREAM_EVENT_KINDS: Set<string>;
383
+ declare const cancelSessionResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
384
+ success: z.ZodLiteral<true>;
385
+ message: z.ZodString;
386
+ }, z.core.$strip>, z.ZodObject<{
387
+ success: z.ZodLiteral<false>;
388
+ error: z.ZodString;
389
+ }, z.core.$strip>], "success">;
390
+ type CancelSessionResponse = z.infer<typeof cancelSessionResponseSchema>;
391
+
392
+ declare const sessionWebhookEventTypeSchema: z.ZodEnum<{
393
+ "session.started": "session.started";
394
+ "session.completed": "session.completed";
395
+ "session.failed": "session.failed";
396
+ "session.cancelled": "session.cancelled";
397
+ "session.waiting_messages": "session.waiting_messages";
398
+ "subagent.started": "subagent.started";
399
+ "subagent.completed": "subagent.completed";
400
+ }>;
401
+ type SessionWebhookEventType = z.infer<typeof sessionWebhookEventTypeSchema>;
402
+ declare const SESSION_WEBHOOK_DEFAULT_EVENTS: SessionWebhookEventType[];
403
+ declare function isBlockedWebhookHostname(hostname: string): boolean;
404
+ declare function validateWebhookUrl(value: string): string | null;
405
+ declare const sessionWebhookConfigSchema: z.ZodObject<{
406
+ url: z.ZodString;
407
+ events: z.ZodOptional<z.ZodArray<z.ZodEnum<{
408
+ "session.started": "session.started";
409
+ "session.completed": "session.completed";
410
+ "session.failed": "session.failed";
411
+ "session.cancelled": "session.cancelled";
412
+ "session.waiting_messages": "session.waiting_messages";
413
+ "subagent.started": "subagent.started";
414
+ "subagent.completed": "subagent.completed";
415
+ }>>>;
416
+ secret: z.ZodOptional<z.ZodString>;
417
+ }, z.core.$strict>;
418
+ type SessionWebhookConfig = z.infer<typeof sessionWebhookConfigSchema>;
419
+ declare const sessionWebhooksSchema: z.ZodArray<z.ZodObject<{
420
+ url: z.ZodString;
421
+ events: z.ZodOptional<z.ZodArray<z.ZodEnum<{
422
+ "session.started": "session.started";
423
+ "session.completed": "session.completed";
424
+ "session.failed": "session.failed";
425
+ "session.cancelled": "session.cancelled";
426
+ "session.waiting_messages": "session.waiting_messages";
427
+ "subagent.started": "subagent.started";
428
+ "subagent.completed": "subagent.completed";
429
+ }>>>;
430
+ secret: z.ZodOptional<z.ZodString>;
431
+ }, z.core.$strict>>;
432
+ declare const sessionWebhookUsageSchema: z.ZodObject<{
433
+ inputTokens: z.ZodOptional<z.ZodNumber>;
434
+ outputTokens: z.ZodOptional<z.ZodNumber>;
435
+ cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
436
+ cacheCreationInputTokens: z.ZodOptional<z.ZodNumber>;
437
+ totalCostUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
438
+ durationMs: z.ZodOptional<z.ZodNumber>;
439
+ numTurns: z.ZodOptional<z.ZodNumber>;
440
+ }, z.core.$strict>;
441
+ type SessionWebhookUsage = z.infer<typeof sessionWebhookUsageSchema>;
442
+ declare const sessionWebhookSubagentSchema: z.ZodObject<{
443
+ callId: z.ZodString;
444
+ subagentType: z.ZodOptional<z.ZodString>;
445
+ status: z.ZodOptional<z.ZodEnum<{
446
+ success: "success";
447
+ failed: "failed";
448
+ }>>;
449
+ durationMs: z.ZodOptional<z.ZodNumber>;
450
+ }, z.core.$strict>;
451
+ type SessionWebhookSubagent = z.infer<typeof sessionWebhookSubagentSchema>;
452
+ declare const sessionWebhookEventPayloadSchema: z.ZodObject<{
453
+ eventType: z.ZodEnum<{
454
+ "session.started": "session.started";
455
+ "session.completed": "session.completed";
456
+ "session.failed": "session.failed";
457
+ "session.cancelled": "session.cancelled";
458
+ "session.waiting_messages": "session.waiting_messages";
459
+ "subagent.started": "subagent.started";
460
+ "subagent.completed": "subagent.completed";
461
+ }>;
462
+ sessionId: z.ZodString;
463
+ workspaceId: z.ZodOptional<z.ZodString>;
464
+ runId: z.ZodOptional<z.ZodString>;
465
+ status: z.ZodString;
466
+ error: z.ZodOptional<z.ZodString>;
467
+ usage: z.ZodOptional<z.ZodObject<{
468
+ inputTokens: z.ZodOptional<z.ZodNumber>;
469
+ outputTokens: z.ZodOptional<z.ZodNumber>;
470
+ cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
471
+ cacheCreationInputTokens: z.ZodOptional<z.ZodNumber>;
472
+ totalCostUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
473
+ durationMs: z.ZodOptional<z.ZodNumber>;
474
+ numTurns: z.ZodOptional<z.ZodNumber>;
475
+ }, z.core.$strict>>;
476
+ subagent: z.ZodOptional<z.ZodObject<{
477
+ callId: z.ZodString;
478
+ subagentType: z.ZodOptional<z.ZodString>;
479
+ status: z.ZodOptional<z.ZodEnum<{
480
+ success: "success";
481
+ failed: "failed";
482
+ }>>;
483
+ durationMs: z.ZodOptional<z.ZodNumber>;
484
+ }, z.core.$strict>>;
485
+ timestamp: z.ZodString;
486
+ apiVersion: z.ZodLiteral<"v4">;
487
+ deliveryId: z.ZodString;
488
+ }, z.core.$strip>;
489
+ type SessionWebhookEventPayload = z.infer<typeof sessionWebhookEventPayloadSchema>;
490
+ declare const sessionAgentEventSchema: z.ZodObject<{
491
+ type: z.ZodEnum<{
492
+ "subagent.started": "subagent.started";
493
+ "subagent.completed": "subagent.completed";
494
+ }>;
495
+ callId: z.ZodString;
496
+ subagentType: z.ZodOptional<z.ZodString>;
497
+ status: z.ZodOptional<z.ZodEnum<{
498
+ success: "success";
499
+ failed: "failed";
500
+ }>>;
501
+ durationMs: z.ZodOptional<z.ZodNumber>;
502
+ timestamp: z.ZodNumber;
503
+ }, z.core.$strict>;
504
+ type SessionAgentEvent = z.infer<typeof sessionAgentEventSchema>;
505
+ declare const sessionAgentEventsSchema: z.ZodArray<z.ZodObject<{
506
+ type: z.ZodEnum<{
507
+ "subagent.started": "subagent.started";
508
+ "subagent.completed": "subagent.completed";
509
+ }>;
510
+ callId: z.ZodString;
511
+ subagentType: z.ZodOptional<z.ZodString>;
512
+ status: z.ZodOptional<z.ZodEnum<{
513
+ success: "success";
514
+ failed: "failed";
515
+ }>>;
516
+ durationMs: z.ZodOptional<z.ZodNumber>;
517
+ timestamp: z.ZodNumber;
518
+ }, z.core.$strict>>;
370
519
 
371
- export { sessionTimelineResponseSchema as B, sessionStreamEventSchema as C, SESSION_STREAM_EVENT_KINDS as D, agentInputSchema as j, executeAgentRequestSchema as k, executeAgentSuccessResponseSchema as l, executeAgentErrorResponseSchema as m, executeAgentResponseSchema as n, updateAgentModelSuccessResponseSchema as o, updateAgentModelErrorResponseSchema as p, updateAgentModelResponseSchema as q, sessionTimelineIdSchema as r, sessionStatusSchema as s, timelineMetricsSchema as t, updateAgentModelRequestSchema as u, timelinePromptSchema as v, timelineToolResultSchema as w, timelineRunTurnMetricsSchema as x, timelineEventSchema as y, timelineSpanSchema as z };
372
- export type { AgentInput as A, ExecuteAgentRequest as E, SessionTimelineResponse as S, TimelineEvent as T, UpdateAgentModelRequest as U, ExecuteAgentResponse as a, UpdateAgentModelResponse as b, SessionStreamEvent as c, SessionStatus as d, TimelineMetrics as e, TimelinePrompt as f, TimelineRunTurnMetrics as g, TimelineSpan as h, TimelineToolResult as i };
520
+ export { timelinePromptSchema as B, timelineToolResultSchema as D, timelineRunTurnMetricsSchema as F, timelineEventSchema as G, timelineSpanSchema as H, sessionTimelineResponseSchema as I, sessionStreamEventSchema as J, SESSION_STREAM_EVENT_KINDS as K, cancelSessionResponseSchema as L, sessionWebhookEventTypeSchema as M, SESSION_WEBHOOK_DEFAULT_EVENTS as N, isBlockedWebhookHostname as O, validateWebhookUrl as P, sessionWebhookConfigSchema as Q, sessionWebhooksSchema as R, sessionWebhookUsageSchema as V, sessionWebhookSubagentSchema as W, sessionWebhookEventPayloadSchema as X, sessionAgentEventSchema as Y, sessionAgentEventsSchema as _, agentInputSchema as o, executeAgentRequestSchema as p, executeAgentSuccessResponseSchema as q, executeAgentErrorResponseSchema as r, executeAgentResponseSchema as s, updateAgentModelSuccessResponseSchema as t, updateAgentModelRequestSchema as u, updateAgentModelErrorResponseSchema as v, updateAgentModelResponseSchema as w, sessionStatusSchema as x, sessionTimelineIdSchema as y, timelineMetricsSchema as z };
521
+ export type { AgentInput as A, CancelSessionResponse as C, ExecuteAgentRequest as E, SessionTimelineResponse as S, TimelineEvent as T, UpdateAgentModelRequest as U, SessionAgentEvent as Z, ExecuteAgentResponse as a, UpdateAgentModelResponse as b, SessionStreamEvent as c, SessionStatus as d, SessionWebhookConfig as e, SessionWebhookEventPayload as f, SessionWebhookEventType as g, SessionWebhookSubagent as h, SessionWebhookUsage as i, TimelineMetrics as j, TimelinePrompt as k, TimelineRunTurnMetrics as l, TimelineSpan as m, TimelineToolResult as n };
@@ -19,6 +19,19 @@ declare const executeAgentRequestSchema: z.ZodObject<{
19
19
  }, z.core.$strict>>>;
20
20
  environmentVariables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
21
21
  recover: z.ZodOptional<z.ZodBoolean>;
22
+ webhooks: z.ZodOptional<z.ZodArray<z.ZodObject<{
23
+ url: z.ZodString;
24
+ events: z.ZodOptional<z.ZodArray<z.ZodEnum<{
25
+ "session.started": "session.started";
26
+ "session.completed": "session.completed";
27
+ "session.failed": "session.failed";
28
+ "session.cancelled": "session.cancelled";
29
+ "session.waiting_messages": "session.waiting_messages";
30
+ "subagent.started": "subagent.started";
31
+ "subagent.completed": "subagent.completed";
32
+ }>>>;
33
+ secret: z.ZodOptional<z.ZodString>;
34
+ }, z.core.$strict>>>;
22
35
  }, z.core.$strict>;
23
36
  type ExecuteAgentRequest = z.infer<typeof executeAgentRequestSchema>;
24
37
  declare const executeAgentSuccessResponseSchema: z.ZodObject<{
@@ -47,17 +60,17 @@ declare const updateAgentModelRequestSchema: z.ZodObject<{
47
60
  type UpdateAgentModelRequest = z.infer<typeof updateAgentModelRequestSchema>;
48
61
  declare const updateAgentModelSuccessResponseSchema: z.ZodObject<{
49
62
  success: z.ZodLiteral<true>;
50
- organizationName: z.ZodOptional<z.ZodString>;
51
- repository: z.ZodOptional<z.ZodString>;
52
- branch: z.ZodOptional<z.ZodString>;
53
- commitHash: z.ZodOptional<z.ZodString>;
54
- model: z.ZodOptional<z.ZodEnum<{
63
+ organizationName: z.ZodString;
64
+ repository: z.ZodString;
65
+ branch: z.ZodString;
66
+ commitHash: z.ZodString;
67
+ model: z.ZodEnum<{
55
68
  [x: string]: string;
56
- }>>;
57
- providerTemplate: z.ZodOptional<z.ZodString>;
58
- templateSynced: z.ZodOptional<z.ZodBoolean>;
59
- files: z.ZodOptional<z.ZodArray<z.ZodString>>;
60
- deletedFiles: z.ZodOptional<z.ZodArray<z.ZodString>>;
69
+ }>;
70
+ providerTemplate: z.ZodString;
71
+ templateSynced: z.ZodBoolean;
72
+ files: z.ZodArray<z.ZodString>;
73
+ deletedFiles: z.ZodArray<z.ZodString>;
61
74
  }, z.core.$strip>;
62
75
  declare const updateAgentModelErrorResponseSchema: z.ZodObject<{
63
76
  success: z.ZodLiteral<false>;
@@ -65,17 +78,17 @@ declare const updateAgentModelErrorResponseSchema: z.ZodObject<{
65
78
  }, z.core.$strip>;
66
79
  declare const updateAgentModelResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
67
80
  success: z.ZodLiteral<true>;
68
- organizationName: z.ZodOptional<z.ZodString>;
69
- repository: z.ZodOptional<z.ZodString>;
70
- branch: z.ZodOptional<z.ZodString>;
71
- commitHash: z.ZodOptional<z.ZodString>;
72
- model: z.ZodOptional<z.ZodEnum<{
81
+ organizationName: z.ZodString;
82
+ repository: z.ZodString;
83
+ branch: z.ZodString;
84
+ commitHash: z.ZodString;
85
+ model: z.ZodEnum<{
73
86
  [x: string]: string;
74
- }>>;
75
- providerTemplate: z.ZodOptional<z.ZodString>;
76
- templateSynced: z.ZodOptional<z.ZodBoolean>;
77
- files: z.ZodOptional<z.ZodArray<z.ZodString>>;
78
- deletedFiles: z.ZodOptional<z.ZodArray<z.ZodString>>;
87
+ }>;
88
+ providerTemplate: z.ZodString;
89
+ templateSynced: z.ZodBoolean;
90
+ files: z.ZodArray<z.ZodString>;
91
+ deletedFiles: z.ZodArray<z.ZodString>;
79
92
  }, z.core.$strip>, z.ZodObject<{
80
93
  success: z.ZodLiteral<false>;
81
94
  error: z.ZodString;
@@ -367,6 +380,142 @@ declare const sessionStreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
367
380
  }, z.core.$strip>], "kind">;
368
381
  type SessionStreamEvent = z.infer<typeof sessionStreamEventSchema>;
369
382
  declare const SESSION_STREAM_EVENT_KINDS: Set<string>;
383
+ declare const cancelSessionResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
384
+ success: z.ZodLiteral<true>;
385
+ message: z.ZodString;
386
+ }, z.core.$strip>, z.ZodObject<{
387
+ success: z.ZodLiteral<false>;
388
+ error: z.ZodString;
389
+ }, z.core.$strip>], "success">;
390
+ type CancelSessionResponse = z.infer<typeof cancelSessionResponseSchema>;
391
+
392
+ declare const sessionWebhookEventTypeSchema: z.ZodEnum<{
393
+ "session.started": "session.started";
394
+ "session.completed": "session.completed";
395
+ "session.failed": "session.failed";
396
+ "session.cancelled": "session.cancelled";
397
+ "session.waiting_messages": "session.waiting_messages";
398
+ "subagent.started": "subagent.started";
399
+ "subagent.completed": "subagent.completed";
400
+ }>;
401
+ type SessionWebhookEventType = z.infer<typeof sessionWebhookEventTypeSchema>;
402
+ declare const SESSION_WEBHOOK_DEFAULT_EVENTS: SessionWebhookEventType[];
403
+ declare function isBlockedWebhookHostname(hostname: string): boolean;
404
+ declare function validateWebhookUrl(value: string): string | null;
405
+ declare const sessionWebhookConfigSchema: z.ZodObject<{
406
+ url: z.ZodString;
407
+ events: z.ZodOptional<z.ZodArray<z.ZodEnum<{
408
+ "session.started": "session.started";
409
+ "session.completed": "session.completed";
410
+ "session.failed": "session.failed";
411
+ "session.cancelled": "session.cancelled";
412
+ "session.waiting_messages": "session.waiting_messages";
413
+ "subagent.started": "subagent.started";
414
+ "subagent.completed": "subagent.completed";
415
+ }>>>;
416
+ secret: z.ZodOptional<z.ZodString>;
417
+ }, z.core.$strict>;
418
+ type SessionWebhookConfig = z.infer<typeof sessionWebhookConfigSchema>;
419
+ declare const sessionWebhooksSchema: z.ZodArray<z.ZodObject<{
420
+ url: z.ZodString;
421
+ events: z.ZodOptional<z.ZodArray<z.ZodEnum<{
422
+ "session.started": "session.started";
423
+ "session.completed": "session.completed";
424
+ "session.failed": "session.failed";
425
+ "session.cancelled": "session.cancelled";
426
+ "session.waiting_messages": "session.waiting_messages";
427
+ "subagent.started": "subagent.started";
428
+ "subagent.completed": "subagent.completed";
429
+ }>>>;
430
+ secret: z.ZodOptional<z.ZodString>;
431
+ }, z.core.$strict>>;
432
+ declare const sessionWebhookUsageSchema: z.ZodObject<{
433
+ inputTokens: z.ZodOptional<z.ZodNumber>;
434
+ outputTokens: z.ZodOptional<z.ZodNumber>;
435
+ cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
436
+ cacheCreationInputTokens: z.ZodOptional<z.ZodNumber>;
437
+ totalCostUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
438
+ durationMs: z.ZodOptional<z.ZodNumber>;
439
+ numTurns: z.ZodOptional<z.ZodNumber>;
440
+ }, z.core.$strict>;
441
+ type SessionWebhookUsage = z.infer<typeof sessionWebhookUsageSchema>;
442
+ declare const sessionWebhookSubagentSchema: z.ZodObject<{
443
+ callId: z.ZodString;
444
+ subagentType: z.ZodOptional<z.ZodString>;
445
+ status: z.ZodOptional<z.ZodEnum<{
446
+ success: "success";
447
+ failed: "failed";
448
+ }>>;
449
+ durationMs: z.ZodOptional<z.ZodNumber>;
450
+ }, z.core.$strict>;
451
+ type SessionWebhookSubagent = z.infer<typeof sessionWebhookSubagentSchema>;
452
+ declare const sessionWebhookEventPayloadSchema: z.ZodObject<{
453
+ eventType: z.ZodEnum<{
454
+ "session.started": "session.started";
455
+ "session.completed": "session.completed";
456
+ "session.failed": "session.failed";
457
+ "session.cancelled": "session.cancelled";
458
+ "session.waiting_messages": "session.waiting_messages";
459
+ "subagent.started": "subagent.started";
460
+ "subagent.completed": "subagent.completed";
461
+ }>;
462
+ sessionId: z.ZodString;
463
+ workspaceId: z.ZodOptional<z.ZodString>;
464
+ runId: z.ZodOptional<z.ZodString>;
465
+ status: z.ZodString;
466
+ error: z.ZodOptional<z.ZodString>;
467
+ usage: z.ZodOptional<z.ZodObject<{
468
+ inputTokens: z.ZodOptional<z.ZodNumber>;
469
+ outputTokens: z.ZodOptional<z.ZodNumber>;
470
+ cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
471
+ cacheCreationInputTokens: z.ZodOptional<z.ZodNumber>;
472
+ totalCostUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
473
+ durationMs: z.ZodOptional<z.ZodNumber>;
474
+ numTurns: z.ZodOptional<z.ZodNumber>;
475
+ }, z.core.$strict>>;
476
+ subagent: z.ZodOptional<z.ZodObject<{
477
+ callId: z.ZodString;
478
+ subagentType: z.ZodOptional<z.ZodString>;
479
+ status: z.ZodOptional<z.ZodEnum<{
480
+ success: "success";
481
+ failed: "failed";
482
+ }>>;
483
+ durationMs: z.ZodOptional<z.ZodNumber>;
484
+ }, z.core.$strict>>;
485
+ timestamp: z.ZodString;
486
+ apiVersion: z.ZodLiteral<"v4">;
487
+ deliveryId: z.ZodString;
488
+ }, z.core.$strip>;
489
+ type SessionWebhookEventPayload = z.infer<typeof sessionWebhookEventPayloadSchema>;
490
+ declare const sessionAgentEventSchema: z.ZodObject<{
491
+ type: z.ZodEnum<{
492
+ "subagent.started": "subagent.started";
493
+ "subagent.completed": "subagent.completed";
494
+ }>;
495
+ callId: z.ZodString;
496
+ subagentType: z.ZodOptional<z.ZodString>;
497
+ status: z.ZodOptional<z.ZodEnum<{
498
+ success: "success";
499
+ failed: "failed";
500
+ }>>;
501
+ durationMs: z.ZodOptional<z.ZodNumber>;
502
+ timestamp: z.ZodNumber;
503
+ }, z.core.$strict>;
504
+ type SessionAgentEvent = z.infer<typeof sessionAgentEventSchema>;
505
+ declare const sessionAgentEventsSchema: z.ZodArray<z.ZodObject<{
506
+ type: z.ZodEnum<{
507
+ "subagent.started": "subagent.started";
508
+ "subagent.completed": "subagent.completed";
509
+ }>;
510
+ callId: z.ZodString;
511
+ subagentType: z.ZodOptional<z.ZodString>;
512
+ status: z.ZodOptional<z.ZodEnum<{
513
+ success: "success";
514
+ failed: "failed";
515
+ }>>;
516
+ durationMs: z.ZodOptional<z.ZodNumber>;
517
+ timestamp: z.ZodNumber;
518
+ }, z.core.$strict>>;
370
519
 
371
- export { sessionTimelineResponseSchema as B, sessionStreamEventSchema as C, SESSION_STREAM_EVENT_KINDS as D, agentInputSchema as j, executeAgentRequestSchema as k, executeAgentSuccessResponseSchema as l, executeAgentErrorResponseSchema as m, executeAgentResponseSchema as n, updateAgentModelSuccessResponseSchema as o, updateAgentModelErrorResponseSchema as p, updateAgentModelResponseSchema as q, sessionTimelineIdSchema as r, sessionStatusSchema as s, timelineMetricsSchema as t, updateAgentModelRequestSchema as u, timelinePromptSchema as v, timelineToolResultSchema as w, timelineRunTurnMetricsSchema as x, timelineEventSchema as y, timelineSpanSchema as z };
372
- export type { AgentInput as A, ExecuteAgentRequest as E, SessionTimelineResponse as S, TimelineEvent as T, UpdateAgentModelRequest as U, ExecuteAgentResponse as a, UpdateAgentModelResponse as b, SessionStreamEvent as c, SessionStatus as d, TimelineMetrics as e, TimelinePrompt as f, TimelineRunTurnMetrics as g, TimelineSpan as h, TimelineToolResult as i };
520
+ export { timelinePromptSchema as B, timelineToolResultSchema as D, timelineRunTurnMetricsSchema as F, timelineEventSchema as G, timelineSpanSchema as H, sessionTimelineResponseSchema as I, sessionStreamEventSchema as J, SESSION_STREAM_EVENT_KINDS as K, cancelSessionResponseSchema as L, sessionWebhookEventTypeSchema as M, SESSION_WEBHOOK_DEFAULT_EVENTS as N, isBlockedWebhookHostname as O, validateWebhookUrl as P, sessionWebhookConfigSchema as Q, sessionWebhooksSchema as R, sessionWebhookUsageSchema as V, sessionWebhookSubagentSchema as W, sessionWebhookEventPayloadSchema as X, sessionAgentEventSchema as Y, sessionAgentEventsSchema as _, agentInputSchema as o, executeAgentRequestSchema as p, executeAgentSuccessResponseSchema as q, executeAgentErrorResponseSchema as r, executeAgentResponseSchema as s, updateAgentModelSuccessResponseSchema as t, updateAgentModelRequestSchema as u, updateAgentModelErrorResponseSchema as v, updateAgentModelResponseSchema as w, sessionStatusSchema as x, sessionTimelineIdSchema as y, timelineMetricsSchema as z };
521
+ export type { AgentInput as A, CancelSessionResponse as C, ExecuteAgentRequest as E, SessionTimelineResponse as S, TimelineEvent as T, UpdateAgentModelRequest as U, SessionAgentEvent as Z, ExecuteAgentResponse as a, UpdateAgentModelResponse as b, SessionStreamEvent as c, SessionStatus as d, SessionWebhookConfig as e, SessionWebhookEventPayload as f, SessionWebhookEventType as g, SessionWebhookSubagent as h, SessionWebhookUsage as i, TimelineMetrics as j, TimelinePrompt as k, TimelineRunTurnMetrics as l, TimelineSpan as m, TimelineToolResult as n };