@meistrari/agent-sdk 0.3.1 → 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/README.md +82 -4
- package/dist/index.cjs +52 -1
- package/dist/index.d.cts +6 -3
- package/dist/index.d.mts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.mjs +53 -3
- package/dist/schemas.cjs +131 -1
- package/dist/schemas.d.cts +3 -2
- package/dist/schemas.d.mts +3 -2
- package/dist/schemas.d.ts +3 -2
- package/dist/schemas.mjs +120 -2
- package/dist/shared/{agent-sdk.3fcc7aba.d.cts → agent-sdk.dc5630ec.d.cts} +153 -4
- package/dist/shared/{agent-sdk.3fcc7aba.d.mts → agent-sdk.dc5630ec.d.mts} +153 -4
- package/dist/shared/{agent-sdk.3fcc7aba.d.ts → agent-sdk.dc5630ec.d.ts} +153 -4
- package/package.json +1 -1
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) {
|
|
@@ -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<{
|
|
@@ -150,9 +163,9 @@ declare const timelineEventSchema: z.ZodObject<{
|
|
|
150
163
|
other: "other";
|
|
151
164
|
}>>;
|
|
152
165
|
status: z.ZodOptional<z.ZodEnum<{
|
|
166
|
+
success: "success";
|
|
153
167
|
failed: "failed";
|
|
154
168
|
cancelled: "cancelled";
|
|
155
|
-
success: "success";
|
|
156
169
|
timeout: "timeout";
|
|
157
170
|
}>>;
|
|
158
171
|
result: z.ZodOptional<z.ZodObject<{
|
|
@@ -341,9 +354,9 @@ declare const sessionStreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
341
354
|
other: "other";
|
|
342
355
|
}>>;
|
|
343
356
|
status: z.ZodOptional<z.ZodEnum<{
|
|
357
|
+
success: "success";
|
|
344
358
|
failed: "failed";
|
|
345
359
|
cancelled: "cancelled";
|
|
346
|
-
success: "success";
|
|
347
360
|
timeout: "timeout";
|
|
348
361
|
}>>;
|
|
349
362
|
result: z.ZodOptional<z.ZodObject<{
|
|
@@ -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 {
|
|
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,
|
|
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<{
|
|
@@ -150,9 +163,9 @@ declare const timelineEventSchema: z.ZodObject<{
|
|
|
150
163
|
other: "other";
|
|
151
164
|
}>>;
|
|
152
165
|
status: z.ZodOptional<z.ZodEnum<{
|
|
166
|
+
success: "success";
|
|
153
167
|
failed: "failed";
|
|
154
168
|
cancelled: "cancelled";
|
|
155
|
-
success: "success";
|
|
156
169
|
timeout: "timeout";
|
|
157
170
|
}>>;
|
|
158
171
|
result: z.ZodOptional<z.ZodObject<{
|
|
@@ -341,9 +354,9 @@ declare const sessionStreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
341
354
|
other: "other";
|
|
342
355
|
}>>;
|
|
343
356
|
status: z.ZodOptional<z.ZodEnum<{
|
|
357
|
+
success: "success";
|
|
344
358
|
failed: "failed";
|
|
345
359
|
cancelled: "cancelled";
|
|
346
|
-
success: "success";
|
|
347
360
|
timeout: "timeout";
|
|
348
361
|
}>>;
|
|
349
362
|
result: z.ZodOptional<z.ZodObject<{
|
|
@@ -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 {
|
|
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,
|
|
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 };
|