skedyul 1.5.2 → 1.5.12

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.
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
 
3
3
  // src/index.ts
4
- import { z as z15 } from "zod/v4";
4
+ import { z as z16 } from "zod/v4";
5
5
 
6
6
  // src/types/invocation.ts
7
7
  function createToolCallContext(params) {
@@ -56,12 +56,118 @@ function isCronContext(ctx) {
56
56
  return ctx.trigger === "cron";
57
57
  }
58
58
 
59
- // src/types/tool.ts
59
+ // src/types/estimation.ts
60
60
  import { z } from "zod/v4";
61
- var ToolResponseMetaSchema = z.object({
62
- success: z.boolean(),
63
- message: z.string(),
64
- toolName: z.string()
61
+ var MoneyMinorRangeSchema = z.object({
62
+ currency: z.string().min(3).max(3),
63
+ minorUnitsLow: z.number().int().nonnegative(),
64
+ minorUnitsHigh: z.number().int().nonnegative(),
65
+ minorUnitsExpected: z.number().int().nonnegative().optional()
66
+ });
67
+ var EstimationSkippedBreakdownSchema = z.object({
68
+ missingAddress: z.number().int().nonnegative(),
69
+ optOut: z.number().int().nonnegative(),
70
+ emptyMessage: z.number().int().nonnegative(),
71
+ unavailable: z.number().int().nonnegative()
72
+ });
73
+ var EstimationSchema = z.object({
74
+ deliverableCount: z.number().int().nonnegative(),
75
+ skippedCount: z.number().int().nonnegative().optional(),
76
+ skippedBreakdown: EstimationSkippedBreakdownSchema.optional(),
77
+ cost: MoneyMinorRangeSchema.optional()
78
+ });
79
+ function createMoneyMinorRange(params) {
80
+ return {
81
+ currency: params.currency,
82
+ minorUnitsLow: params.minorUnitsLow,
83
+ minorUnitsHigh: params.minorUnitsHigh,
84
+ ...params.minorUnitsExpected !== void 0 ? { minorUnitsExpected: params.minorUnitsExpected } : {}
85
+ };
86
+ }
87
+ function createEstimation(params) {
88
+ return {
89
+ deliverableCount: params.deliverableCount,
90
+ ...params.skippedCount !== void 0 ? { skippedCount: params.skippedCount } : {},
91
+ ...params.skippedBreakdown ? { skippedBreakdown: params.skippedBreakdown } : {},
92
+ ...params.cost ? { cost: params.cost } : {}
93
+ };
94
+ }
95
+ function computeSkewedExpectedMinorUnits(range) {
96
+ if (range.minorUnitsExpected !== void 0) {
97
+ return range.minorUnitsExpected;
98
+ }
99
+ if (range.minorUnitsLow === range.minorUnitsHigh) {
100
+ return range.minorUnitsLow;
101
+ }
102
+ return Math.round(0.8 * range.minorUnitsLow + 0.2 * range.minorUnitsHigh);
103
+ }
104
+ function formatMoneyMinorRange(range, locale) {
105
+ const formatter = new Intl.NumberFormat(locale, {
106
+ style: "currency",
107
+ currency: range.currency
108
+ });
109
+ const low = formatter.format(range.minorUnitsLow / 100);
110
+ const high = formatter.format(range.minorUnitsHigh / 100);
111
+ if (range.minorUnitsLow === range.minorUnitsHigh) {
112
+ return low;
113
+ }
114
+ return `${low} \u2013 ${high}`;
115
+ }
116
+ function formatMoneyMinorEstimate(range, options) {
117
+ const formatter = new Intl.NumberFormat(options?.locale, {
118
+ style: "currency",
119
+ currency: range.currency
120
+ });
121
+ const maxSpreadRatio = options?.maxSpreadRatio ?? 4;
122
+ const spreadRatio = range.minorUnitsLow > 0 ? range.minorUnitsHigh / range.minorUnitsLow : 1;
123
+ if (spreadRatio > maxSpreadRatio) {
124
+ return formatMoneyMinorRange(range, options?.locale);
125
+ }
126
+ const expectedMinorUnits = options?.expectedMinorUnits ?? computeSkewedExpectedMinorUnits(range);
127
+ const expected = formatter.format(expectedMinorUnits / 100);
128
+ if (range.minorUnitsLow === range.minorUnitsHigh) {
129
+ return expected;
130
+ }
131
+ return `~${expected}`;
132
+ }
133
+ function parseEstimationFromBilling(billing) {
134
+ if (!billing || typeof billing !== "object") {
135
+ return void 0;
136
+ }
137
+ const record2 = billing;
138
+ const nested = record2.estimation;
139
+ if (nested && typeof nested === "object") {
140
+ const parsed = EstimationSchema.safeParse(nested);
141
+ if (parsed.success) {
142
+ return parsed.data;
143
+ }
144
+ }
145
+ const currency = typeof record2.currency === "string" && record2.currency.trim() !== "" ? record2.currency : void 0;
146
+ const minorUnitsLow = typeof record2.minorUnitsLow === "number" ? record2.minorUnitsLow : typeof record2.costCentsLow === "number" ? record2.costCentsLow : void 0;
147
+ const minorUnitsHigh = typeof record2.minorUnitsHigh === "number" ? record2.minorUnitsHigh : typeof record2.costCentsHigh === "number" ? record2.costCentsHigh : void 0;
148
+ const minorUnitsExpected = typeof record2.minorUnitsExpected === "number" ? record2.minorUnitsExpected : typeof record2.costCentsExpected === "number" ? record2.costCentsExpected : void 0;
149
+ const deliverableCount = typeof record2.deliverableCount === "number" ? record2.deliverableCount : void 0;
150
+ if (deliverableCount === void 0 || minorUnitsLow === void 0 || minorUnitsHigh === void 0 || !currency) {
151
+ return void 0;
152
+ }
153
+ return createEstimation({
154
+ deliverableCount,
155
+ skippedCount: typeof record2.skippedCount === "number" ? record2.skippedCount : void 0,
156
+ cost: createMoneyMinorRange({
157
+ currency,
158
+ minorUnitsLow,
159
+ minorUnitsHigh,
160
+ ...minorUnitsExpected !== void 0 ? { minorUnitsExpected } : {}
161
+ })
162
+ });
163
+ }
164
+
165
+ // src/types/tool.ts
166
+ import { z as z2 } from "zod/v4";
167
+ var ToolResponseMetaSchema = z2.object({
168
+ success: z2.boolean(),
169
+ message: z2.string(),
170
+ toolName: z2.string()
65
171
  });
66
172
 
67
173
  // src/types/tool-response.ts
@@ -202,11 +308,11 @@ function isRuntimeWebhookContext(ctx) {
202
308
  }
203
309
 
204
310
  // src/schemas.ts
205
- import { z as z7 } from "zod/v4";
311
+ import { z as z8 } from "zod/v4";
206
312
 
207
313
  // src/schemas/crm-schema.ts
208
- import { z as z2 } from "zod/v4";
209
- var CRMFieldTypeSchema = z2.enum([
314
+ import { z as z3 } from "zod/v4";
315
+ var CRMFieldTypeSchema = z3.enum([
210
316
  "string",
211
317
  "long_string",
212
318
  "number",
@@ -218,125 +324,125 @@ var CRMFieldTypeSchema = z2.enum([
218
324
  "image",
219
325
  "object"
220
326
  ]);
221
- var CRMFieldRequirementSchema = z2.enum([
327
+ var CRMFieldRequirementSchema = z3.enum([
222
328
  "optional",
223
329
  "on_create",
224
330
  "required"
225
331
  ]);
226
- var CRMFieldOptionSchema = z2.object({
227
- label: z2.string(),
228
- value: z2.string(),
229
- color: z2.string().optional()
230
- });
231
- var CRMFieldDefinitionObjectSchema = z2.object({
232
- options: z2.array(CRMFieldOptionSchema).optional(),
233
- limitChoices: z2.number().optional(),
234
- minLength: z2.number().optional(),
235
- maxLength: z2.number().optional(),
236
- min: z2.number().optional(),
237
- max: z2.number().optional(),
238
- pattern: z2.string().optional()
239
- });
240
- var CRMFieldDefinitionSchema = z2.union([
241
- z2.string(),
332
+ var CRMFieldOptionSchema = z3.object({
333
+ label: z3.string(),
334
+ value: z3.string(),
335
+ color: z3.string().optional()
336
+ });
337
+ var CRMFieldDefinitionObjectSchema = z3.object({
338
+ options: z3.array(CRMFieldOptionSchema).optional(),
339
+ limitChoices: z3.number().optional(),
340
+ minLength: z3.number().optional(),
341
+ maxLength: z3.number().optional(),
342
+ min: z3.number().optional(),
343
+ max: z3.number().optional(),
344
+ pattern: z3.string().optional()
345
+ });
346
+ var CRMFieldDefinitionSchema = z3.union([
347
+ z3.string(),
242
348
  CRMFieldDefinitionObjectSchema
243
349
  ]);
244
- var CRMFieldAppearanceSchemaZ = z2.object({
245
- leftIcon: z2.string().optional(),
246
- rightIcon: z2.string().optional(),
247
- placeholder: z2.string().optional(),
248
- helpText: z2.string().optional()
249
- });
250
- var CRMFieldSchemaZ = z2.object({
251
- handle: z2.string().regex(/^[a-z][a-z0-9_]*$/, "Handle must be lowercase alphanumeric with underscores, starting with a letter"),
252
- label: z2.string().min(1, "Label is required"),
350
+ var CRMFieldAppearanceSchemaZ = z3.object({
351
+ leftIcon: z3.string().optional(),
352
+ rightIcon: z3.string().optional(),
353
+ placeholder: z3.string().optional(),
354
+ helpText: z3.string().optional()
355
+ });
356
+ var CRMFieldSchemaZ = z3.object({
357
+ handle: z3.string().regex(/^[a-z][a-z0-9_]*$/, "Handle must be lowercase alphanumeric with underscores, starting with a letter"),
358
+ label: z3.string().min(1, "Label is required"),
253
359
  type: CRMFieldTypeSchema,
254
360
  /** Field description - explains what the field is for (metadata, not UI) */
255
- description: z2.string().optional(),
361
+ description: z3.string().optional(),
256
362
  /** Field appearance - UI presentation settings */
257
363
  appearance: CRMFieldAppearanceSchemaZ.optional(),
258
364
  requirement: CRMFieldRequirementSchema.optional(),
259
- unique: z2.boolean().optional(),
260
- list: z2.boolean().optional(),
261
- default: z2.unknown().optional(),
365
+ unique: z3.boolean().optional(),
366
+ list: z3.boolean().optional(),
367
+ default: z3.unknown().optional(),
262
368
  definition: CRMFieldDefinitionSchema.optional()
263
369
  });
264
- var CRMModelSchemaZ = z2.object({
265
- handle: z2.string().regex(/^[a-z][a-z0-9_]*$/, "Handle must be lowercase alphanumeric with underscores, starting with a letter"),
266
- name: z2.string().min(1, "Name is required"),
267
- namePlural: z2.string().optional(),
268
- labelTemplate: z2.string().optional(),
269
- description: z2.string().optional(),
270
- icon: z2.string().optional(),
271
- fields: z2.array(CRMFieldSchemaZ)
272
- });
273
- var CRMCardinalitySchema = z2.enum(["one_to_one", "one_to_many"]);
274
- var CRMOnDeleteSchema = z2.enum(["none", "cascade", "restrict"]);
275
- var CRMRelationshipLinkSchema = z2.object({
276
- model: z2.string(),
277
- field: z2.string(),
278
- label: z2.string()
279
- });
280
- var CRMRelationshipSchemaZ = z2.object({
370
+ var CRMModelSchemaZ = z3.object({
371
+ handle: z3.string().regex(/^[a-z][a-z0-9_]*$/, "Handle must be lowercase alphanumeric with underscores, starting with a letter"),
372
+ name: z3.string().min(1, "Name is required"),
373
+ namePlural: z3.string().optional(),
374
+ labelTemplate: z3.string().optional(),
375
+ description: z3.string().optional(),
376
+ icon: z3.string().optional(),
377
+ fields: z3.array(CRMFieldSchemaZ)
378
+ });
379
+ var CRMCardinalitySchema = z3.enum(["one_to_one", "one_to_many"]);
380
+ var CRMOnDeleteSchema = z3.enum(["none", "cascade", "restrict"]);
381
+ var CRMRelationshipLinkSchema = z3.object({
382
+ model: z3.string(),
383
+ field: z3.string(),
384
+ label: z3.string()
385
+ });
386
+ var CRMRelationshipSchemaZ = z3.object({
281
387
  source: CRMRelationshipLinkSchema,
282
388
  target: CRMRelationshipLinkSchema,
283
389
  cardinality: CRMCardinalitySchema,
284
390
  onDelete: CRMOnDeleteSchema.optional()
285
391
  });
286
- var CRMBlockTypeSchema = z2.enum([
392
+ var CRMBlockTypeSchema = z3.enum([
287
393
  "spreadsheet",
288
394
  "form",
289
395
  "card",
290
396
  "metric",
291
397
  "kanban"
292
398
  ]);
293
- var CRMBlockSchemaZ = z2.object({
399
+ var CRMBlockSchemaZ = z3.object({
294
400
  type: CRMBlockTypeSchema,
295
- title: z2.string().optional(),
296
- config: z2.unknown().optional(),
297
- default: z2.boolean().optional()
401
+ title: z3.string().optional(),
402
+ config: z3.unknown().optional(),
403
+ default: z3.boolean().optional()
298
404
  });
299
- var CRMPageTypeSchema = z2.enum(["list", "instance"]);
300
- var CRMPageSchemaZ = z2.object({
301
- path: z2.string(),
405
+ var CRMPageTypeSchema = z3.enum(["list", "instance"]);
406
+ var CRMPageSchemaZ = z3.object({
407
+ path: z3.string(),
302
408
  type: CRMPageTypeSchema,
303
- title: z2.string(),
304
- icon: z2.string().optional(),
305
- modelHandle: z2.string(),
306
- parentPath: z2.string().optional(),
307
- baseQuery: z2.unknown().optional(),
308
- blocks: z2.array(CRMBlockSchemaZ).optional()
309
- });
310
- var CRMNavigationNodeBaseSchemaZ = z2.object({
311
- label: z2.string(),
312
- icon: z2.string().optional(),
313
- path: z2.string().optional(),
314
- kind: z2.enum(["section", "group"]).optional(),
315
- sortIndex: z2.number().optional()
316
- });
317
- var CRMNavigationItemSchemaZ = z2.lazy(
409
+ title: z3.string(),
410
+ icon: z3.string().optional(),
411
+ modelHandle: z3.string(),
412
+ parentPath: z3.string().optional(),
413
+ baseQuery: z3.unknown().optional(),
414
+ blocks: z3.array(CRMBlockSchemaZ).optional()
415
+ });
416
+ var CRMNavigationNodeBaseSchemaZ = z3.object({
417
+ label: z3.string(),
418
+ icon: z3.string().optional(),
419
+ path: z3.string().optional(),
420
+ kind: z3.enum(["section", "group"]).optional(),
421
+ sortIndex: z3.number().optional()
422
+ });
423
+ var CRMNavigationItemSchemaZ = z3.lazy(
318
424
  () => CRMNavigationNodeBaseSchemaZ.extend({
319
- children: z2.array(CRMNavigationItemSchemaZ).optional()
425
+ children: z3.array(CRMNavigationItemSchemaZ).optional()
320
426
  })
321
427
  );
322
- var CRMNavigationSchemaZ = z2.object({
323
- sidebar: z2.array(CRMNavigationItemSchemaZ).optional()
428
+ var CRMNavigationSchemaZ = z3.object({
429
+ sidebar: z3.array(CRMNavigationItemSchemaZ).optional()
324
430
  });
325
- var CRMSchemaZ = z2.object({
431
+ var CRMSchemaZ = z3.object({
326
432
  /** Schema format version for future compatibility */
327
- $schema: z2.literal("https://skedyul.com/schemas/crm/v1").optional(),
433
+ $schema: z3.literal("https://skedyul.com/schemas/crm/v1").optional(),
328
434
  /** Schema name for identification */
329
- name: z2.string().min(1, "Name is required"),
435
+ name: z3.string().min(1, "Name is required"),
330
436
  /** Optional description */
331
- description: z2.string().optional(),
437
+ description: z3.string().optional(),
332
438
  /** Schema version (semver) */
333
- version: z2.string().optional(),
439
+ version: z3.string().optional(),
334
440
  /** Model definitions */
335
- models: z2.array(CRMModelSchemaZ),
441
+ models: z3.array(CRMModelSchemaZ),
336
442
  /** Relationship definitions */
337
- relationships: z2.array(CRMRelationshipSchemaZ).optional(),
443
+ relationships: z3.array(CRMRelationshipSchemaZ).optional(),
338
444
  /** Page definitions */
339
- pages: z2.array(CRMPageSchemaZ).optional(),
445
+ pages: z3.array(CRMPageSchemaZ).optional(),
340
446
  /** Navigation definitions */
341
447
  navigation: CRMNavigationSchemaZ.optional()
342
448
  });
@@ -363,11 +469,11 @@ function safeParseCRMSchema(data) {
363
469
  }
364
470
 
365
471
  // src/schemas/agent-schema-v3.ts
366
- import { z as z6 } from "zod/v4";
472
+ import { z as z7 } from "zod/v4";
367
473
 
368
474
  // src/events/types.ts
369
- import { z as z3 } from "zod/v4";
370
- var ThreadEventTypeSchema = z3.enum([
475
+ import { z as z4 } from "zod/v4";
476
+ var ThreadEventTypeSchema = z4.enum([
371
477
  // Message events
372
478
  "thread.message.received",
373
479
  "thread.message.sent",
@@ -389,73 +495,73 @@ var ThreadEventTypeSchema = z3.enum([
389
495
  // Signal events
390
496
  "thread.signal.created"
391
497
  ]);
392
- var CustomEventTypeSchema = z3.string().regex(/^custom\.[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)*$/, {
498
+ var CustomEventTypeSchema = z4.string().regex(/^custom\.[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)*$/, {
393
499
  message: "Custom event type must match pattern: custom.{namespace}.{event}"
394
500
  });
395
- var EventTypeSchema = z3.union([ThreadEventTypeSchema, CustomEventTypeSchema]);
396
- var ParticipantKindSchema = z3.enum(["CONTACT", "MEMBER", "AGENT", "WORKFLOW"]);
397
- var BaseEventPayloadSchema = z3.object({
398
- threadId: z3.string(),
399
- workplaceId: z3.string(),
400
- timestamp: z3.string().datetime().optional()
501
+ var EventTypeSchema = z4.union([ThreadEventTypeSchema, CustomEventTypeSchema]);
502
+ var ParticipantKindSchema = z4.enum(["CONTACT", "MEMBER", "AGENT", "WORKFLOW"]);
503
+ var BaseEventPayloadSchema = z4.object({
504
+ threadId: z4.string(),
505
+ workplaceId: z4.string(),
506
+ timestamp: z4.string().datetime().optional()
401
507
  });
402
508
  var MessageEventPayloadSchema = BaseEventPayloadSchema.extend({
403
- message: z3.object({
404
- id: z3.string(),
405
- content: z3.string(),
406
- senderId: z3.string().optional()
509
+ message: z4.object({
510
+ id: z4.string(),
511
+ content: z4.string(),
512
+ senderId: z4.string().optional()
407
513
  }),
408
- participant: z3.object({
409
- id: z3.string(),
514
+ participant: z4.object({
515
+ id: z4.string(),
410
516
  kind: ParticipantKindSchema,
411
- displayName: z3.string().optional()
517
+ displayName: z4.string().optional()
412
518
  }).optional(),
413
- isFirstMessage: z3.boolean().optional(),
414
- messageCount: z3.number().optional()
519
+ isFirstMessage: z4.boolean().optional(),
520
+ messageCount: z4.number().optional()
415
521
  });
416
522
  var ParticipantEventPayloadSchema = BaseEventPayloadSchema.extend({
417
- participant: z3.object({
418
- id: z3.string(),
523
+ participant: z4.object({
524
+ id: z4.string(),
419
525
  kind: ParticipantKindSchema,
420
- displayName: z3.string().optional(),
421
- contactId: z3.string().optional(),
422
- memberId: z3.string().optional(),
423
- agentId: z3.string().optional(),
424
- workflowId: z3.string().optional()
526
+ displayName: z4.string().optional(),
527
+ contactId: z4.string().optional(),
528
+ memberId: z4.string().optional(),
529
+ agentId: z4.string().optional(),
530
+ workflowId: z4.string().optional()
425
531
  })
426
532
  });
427
533
  var ContextChangedPayloadSchema = BaseEventPayloadSchema.extend({
428
- context: z3.object({
429
- handle: z3.string(),
430
- model: z3.string(),
431
- instanceId: z3.string()
534
+ context: z4.object({
535
+ handle: z4.string(),
536
+ model: z4.string(),
537
+ instanceId: z4.string()
432
538
  }),
433
- change: z3.object({
434
- field: z3.string().optional(),
435
- oldValue: z3.unknown().optional(),
436
- newValue: z3.unknown().optional()
539
+ change: z4.object({
540
+ field: z4.string().optional(),
541
+ oldValue: z4.unknown().optional(),
542
+ newValue: z4.unknown().optional()
437
543
  }).optional()
438
544
  });
439
545
  var StatusChangedPayloadSchema = BaseEventPayloadSchema.extend({
440
- oldStatus: z3.string(),
441
- newStatus: z3.string()
546
+ oldStatus: z4.string(),
547
+ newStatus: z4.string()
442
548
  });
443
549
  var ScheduledEventPayloadSchema = BaseEventPayloadSchema.extend({
444
- scheduledEventId: z3.string(),
445
- reason: z3.string().optional(),
446
- context: z3.record(z3.string(), z3.unknown()).optional()
550
+ scheduledEventId: z4.string(),
551
+ reason: z4.string().optional(),
552
+ context: z4.record(z4.string(), z4.unknown()).optional()
447
553
  });
448
554
  var AgentWorkflowEventPayloadSchema = BaseEventPayloadSchema.extend({
449
- agentId: z3.string().optional(),
450
- workflowId: z3.string().optional(),
451
- workflowRunId: z3.string().optional(),
452
- outputs: z3.record(z3.string(), z3.unknown()).optional(),
453
- error: z3.string().optional()
555
+ agentId: z4.string().optional(),
556
+ workflowId: z4.string().optional(),
557
+ workflowRunId: z4.string().optional(),
558
+ outputs: z4.record(z4.string(), z4.unknown()).optional(),
559
+ error: z4.string().optional()
454
560
  });
455
561
  var CustomEventPayloadSchema = BaseEventPayloadSchema.extend({
456
- data: z3.record(z3.string(), z3.unknown()).optional()
562
+ data: z4.record(z4.string(), z4.unknown()).optional()
457
563
  });
458
- var ThreadEventPayloadSchema = z3.union([
564
+ var ThreadEventPayloadSchema = z4.union([
459
565
  MessageEventPayloadSchema,
460
566
  ParticipantEventPayloadSchema,
461
567
  ContextChangedPayloadSchema,
@@ -464,164 +570,164 @@ var ThreadEventPayloadSchema = z3.union([
464
570
  AgentWorkflowEventPayloadSchema,
465
571
  CustomEventPayloadSchema
466
572
  ]);
467
- var ThreadEventSchema = z3.object({
468
- id: z3.string(),
469
- threadId: z3.string(),
573
+ var ThreadEventSchema = z4.object({
574
+ id: z4.string(),
575
+ threadId: z4.string(),
470
576
  type: EventTypeSchema,
471
577
  payload: ThreadEventPayloadSchema,
472
- emittedBy: z3.string().optional(),
473
- createdAt: z3.string().datetime()
578
+ emittedBy: z4.string().optional(),
579
+ createdAt: z4.string().datetime()
474
580
  });
475
- var CreateThreadEventInputSchema = z3.object({
476
- threadId: z3.string(),
581
+ var CreateThreadEventInputSchema = z4.object({
582
+ threadId: z4.string(),
477
583
  type: EventTypeSchema,
478
- payload: z3.record(z3.string(), z3.unknown()),
479
- emittedBy: z3.string().optional()
584
+ payload: z4.record(z4.string(), z4.unknown()),
585
+ emittedBy: z4.string().optional()
480
586
  });
481
- var EventSubscriptionSchema = z3.object({
482
- subscribes: z3.array(EventTypeSchema),
483
- condition: z3.string().optional(),
484
- cancels: z3.array(EventTypeSchema).optional(),
485
- cancelCondition: z3.string().optional()
587
+ var EventSubscriptionSchema = z4.object({
588
+ subscribes: z4.array(EventTypeSchema),
589
+ condition: z4.string().optional(),
590
+ cancels: z4.array(EventTypeSchema).optional(),
591
+ cancelCondition: z4.string().optional()
486
592
  });
487
- var EventWaitSchema = z3.object({
593
+ var EventWaitSchema = z4.object({
488
594
  event: EventTypeSchema,
489
- timeout: z3.string().optional(),
490
- onTimeout: z3.string().optional()
595
+ timeout: z4.string().optional(),
596
+ onTimeout: z4.string().optional()
491
597
  });
492
- var EventsConfigSchema = z3.object({
493
- subscribes: z3.array(EventTypeSchema).optional(),
494
- condition: z3.string().optional(),
495
- emits: z3.array(EventTypeSchema).optional(),
496
- waits: z3.array(EventWaitSchema).optional(),
497
- cancels: z3.array(EventTypeSchema).optional(),
498
- cancelCondition: z3.string().optional()
598
+ var EventsConfigSchema = z4.object({
599
+ subscribes: z4.array(EventTypeSchema).optional(),
600
+ condition: z4.string().optional(),
601
+ emits: z4.array(EventTypeSchema).optional(),
602
+ waits: z4.array(EventWaitSchema).optional(),
603
+ cancels: z4.array(EventTypeSchema).optional(),
604
+ cancelCondition: z4.string().optional()
499
605
  });
500
606
 
501
607
  // src/skills/types.ts
502
- import { z as z4 } from "zod/v4";
608
+ import { z as z5 } from "zod/v4";
503
609
  var SKILL_SCHEMA_VERSION = "https://skedyul.com/schemas/skill/v1";
504
610
  var SKILL_SCHEMA_VERSION_V2 = "https://skedyul.com/schemas/skill/v2";
505
- var SkillSourceSchema = z4.enum(["BUILTIN", "S3", "APP", "EXTERNAL"]);
506
- var SkillToolRequirementSchema = z4.object({
507
- requires: z4.array(z4.string()).optional(),
508
- provides: z4.array(z4.string()).optional()
509
- });
510
- var SkillToolSandboxSchema = z4.object({
511
- mock: z4.unknown().optional()
512
- });
513
- var ToolConstraintsSchema = z4.object({
514
- maxCallsPerRun: z4.number().optional(),
515
- idempotent: z4.boolean().optional(),
516
- restricted: z4.boolean().optional(),
517
- tags: z4.array(z4.string()).optional()
518
- });
519
- var SkillToolDefinitionSchema = z4.object({
520
- tool: z4.string(),
521
- description: z4.string().optional(),
522
- overrides: z4.record(z4.string(), z4.unknown()).optional(),
611
+ var SkillSourceSchema = z5.enum(["BUILTIN", "S3", "APP", "EXTERNAL"]);
612
+ var SkillToolRequirementSchema = z5.object({
613
+ requires: z5.array(z5.string()).optional(),
614
+ provides: z5.array(z5.string()).optional()
615
+ });
616
+ var SkillToolSandboxSchema = z5.object({
617
+ mock: z5.unknown().optional()
618
+ });
619
+ var ToolConstraintsSchema = z5.object({
620
+ maxCallsPerRun: z5.number().optional(),
621
+ idempotent: z5.boolean().optional(),
622
+ restricted: z5.boolean().optional(),
623
+ tags: z5.array(z5.string()).optional()
624
+ });
625
+ var SkillToolDefinitionSchema = z5.object({
626
+ tool: z5.string(),
627
+ description: z5.string().optional(),
628
+ overrides: z5.record(z5.string(), z5.unknown()).optional(),
523
629
  sandbox: SkillToolSandboxSchema.optional(),
524
- requiresApproval: z4.boolean().optional(),
630
+ requiresApproval: z5.boolean().optional(),
525
631
  constraints: ToolConstraintsSchema.optional()
526
632
  });
527
- var SkillToolsSchema = z4.union([
633
+ var SkillToolsSchema = z5.union([
528
634
  SkillToolRequirementSchema,
529
- z4.array(SkillToolDefinitionSchema)
635
+ z5.array(SkillToolDefinitionSchema)
530
636
  ]);
531
- var SkillExampleSchema = z4.object({
532
- context: z4.string().optional(),
533
- input: z4.string(),
534
- reasoning: z4.string().optional(),
535
- output: z4.string(),
536
- tool_call: z4.string().optional()
637
+ var SkillExampleSchema = z5.object({
638
+ context: z5.string().optional(),
639
+ input: z5.string(),
640
+ reasoning: z5.string().optional(),
641
+ output: z5.string(),
642
+ tool_call: z5.string().optional()
537
643
  });
538
- var CRMModelFieldRequirementsSchema = z4.object({
539
- required: z4.array(z4.string()).optional(),
540
- recommended: z4.array(z4.string()).optional()
644
+ var CRMModelFieldRequirementsSchema = z5.object({
645
+ required: z5.array(z5.string()).optional(),
646
+ recommended: z5.array(z5.string()).optional()
541
647
  });
542
- var CRMContextSchema = z4.object({
543
- models: z4.record(z4.string(), CRMModelFieldRequirementsSchema)
648
+ var CRMContextSchema = z5.object({
649
+ models: z5.record(z5.string(), CRMModelFieldRequirementsSchema)
544
650
  });
545
- var SkillYAMLSchema = z4.object({
651
+ var SkillYAMLSchema = z5.object({
546
652
  // Schema version
547
- $schema: z4.string().optional(),
653
+ $schema: z5.string().optional(),
548
654
  // Identity
549
- handle: z4.string(),
550
- name: z4.string(),
551
- version: z4.string().optional(),
552
- description: z4.string().optional(),
655
+ handle: z5.string(),
656
+ name: z5.string(),
657
+ version: z5.string().optional(),
658
+ description: z5.string().optional(),
553
659
  // Instructions injected into agent system prompt
554
- instructions: z4.string(),
660
+ instructions: z5.string(),
555
661
  // Tool configuration - supports both v1 and v2 formats
556
662
  tools: SkillToolsSchema.optional(),
557
663
  // CRM context - specifies which models/fields to include in schema
558
664
  crmContext: CRMContextSchema.optional(),
559
665
  // Few-shot examples
560
- examples: z4.array(SkillExampleSchema).optional()
561
- });
562
- var SkillYAMLV2Schema = z4.object({
563
- $schema: z4.literal(SKILL_SCHEMA_VERSION_V2).optional(),
564
- handle: z4.string(),
565
- name: z4.string(),
566
- version: z4.string().optional(),
567
- description: z4.string().optional(),
568
- instructions: z4.string(),
569
- tools: z4.array(SkillToolDefinitionSchema).optional(),
666
+ examples: z5.array(SkillExampleSchema).optional()
667
+ });
668
+ var SkillYAMLV2Schema = z5.object({
669
+ $schema: z5.literal(SKILL_SCHEMA_VERSION_V2).optional(),
670
+ handle: z5.string(),
671
+ name: z5.string(),
672
+ version: z5.string().optional(),
673
+ description: z5.string().optional(),
674
+ instructions: z5.string(),
675
+ tools: z5.array(SkillToolDefinitionSchema).optional(),
570
676
  crmContext: CRMContextSchema.optional(),
571
- examples: z4.array(SkillExampleSchema).optional()
677
+ examples: z5.array(SkillExampleSchema).optional()
572
678
  });
573
- var SkillVersionWeightSchema = z4.object({
574
- version: z4.number(),
575
- weight: z4.number()
679
+ var SkillVersionWeightSchema = z5.object({
680
+ version: z5.number(),
681
+ weight: z5.number()
576
682
  });
577
- var SkillRefSchema = z4.union([
578
- z4.string(),
683
+ var SkillRefSchema = z5.union([
684
+ z5.string(),
579
685
  // Just handle - uses latest published version
580
- z4.object({
581
- skill: z4.string(),
582
- description: z4.string().optional(),
686
+ z5.object({
687
+ skill: z5.string(),
688
+ description: z5.string().optional(),
583
689
  // For AI SDK Agent Skills discovery
584
690
  /** Auto-inject this skill's instructions and tools on every agent turn */
585
- alwaysLoad: z4.boolean().optional(),
691
+ alwaysLoad: z5.boolean().optional(),
586
692
  // Version selection (pick one):
587
- version: z4.number().optional(),
693
+ version: z5.number().optional(),
588
694
  // Pin to specific version number
589
- versions: z4.array(SkillVersionWeightSchema).optional(),
695
+ versions: z5.array(SkillVersionWeightSchema).optional(),
590
696
  // A/B testing weights
591
697
  // Legacy support:
592
- instructions: z4.string().optional(),
698
+ instructions: z5.string().optional(),
593
699
  // Inline instructions (deprecated)
594
- enabled: z4.boolean().optional()
700
+ enabled: z5.boolean().optional()
595
701
  })
596
702
  ]);
597
- var SkillMetadataSchema = z4.object({
598
- id: z4.string(),
599
- handle: z4.string(),
600
- name: z4.string(),
601
- version: z4.string().optional(),
602
- description: z4.string().optional(),
703
+ var SkillMetadataSchema = z5.object({
704
+ id: z5.string(),
705
+ handle: z5.string(),
706
+ name: z5.string(),
707
+ version: z5.string().optional(),
708
+ description: z5.string().optional(),
603
709
  source: SkillSourceSchema,
604
- s3Key: z4.string().optional(),
605
- appVersionId: z4.string().optional(),
606
- workplaceId: z4.string().optional(),
607
- createdAt: z4.string().datetime().optional(),
608
- updatedAt: z4.string().datetime().optional()
609
- });
610
- var ResolvedSkillSchema = z4.object({
611
- handle: z4.string(),
612
- name: z4.string(),
613
- instructions: z4.string().optional(),
614
- description: z4.string().optional(),
615
- tools: z4.array(z4.string()).optional(),
616
- examples: z4.array(SkillExampleSchema).optional()
617
- });
618
- var LoadedSkillSchema = z4.object({
619
- handle: z4.string(),
620
- name: z4.string(),
621
- instructions: z4.string().optional(),
622
- description: z4.string().optional(),
623
- tools: z4.array(SkillToolDefinitionSchema).optional(),
624
- examples: z4.array(SkillExampleSchema).optional()
710
+ s3Key: z5.string().optional(),
711
+ appVersionId: z5.string().optional(),
712
+ workplaceId: z5.string().optional(),
713
+ createdAt: z5.string().datetime().optional(),
714
+ updatedAt: z5.string().datetime().optional()
715
+ });
716
+ var ResolvedSkillSchema = z5.object({
717
+ handle: z5.string(),
718
+ name: z5.string(),
719
+ instructions: z5.string().optional(),
720
+ description: z5.string().optional(),
721
+ tools: z5.array(z5.string()).optional(),
722
+ examples: z5.array(SkillExampleSchema).optional()
723
+ });
724
+ var LoadedSkillSchema = z5.object({
725
+ handle: z5.string(),
726
+ name: z5.string(),
727
+ instructions: z5.string().optional(),
728
+ description: z5.string().optional(),
729
+ tools: z5.array(SkillToolDefinitionSchema).optional(),
730
+ examples: z5.array(SkillExampleSchema).optional()
625
731
  });
626
732
  function isV2SkillTools(tools) {
627
733
  if (!tools) return false;
@@ -677,182 +783,182 @@ ${sections.join("\n\n---\n\n")}`;
677
783
  }
678
784
 
679
785
  // src/context/types.ts
680
- import { z as z5 } from "zod/v4";
681
- var CRMContextSchema2 = z5.object({
682
- model: z5.string(),
683
- instanceId: z5.string(),
684
- data: z5.record(z5.string(), z5.unknown())
786
+ import { z as z6 } from "zod/v4";
787
+ var CRMContextSchema2 = z6.object({
788
+ model: z6.string(),
789
+ instanceId: z6.string(),
790
+ data: z6.record(z6.string(), z6.unknown())
685
791
  });
686
- var SenderContextSchema = z5.object({
792
+ var SenderContextSchema = z6.object({
687
793
  kind: ParticipantKindSchema,
688
- displayName: z5.string().optional(),
689
- email: z5.string().optional(),
690
- role: z5.string().optional(),
691
- permissions: z5.array(z5.string()).optional(),
794
+ displayName: z6.string().optional(),
795
+ email: z6.string().optional(),
796
+ role: z6.string().optional(),
797
+ permissions: z6.array(z6.string()).optional(),
692
798
  crm: CRMContextSchema2.optional()
693
799
  });
694
- var ThreadContextItemSchema = z5.object({
695
- handle: z5.string(),
696
- model: z5.string(),
697
- instanceId: z5.string(),
698
- data: z5.record(z5.string(), z5.unknown()).optional()
699
- });
700
- var ThreadInfoSchema = z5.object({
701
- id: z5.string(),
702
- title: z5.string().optional(),
703
- status: z5.string().optional(),
704
- kind: z5.string().optional()
705
- });
706
- var SubscriptionSchema = z5.object({
707
- identifierValue: z5.string(),
708
- channelHandle: z5.string().optional()
709
- });
710
- var AssociationSchema = z5.object({
711
- id: z5.string().optional(),
712
- data: z5.record(z5.string(), z5.unknown())
713
- });
714
- var ContactSchema = z5.object({
715
- id: z5.string().optional(),
716
- name: z5.string().optional(),
800
+ var ThreadContextItemSchema = z6.object({
801
+ handle: z6.string(),
802
+ model: z6.string(),
803
+ instanceId: z6.string(),
804
+ data: z6.record(z6.string(), z6.unknown()).optional()
805
+ });
806
+ var ThreadInfoSchema = z6.object({
807
+ id: z6.string(),
808
+ title: z6.string().optional(),
809
+ status: z6.string().optional(),
810
+ kind: z6.string().optional()
811
+ });
812
+ var SubscriptionSchema = z6.object({
813
+ identifierValue: z6.string(),
814
+ channelHandle: z6.string().optional()
815
+ });
816
+ var AssociationSchema = z6.object({
817
+ id: z6.string().optional(),
818
+ data: z6.record(z6.string(), z6.unknown())
819
+ });
820
+ var ContactSchema = z6.object({
821
+ id: z6.string().optional(),
822
+ name: z6.string().optional(),
717
823
  subscription: SubscriptionSchema.optional(),
718
- associations: z5.record(z5.string(), AssociationSchema).optional()
824
+ associations: z6.record(z6.string(), AssociationSchema).optional()
719
825
  });
720
- var AgentSenderContextSchema = z5.object({
721
- kind: z5.enum(["contact", "member"]),
722
- displayName: z5.string().optional(),
723
- role: z5.string().optional(),
724
- permissions: z5.array(z5.string()).optional(),
826
+ var AgentSenderContextSchema = z6.object({
827
+ kind: z6.enum(["contact", "member"]),
828
+ displayName: z6.string().optional(),
829
+ role: z6.string().optional(),
830
+ permissions: z6.array(z6.string()).optional(),
725
831
  contact: ContactSchema.optional()
726
832
  });
727
- var AgentThreadContextSchema = z5.object({
728
- handle: z5.string(),
729
- model: z5.string(),
730
- data: z5.record(z5.string(), z5.unknown())
833
+ var AgentThreadContextSchema = z6.object({
834
+ handle: z6.string(),
835
+ model: z6.string(),
836
+ data: z6.record(z6.string(), z6.unknown())
731
837
  });
732
- var AgentContextSchema = z5.object({
838
+ var AgentContextSchema = z6.object({
733
839
  sender: AgentSenderContextSchema,
734
- contexts: z5.array(AgentThreadContextSchema).optional()
840
+ contexts: z6.array(AgentThreadContextSchema).optional()
735
841
  });
736
- var ContextIssueSeveritySchema = z5.enum(["ERROR", "WARNING"]);
737
- var ContextIssueTypeSchema = z5.enum([
842
+ var ContextIssueSeveritySchema = z6.enum(["ERROR", "WARNING"]);
843
+ var ContextIssueTypeSchema = z6.enum([
738
844
  "MISSING_ROUTING_PARTICIPANT",
739
845
  "MISSING_ASSOCIATION",
740
846
  "MISSING_REQUIRED_FIELD",
741
847
  "MISSING_RECOMMENDED_FIELD"
742
848
  ]);
743
- var ContextIssueSchema = z5.object({
849
+ var ContextIssueSchema = z6.object({
744
850
  type: ContextIssueTypeSchema,
745
851
  severity: ContextIssueSeveritySchema,
746
- model: z5.string().optional(),
747
- field: z5.string().optional(),
748
- message: z5.string(),
749
- suggestion: z5.string().optional()
852
+ model: z6.string().optional(),
853
+ field: z6.string().optional(),
854
+ message: z6.string(),
855
+ suggestion: z6.string().optional()
750
856
  });
751
- var ContextValidationResultSchema = z5.object({
752
- valid: z5.boolean(),
753
- degraded: z5.boolean(),
754
- issues: z5.array(ContextIssueSchema)
857
+ var ContextValidationResultSchema = z6.object({
858
+ valid: z6.boolean(),
859
+ degraded: z6.boolean(),
860
+ issues: z6.array(ContextIssueSchema)
755
861
  });
756
862
  var MockSenderContextSchema = AgentSenderContextSchema;
757
863
  var MockThreadContextSchema = AgentThreadContextSchema;
758
864
  var MockContextSchema = AgentContextSchema;
759
- var SandboxConfigSchema = z5.object({
760
- enabled: z5.boolean().optional(),
865
+ var SandboxConfigSchema = z6.object({
866
+ enabled: z6.boolean().optional(),
761
867
  /** @deprecated Use 'context' instead of 'mockContext' */
762
868
  mockContext: AgentContextSchema.optional(),
763
869
  context: AgentContextSchema.optional()
764
870
  });
765
871
 
766
872
  // src/schemas/agent-schema-v3.ts
767
- var PersonaVoiceFormatV3Schema = z6.object({
768
- maxChars: z6.number().optional(),
769
- noEmojis: z6.boolean().optional(),
770
- noHyphens: z6.boolean().optional(),
771
- noBulletPoints: z6.boolean().optional(),
772
- maxQuestionsPerMessage: z6.number().optional(),
773
- noSignOffs: z6.boolean().optional()
774
- });
775
- var PersonaVoiceV3Schema = z6.object({
776
- style: z6.string(),
873
+ var PersonaVoiceFormatV3Schema = z7.object({
874
+ maxChars: z7.number().optional(),
875
+ noEmojis: z7.boolean().optional(),
876
+ noHyphens: z7.boolean().optional(),
877
+ noBulletPoints: z7.boolean().optional(),
878
+ maxQuestionsPerMessage: z7.number().optional(),
879
+ noSignOffs: z7.boolean().optional()
880
+ });
881
+ var PersonaVoiceV3Schema = z7.object({
882
+ style: z7.string(),
777
883
  format: PersonaVoiceFormatV3Schema.optional()
778
884
  });
779
- var PersonaV3Schema = z6.object({
780
- name: z6.string(),
885
+ var PersonaV3Schema = z7.object({
886
+ name: z7.string(),
781
887
  voice: PersonaVoiceV3Schema
782
888
  });
783
- var ToolApprovalConfigSchema = z6.object({
784
- required: z6.boolean().optional(),
785
- requiredIf: z6.array(z6.string()).optional()
889
+ var ToolApprovalConfigSchema = z7.object({
890
+ required: z7.boolean().optional(),
891
+ requiredIf: z7.array(z7.string()).optional()
786
892
  });
787
- var ToolSandboxConfigSchema = z6.object({
788
- mock: z6.unknown().optional()
893
+ var ToolSandboxConfigSchema = z7.object({
894
+ mock: z7.unknown().optional()
789
895
  });
790
- var ToolRefV3Schema = z6.union([
791
- z6.string(),
792
- z6.object({
793
- tool: z6.string(),
794
- description: z6.string().optional(),
896
+ var ToolRefV3Schema = z7.union([
897
+ z7.string(),
898
+ z7.object({
899
+ tool: z7.string(),
900
+ description: z7.string().optional(),
795
901
  approval: ToolApprovalConfigSchema.optional(),
796
902
  sandbox: ToolSandboxConfigSchema.optional(),
797
- overrides: z6.record(z6.string(), z6.unknown()).optional()
903
+ overrides: z7.record(z7.string(), z7.unknown()).optional()
798
904
  })
799
905
  ]);
800
- var AgentToolRefSchema = z6.union([
801
- z6.string(),
802
- z6.object({
803
- tool: z6.string(),
804
- description: z6.string().optional()
906
+ var AgentToolRefSchema = z7.union([
907
+ z7.string(),
908
+ z7.object({
909
+ tool: z7.string(),
910
+ description: z7.string().optional()
805
911
  })
806
912
  ]);
807
- var WorkingMemoryConfigSchema = z6.object({
808
- strategy: z6.enum(["full", "rolling_summary", "sliding_window"]).optional(),
809
- maxTokens: z6.number().optional(),
810
- summarizeAt: z6.number().optional()
913
+ var WorkingMemoryConfigSchema = z7.object({
914
+ strategy: z7.enum(["full", "rolling_summary", "sliding_window"]).optional(),
915
+ maxTokens: z7.number().optional(),
916
+ summarizeAt: z7.number().optional()
811
917
  });
812
- var ExternalMemoryConfigSchema = z6.object({
813
- enabled: z6.boolean().optional(),
814
- ttl: z6.string().optional()
918
+ var ExternalMemoryConfigSchema = z7.object({
919
+ enabled: z7.boolean().optional(),
920
+ ttl: z7.string().optional()
815
921
  });
816
- var SemanticMemoryConfigSchema = z6.object({
817
- enabled: z6.boolean().optional(),
818
- topK: z6.number().optional(),
819
- scope: z6.enum(["thread", "instance", "workspace"]).optional()
922
+ var SemanticMemoryConfigSchema = z7.object({
923
+ enabled: z7.boolean().optional(),
924
+ topK: z7.number().optional(),
925
+ scope: z7.enum(["thread", "instance", "workspace"]).optional()
820
926
  });
821
- var MemoryConfigV3Schema = z6.object({
927
+ var MemoryConfigV3Schema = z7.object({
822
928
  working: WorkingMemoryConfigSchema.optional(),
823
- persistent: z6.object({
824
- namespace: z6.string().optional()
929
+ persistent: z7.object({
930
+ namespace: z7.string().optional()
825
931
  }).optional(),
826
932
  external: ExternalMemoryConfigSchema.optional(),
827
933
  semantic: SemanticMemoryConfigSchema.optional()
828
934
  });
829
- var RequiresApprovalPolicySchema = z6.object({
830
- requiresApproval: z6.boolean().optional()
935
+ var RequiresApprovalPolicySchema = z7.object({
936
+ requiresApproval: z7.boolean().optional()
831
937
  });
832
- var PoliciesConfigV3Schema = z6.object({
833
- messages: z6.object({
938
+ var PoliciesConfigV3Schema = z7.object({
939
+ messages: z7.object({
834
940
  send: RequiresApprovalPolicySchema.optional(),
835
941
  schedule: RequiresApprovalPolicySchema.optional()
836
942
  }).optional(),
837
- tools: z6.object({
838
- externalRequiresApproval: z6.boolean().optional(),
839
- systemRequiresApproval: z6.boolean().optional()
943
+ tools: z7.object({
944
+ externalRequiresApproval: z7.boolean().optional(),
945
+ systemRequiresApproval: z7.boolean().optional()
840
946
  }).optional()
841
947
  });
842
- var RuntimeConfigV3Schema = z6.object({
948
+ var RuntimeConfigV3Schema = z7.object({
843
949
  /** LLM model identifier for reasoning (e.g., "google/gemini-3.1-flash-lite") */
844
- model: z6.string().optional(),
950
+ model: z7.string().optional(),
845
951
  /** LLM model for persona transformation (e.g., "openai/gpt-5-nano") */
846
- personaModel: z6.string().optional()
952
+ personaModel: z7.string().optional()
847
953
  });
848
- var TimeWindowTimeStampSchema = z6.union([
849
- z6.number().describe("Hour of day (0-23)"),
850
- z6.object({
851
- hour: z6.number(),
852
- minute: z6.number().optional().default(0)
954
+ var TimeWindowTimeStampSchema = z7.union([
955
+ z7.number().describe("Hour of day (0-23)"),
956
+ z7.object({
957
+ hour: z7.number(),
958
+ minute: z7.number().optional().default(0)
853
959
  })
854
960
  ]);
855
- var TimeWindowDayOfWeekSchema = z6.enum([
961
+ var TimeWindowDayOfWeekSchema = z7.enum([
856
962
  "monday",
857
963
  "tuesday",
858
964
  "wednesday",
@@ -861,47 +967,47 @@ var TimeWindowDayOfWeekSchema = z6.enum([
861
967
  "saturday",
862
968
  "sunday"
863
969
  ]);
864
- var TimeWindowSlotAgentSchema = z6.object({
970
+ var TimeWindowSlotAgentSchema = z7.object({
865
971
  startTime: TimeWindowTimeStampSchema,
866
972
  endTime: TimeWindowTimeStampSchema,
867
- days: z6.array(TimeWindowDayOfWeekSchema)
973
+ days: z7.array(TimeWindowDayOfWeekSchema)
868
974
  });
869
- var ResponseModeSchema = z6.enum([
975
+ var ResponseModeSchema = z7.enum([
870
976
  "immediate",
871
977
  "ack_and_schedule",
872
978
  "schedule_only"
873
979
  ]);
874
- var TimeWindowBehaviorSchema = z6.object({
980
+ var TimeWindowBehaviorSchema = z7.object({
875
981
  /** How to handle responses in this window */
876
982
  responseMode: ResponseModeSchema,
877
983
  /** Prompt injection for this time context */
878
- prompt: z6.string().optional().describe("Prompt injection for this time context"),
984
+ prompt: z7.string().optional().describe("Prompt injection for this time context"),
879
985
  /** Window to schedule responses for (when responseMode is ack_and_schedule or schedule_only) */
880
- scheduleFor: z6.string().optional().describe("Window name to schedule responses for")
986
+ scheduleFor: z7.string().optional().describe("Window name to schedule responses for")
881
987
  });
882
- var TimeWindowPolicySchema = z6.object({
988
+ var TimeWindowPolicySchema = z7.object({
883
989
  /** IANA timezone for the window (e.g., "Australia/Sydney") */
884
- timezone: z6.string().describe('IANA timezone, e.g., "Australia/Sydney"'),
990
+ timezone: z7.string().describe('IANA timezone, e.g., "Australia/Sydney"'),
885
991
  /** Time slots when this window is active */
886
- windows: z6.array(TimeWindowSlotAgentSchema),
992
+ windows: z7.array(TimeWindowSlotAgentSchema),
887
993
  /** Behavior for this window (optional - defaults to immediate response) */
888
994
  behavior: TimeWindowBehaviorSchema.optional()
889
995
  });
890
- var TimeWindowPoliciesSchema = z6.record(z6.string(), TimeWindowPolicySchema);
996
+ var TimeWindowPoliciesSchema = z7.record(z7.string(), TimeWindowPolicySchema);
891
997
  var TimeWindowDefaultSchema = TimeWindowBehaviorSchema.describe(
892
998
  "Fallback behavior when no time window matches"
893
999
  );
894
- var ResponsesBehaviorConfigSchema = z6.object({
1000
+ var ResponsesBehaviorConfigSchema = z7.object({
895
1001
  /**
896
1002
  * Maximum immediate messages per agent run (acks, progress updates).
897
1003
  * @default 1
898
1004
  */
899
- maxImmediate: z6.number().optional(),
1005
+ maxImmediate: z7.number().optional(),
900
1006
  /**
901
1007
  * Maximum scheduled messages per agent run (follow-ups via sendAt).
902
1008
  * @default 2
903
1009
  */
904
- maxScheduled: z6.number().optional(),
1010
+ maxScheduled: z7.number().optional(),
905
1011
  /**
906
1012
  * Maximum intermediate messages per agent run.
907
1013
  * Intermediate = progress updates, acknowledgments before task completion.
@@ -909,74 +1015,74 @@ var ResponsesBehaviorConfigSchema = z6.object({
909
1015
  * @deprecated Use maxImmediate instead
910
1016
  * @default 2
911
1017
  */
912
- maxIntermediate: z6.number().optional(),
1018
+ maxIntermediate: z7.number().optional(),
913
1019
  /**
914
1020
  * Whether a final message is required before the run completes.
915
1021
  * If true and no final message is sent, the run fails.
916
1022
  * @default true
917
1023
  */
918
- requireFinal: z6.boolean().optional(),
1024
+ requireFinal: z7.boolean().optional(),
919
1025
  /**
920
1026
  * Whether the agent can schedule messages for future delivery.
921
1027
  * Scheduled messages typically require approval.
922
1028
  * @default false
923
1029
  */
924
- allowSchedule: z6.boolean().optional(),
1030
+ allowSchedule: z7.boolean().optional(),
925
1031
  /**
926
1032
  * Message splitting configuration.
927
1033
  * Controls whether and how the agent splits responses into multiple messages.
928
1034
  */
929
- messageSplitting: z6.object({
1035
+ messageSplitting: z7.object({
930
1036
  /**
931
1037
  * Whether to allow natural message splitting.
932
1038
  * When true, the agent may split responses into multiple messages
933
1039
  * when it improves conversational flow.
934
1040
  */
935
- enabled: z6.boolean(),
1041
+ enabled: z7.boolean(),
936
1042
  /**
937
1043
  * Custom prompt to override the default message splitting guidance.
938
1044
  * If not provided, uses sensible defaults for when to split vs. keep together.
939
1045
  */
940
- prompt: z6.string().optional()
1046
+ prompt: z7.string().optional()
941
1047
  }).optional()
942
1048
  });
943
- var SchedulingDelaySchema = z6.object({
1049
+ var SchedulingDelaySchema = z7.object({
944
1050
  /** Time unit amount */
945
- amount: z6.number(),
1051
+ amount: z7.number(),
946
1052
  /** Time unit (e.g., "week", "weeks", "day", "days", "month", "months") */
947
- unit: z6.string(),
1053
+ unit: z7.string(),
948
1054
  /** Optional time window to constrain the delay */
949
- timeWindow: z6.string().optional()
1055
+ timeWindow: z7.string().optional()
950
1056
  });
951
- var SchedulingPatternSchema = z6.object({
1057
+ var SchedulingPatternSchema = z7.object({
952
1058
  /** Trigger name for this pattern */
953
- trigger: z6.string(),
1059
+ trigger: z7.string(),
954
1060
  /** Human-readable description of when this pattern applies */
955
- description: z6.string().optional(),
1061
+ description: z7.string().optional(),
956
1062
  /** Example user phrases that match this pattern */
957
- examples: z6.array(z6.string()).optional(),
1063
+ examples: z7.array(z7.string()).optional(),
958
1064
  /** Default delay for this pattern */
959
1065
  defaultDelay: SchedulingDelaySchema.optional()
960
1066
  });
961
- var SchedulingBehaviorConfigSchema = z6.object({
1067
+ var SchedulingBehaviorConfigSchema = z7.object({
962
1068
  /**
963
1069
  * Patterns that trigger scheduling suggestions.
964
1070
  * The agent uses these to know when to add sendAt to messages.
965
1071
  */
966
- patterns: z6.array(SchedulingPatternSchema).optional(),
1072
+ patterns: z7.array(SchedulingPatternSchema).optional(),
967
1073
  /**
968
1074
  * Default settings for scheduled messages.
969
1075
  */
970
- defaults: z6.object({
1076
+ defaults: z7.object({
971
1077
  /** Cancel scheduled message if user replies before send time (default: true) */
972
- cancelOnActivity: z6.boolean().optional(),
1078
+ cancelOnActivity: z7.boolean().optional(),
973
1079
  /** Whether scheduled messages require approval (default: true) */
974
- requiresApproval: z6.boolean().optional(),
1080
+ requiresApproval: z7.boolean().optional(),
975
1081
  /** Default time window policy to constrain all scheduled messages */
976
- timeWindow: z6.string().optional().describe("Time window policy name for scheduled messages")
1082
+ timeWindow: z7.string().optional().describe("Time window policy name for scheduled messages")
977
1083
  }).optional()
978
1084
  });
979
- var BehaviorConfigV3Schema = z6.object({
1085
+ var BehaviorConfigV3Schema = z7.object({
980
1086
  /**
981
1087
  * Response behavior - controls message sending via tool calls.
982
1088
  * When configured, agents must explicitly call system:message:send
@@ -989,32 +1095,32 @@ var BehaviorConfigV3Schema = z6.object({
989
1095
  */
990
1096
  scheduling: SchedulingBehaviorConfigSchema.optional()
991
1097
  });
992
- var PromptsConfigV3Schema = z6.object({
1098
+ var PromptsConfigV3Schema = z7.object({
993
1099
  /** Main system prompt with workflow instructions */
994
- system: z6.string().optional(),
1100
+ system: z7.string().optional(),
995
1101
  /** Injected during second pass when skills were loaded but tools not used */
996
- recovery: z6.string().optional(),
1102
+ recovery: z7.string().optional(),
997
1103
  /** Injected during follow-up passes when context needs updating */
998
- followUp: z6.string().optional(),
1104
+ followUp: z7.string().optional(),
999
1105
  /** Thread list title generation (system + user template with {{var}} placeholders) */
1000
- titleEnrichment: z6.object({
1001
- system: z6.string().optional(),
1002
- user: z6.string().optional()
1106
+ titleEnrichment: z7.object({
1107
+ system: z7.string().optional(),
1108
+ user: z7.string().optional()
1003
1109
  }).optional()
1004
1110
  });
1005
- var AgentYAMLV3Schema = z6.object({
1006
- $schema: z6.string().optional(),
1007
- handle: z6.string(),
1008
- name: z6.string(),
1009
- version: z6.string().optional(),
1010
- description: z6.string().optional(),
1111
+ var AgentYAMLV3Schema = z7.object({
1112
+ $schema: z7.string().optional(),
1113
+ handle: z7.string(),
1114
+ name: z7.string(),
1115
+ version: z7.string().optional(),
1116
+ description: z7.string().optional(),
1011
1117
  // Persona - Who the agent is
1012
1118
  persona: PersonaV3Schema.optional(),
1013
1119
  // Skills - What the agent knows how to do (skills own their tools)
1014
- skills: z6.array(SkillRefSchema).optional(),
1120
+ skills: z7.array(SkillRefSchema).optional(),
1015
1121
  // Tools - Always-available tools before any skill loads
1016
1122
  // Examples: system:settings:business_information:get
1017
- tools: z6.array(AgentToolRefSchema).optional(),
1123
+ tools: z7.array(AgentToolRefSchema).optional(),
1018
1124
  /**
1019
1125
  * Events - When the agent activates
1020
1126
  * @deprecated Not yet implemented - this is a planned feature for event-driven agents.
@@ -1047,21 +1153,21 @@ var AgentYAMLV3Schema = z6.object({
1047
1153
  });
1048
1154
 
1049
1155
  // src/schemas.ts
1050
- var EnvVisibilitySchema = z7.enum(["visible", "encrypted"]);
1051
- var EnvVariableDefinitionSchema = z7.object({
1052
- label: z7.string(),
1053
- required: z7.boolean().optional(),
1156
+ var EnvVisibilitySchema = z8.enum(["visible", "encrypted"]);
1157
+ var EnvVariableDefinitionSchema = z8.object({
1158
+ label: z8.string(),
1159
+ required: z8.boolean().optional(),
1054
1160
  visibility: EnvVisibilitySchema.optional(),
1055
- default: z7.string().optional(),
1056
- description: z7.string().optional(),
1057
- placeholder: z7.string().optional()
1058
- });
1059
- var EnvSchemaSchema = z7.record(z7.string(), EnvVariableDefinitionSchema);
1060
- var ComputeLayerTypeSchema = z7.enum(["serverless", "dedicated"]);
1061
- var FieldOwnerSchema = z7.enum(["APP", "SHARED"]);
1062
- var PrimitiveSchema = z7.union([z7.string(), z7.number(), z7.boolean()]);
1063
- var PrimitiveOrArraySchema = z7.union([PrimitiveSchema, z7.array(PrimitiveSchema)]);
1064
- var FilterOperatorSchema = z7.enum([
1161
+ default: z8.string().optional(),
1162
+ description: z8.string().optional(),
1163
+ placeholder: z8.string().optional()
1164
+ });
1165
+ var EnvSchemaSchema = z8.record(z8.string(), EnvVariableDefinitionSchema);
1166
+ var ComputeLayerTypeSchema = z8.enum(["serverless", "dedicated"]);
1167
+ var FieldOwnerSchema = z8.enum(["APP", "SHARED"]);
1168
+ var PrimitiveSchema = z8.union([z8.string(), z8.number(), z8.boolean()]);
1169
+ var PrimitiveOrArraySchema = z8.union([PrimitiveSchema, z8.array(PrimitiveSchema)]);
1170
+ var FilterOperatorSchema = z8.enum([
1065
1171
  "eq",
1066
1172
  "neq",
1067
1173
  "gt",
@@ -1079,7 +1185,7 @@ var FilterOperatorSchema = z7.enum([
1079
1185
  "isEmpty",
1080
1186
  "isNotEmpty"
1081
1187
  ]);
1082
- var FilterConditionSchema = z7.object({
1188
+ var FilterConditionSchema = z8.object({
1083
1189
  eq: PrimitiveOrArraySchema,
1084
1190
  neq: PrimitiveOrArraySchema,
1085
1191
  gt: PrimitiveOrArraySchema,
@@ -1097,27 +1203,27 @@ var FilterConditionSchema = z7.object({
1097
1203
  isEmpty: PrimitiveOrArraySchema,
1098
1204
  isNotEmpty: PrimitiveOrArraySchema
1099
1205
  }).partial();
1100
- var StructuredFilterSchema = z7.record(
1101
- z7.string(),
1206
+ var StructuredFilterSchema = z8.record(
1207
+ z8.string(),
1102
1208
  FilterConditionSchema
1103
1209
  );
1104
- var ModelDependencySchema = z7.object({
1105
- model: z7.string(),
1106
- fields: z7.array(z7.string()).optional(),
1210
+ var ModelDependencySchema = z8.object({
1211
+ model: z8.string(),
1212
+ fields: z8.array(z8.string()).optional(),
1107
1213
  where: StructuredFilterSchema.optional()
1108
1214
  });
1109
- var ChannelDependencySchema = z7.object({
1110
- channel: z7.string()
1215
+ var ChannelDependencySchema = z8.object({
1216
+ channel: z8.string()
1111
1217
  });
1112
- var WorkflowDependencySchema = z7.object({
1113
- workflow: z7.string()
1218
+ var WorkflowDependencySchema = z8.object({
1219
+ workflow: z8.string()
1114
1220
  });
1115
- var ResourceDependencySchema = z7.union([
1221
+ var ResourceDependencySchema = z8.union([
1116
1222
  ModelDependencySchema,
1117
1223
  ChannelDependencySchema,
1118
1224
  WorkflowDependencySchema
1119
1225
  ]);
1120
- var FieldDataTypeSchema = z7.enum([
1226
+ var FieldDataTypeSchema = z8.enum([
1121
1227
  "LONG_STRING",
1122
1228
  "STRING",
1123
1229
  "NUMBER",
@@ -1130,74 +1236,74 @@ var FieldDataTypeSchema = z7.enum([
1130
1236
  "RELATION",
1131
1237
  "OBJECT"
1132
1238
  ]);
1133
- var FieldOptionSchema = z7.object({
1134
- label: z7.string(),
1135
- value: z7.string(),
1136
- color: z7.string().optional()
1137
- });
1138
- var InlineFieldDefinitionSchema = z7.object({
1139
- limitChoices: z7.number().optional(),
1140
- options: z7.array(FieldOptionSchema).optional(),
1141
- minLength: z7.number().optional(),
1142
- maxLength: z7.number().optional(),
1143
- min: z7.number().optional(),
1144
- max: z7.number().optional(),
1145
- relatedModel: z7.string().optional(),
1146
- pattern: z7.string().optional()
1147
- });
1148
- var AppFieldVisibilitySchema = z7.object({
1149
- data: z7.boolean().optional(),
1150
- list: z7.boolean().optional(),
1151
- filters: z7.boolean().optional()
1152
- });
1153
- var FieldRequirementTypeSchema = z7.enum(["optional", "on_create", "required"]);
1154
- var ModelFieldDefinitionSchema = z7.object({
1155
- handle: z7.string(),
1156
- label: z7.string(),
1239
+ var FieldOptionSchema = z8.object({
1240
+ label: z8.string(),
1241
+ value: z8.string(),
1242
+ color: z8.string().optional()
1243
+ });
1244
+ var InlineFieldDefinitionSchema = z8.object({
1245
+ limitChoices: z8.number().optional(),
1246
+ options: z8.array(FieldOptionSchema).optional(),
1247
+ minLength: z8.number().optional(),
1248
+ maxLength: z8.number().optional(),
1249
+ min: z8.number().optional(),
1250
+ max: z8.number().optional(),
1251
+ relatedModel: z8.string().optional(),
1252
+ pattern: z8.string().optional()
1253
+ });
1254
+ var AppFieldVisibilitySchema = z8.object({
1255
+ data: z8.boolean().optional(),
1256
+ list: z8.boolean().optional(),
1257
+ filters: z8.boolean().optional()
1258
+ });
1259
+ var FieldRequirementTypeSchema = z8.enum(["optional", "on_create", "required"]);
1260
+ var ModelFieldDefinitionSchema = z8.object({
1261
+ handle: z8.string(),
1262
+ label: z8.string(),
1157
1263
  type: FieldDataTypeSchema.optional(),
1158
- definition: z7.union([InlineFieldDefinitionSchema, z7.string()]).optional(),
1264
+ definition: z8.union([InlineFieldDefinitionSchema, z8.string()]).optional(),
1159
1265
  /** Field requirement type: 'optional', 'on_create', or 'required' */
1160
1266
  requirement: FieldRequirementTypeSchema.optional(),
1161
1267
  /** @deprecated Use `requirement` instead */
1162
- required: z7.boolean().optional(),
1163
- unique: z7.boolean().optional(),
1164
- system: z7.boolean().optional(),
1165
- isList: z7.boolean().optional(),
1166
- defaultValue: z7.object({ value: z7.unknown() }).optional(),
1167
- description: z7.string().optional(),
1268
+ required: z8.boolean().optional(),
1269
+ unique: z8.boolean().optional(),
1270
+ system: z8.boolean().optional(),
1271
+ isList: z8.boolean().optional(),
1272
+ defaultValue: z8.object({ value: z8.unknown() }).optional(),
1273
+ description: z8.string().optional(),
1168
1274
  visibility: AppFieldVisibilitySchema.optional(),
1169
1275
  owner: FieldOwnerSchema.optional()
1170
1276
  });
1171
- var ModelDefinitionSchema = z7.object({
1172
- handle: z7.string(),
1173
- name: z7.string(),
1174
- namePlural: z7.string().optional(),
1175
- labelTemplate: z7.string().optional(),
1176
- description: z7.string().optional(),
1177
- fields: z7.array(ModelFieldDefinitionSchema),
1178
- requires: z7.array(ResourceDependencySchema).optional(),
1179
- addDefaultPages: z7.boolean().optional(),
1180
- addNavigation: z7.boolean().optional(),
1277
+ var ModelDefinitionSchema = z8.object({
1278
+ handle: z8.string(),
1279
+ name: z8.string(),
1280
+ namePlural: z8.string().optional(),
1281
+ labelTemplate: z8.string().optional(),
1282
+ description: z8.string().optional(),
1283
+ fields: z8.array(ModelFieldDefinitionSchema),
1284
+ requires: z8.array(ResourceDependencySchema).optional(),
1285
+ addDefaultPages: z8.boolean().optional(),
1286
+ addNavigation: z8.boolean().optional(),
1181
1287
  /** Root path for developer resource UI (e.g., '/access_requests'). Links internal model to a provision.pages entry. */
1182
- page: z7.string().optional()
1288
+ page: z8.string().optional()
1183
1289
  });
1184
- var RelationshipCardinalitySchema = z7.enum([
1290
+ var RelationshipCardinalitySchema = z8.enum([
1185
1291
  "ONE_TO_ONE",
1186
1292
  "ONE_TO_MANY"
1187
1293
  ]);
1188
- var OnDeleteBehaviorSchema = z7.enum(["NONE", "CASCADE", "RESTRICT"]);
1189
- var RelationshipLinkSchema = z7.object({
1190
- model: z7.string(),
1191
- field: z7.string(),
1192
- label: z7.string()
1294
+ var OnDeleteBehaviorSchema = z8.enum(["NONE", "CASCADE", "RESTRICT"]);
1295
+ var RelationshipLinkSchema = z8.object({
1296
+ model: z8.string(),
1297
+ field: z8.string(),
1298
+ label: z8.string()
1193
1299
  });
1194
- var RelationshipDefinitionSchema = z7.object({
1300
+ var RelationshipDefinitionSchema = z8.object({
1195
1301
  source: RelationshipLinkSchema,
1196
1302
  target: RelationshipLinkSchema,
1197
1303
  cardinality: RelationshipCardinalitySchema,
1198
1304
  onDelete: OnDeleteBehaviorSchema.default("NONE")
1199
1305
  });
1200
- var ChannelCapabilityTypeSchema = z7.enum([
1306
+ var ChannelCapabilityTypeSchema = z8.enum([
1201
1307
  "messaging",
1202
1308
  // Text-based: SMS, WhatsApp, Messenger, DMs
1203
1309
  "voice",
@@ -1205,323 +1311,329 @@ var ChannelCapabilityTypeSchema = z7.enum([
1205
1311
  "video"
1206
1312
  // Video calls (future)
1207
1313
  ]);
1208
- var ChannelCapabilitySchema = z7.object({
1209
- label: z7.string(),
1314
+ var ChannelBatchCapabilitySchema = z8.object({
1315
+ send: z8.string(),
1316
+ get_status: z8.string()
1317
+ });
1318
+ var ChannelCapabilitySchema = z8.object({
1319
+ label: z8.string(),
1210
1320
  // Display name: "SMS", "WhatsApp Messages"
1211
- icon: z7.string().optional(),
1321
+ icon: z8.string().optional(),
1212
1322
  // Lucide icon name
1213
- receive: z7.string().optional(),
1323
+ receive: z8.string().optional(),
1214
1324
  // Inbound webhook handler
1215
- send: z7.string().optional()
1325
+ send: z8.string().optional(),
1216
1326
  // Outbound tool handle
1327
+ send_batch: z8.union([z8.string(), ChannelBatchCapabilitySchema]).optional()
1328
+ // Batch outbound tool handle, or { send, get_status }
1217
1329
  });
1218
- var ChannelFieldDefinitionSchema = z7.object({
1219
- handle: z7.string(),
1220
- label: z7.string(),
1330
+ var ChannelFieldDefinitionSchema = z8.object({
1331
+ handle: z8.string(),
1332
+ label: z8.string(),
1221
1333
  /** Field definition reference or inline definition */
1222
- definition: z7.union([InlineFieldDefinitionSchema, z7.string()]).optional(),
1334
+ definition: z8.union([InlineFieldDefinitionSchema, z8.string()]).optional(),
1223
1335
  /** Marks this field as the identifier field for the channel */
1224
- identifier: z7.boolean().optional(),
1336
+ identifier: z8.boolean().optional(),
1225
1337
  /** Whether this field is required */
1226
- required: z7.boolean().optional(),
1338
+ required: z8.boolean().optional(),
1227
1339
  /** Default value when creating a new field */
1228
- defaultValue: z7.object({ value: z7.unknown() }).passthrough().optional(),
1340
+ defaultValue: z8.object({ value: z8.unknown() }).passthrough().optional(),
1229
1341
  /** Visibility settings for the field */
1230
- visibility: z7.object({
1231
- data: z7.boolean().optional(),
1232
- list: z7.boolean().optional(),
1233
- filters: z7.boolean().optional()
1342
+ visibility: z8.object({
1343
+ data: z8.boolean().optional(),
1344
+ list: z8.boolean().optional(),
1345
+ filters: z8.boolean().optional()
1234
1346
  }).passthrough().optional(),
1235
1347
  /** Permission settings for the field */
1236
- permissions: z7.object({
1237
- read: z7.boolean().optional(),
1238
- write: z7.boolean().optional()
1348
+ permissions: z8.object({
1349
+ read: z8.boolean().optional(),
1350
+ write: z8.boolean().optional()
1239
1351
  }).passthrough().optional()
1240
1352
  }).passthrough();
1241
- var ChannelDefinitionSchema = z7.object({
1242
- handle: z7.string(),
1243
- label: z7.string(),
1244
- icon: z7.string().optional(),
1353
+ var ChannelDefinitionSchema = z8.object({
1354
+ handle: z8.string(),
1355
+ label: z8.string(),
1356
+ icon: z8.string().optional(),
1245
1357
  /** Array of field definitions for this channel. One field must have identifier: true. */
1246
- fields: z7.array(ChannelFieldDefinitionSchema),
1358
+ fields: z8.array(ChannelFieldDefinitionSchema),
1247
1359
  // Capabilities keyed by standard type (messaging, voice, video) - all optional
1248
- capabilities: z7.object({
1360
+ capabilities: z8.object({
1249
1361
  messaging: ChannelCapabilitySchema.optional(),
1250
1362
  voice: ChannelCapabilitySchema.optional(),
1251
1363
  video: ChannelCapabilitySchema.optional()
1252
1364
  })
1253
1365
  });
1254
- var WorkflowActionInputSchema = z7.object({
1255
- key: z7.string(),
1256
- label: z7.string(),
1257
- fieldRef: z7.object({
1258
- fieldHandle: z7.string(),
1259
- entityHandle: z7.string()
1366
+ var WorkflowActionInputSchema = z8.object({
1367
+ key: z8.string(),
1368
+ label: z8.string(),
1369
+ fieldRef: z8.object({
1370
+ fieldHandle: z8.string(),
1371
+ entityHandle: z8.string()
1260
1372
  }).optional(),
1261
- template: z7.string().optional()
1262
- });
1263
- var WorkflowActionSchema = z7.object({
1264
- label: z7.string(),
1265
- handle: z7.string(),
1266
- batch: z7.boolean().optional(),
1267
- entityHandle: z7.string().optional(),
1268
- inputs: z7.array(WorkflowActionInputSchema).optional()
1269
- });
1270
- var WorkflowDefinitionSchema = z7.object({
1271
- path: z7.string(),
1272
- label: z7.string().optional(),
1273
- handle: z7.string().optional(),
1274
- requires: z7.array(ResourceDependencySchema).optional(),
1275
- actions: z7.array(WorkflowActionSchema)
1276
- });
1277
- var PageTypeSchema = z7.enum(["INSTANCE", "LIST"]);
1278
- var PageBlockTypeSchema = z7.enum(["form", "spreadsheet", "kanban", "calendar", "link", "list", "card"]);
1279
- var PageFieldTypeSchema = z7.enum(["STRING", "FILE", "NUMBER", "DATE", "BOOLEAN", "SELECT", "FORM", "RELATIONSHIP"]);
1280
- var PageFieldSourceSchema = z7.object({
1281
- model: z7.string(),
1282
- field: z7.string()
1283
- });
1284
- var PageFormHeaderSchema = z7.object({
1285
- title: z7.string(),
1286
- description: z7.string().optional()
1287
- });
1288
- var PageActionDefinitionSchema = z7.object({
1289
- handle: z7.string(),
1290
- label: z7.string(),
1291
- handler: z7.string().optional(),
1292
- href: z7.string().optional(),
1293
- icon: z7.string().optional(),
1294
- variant: z7.enum(["primary", "secondary", "destructive", "outline"]).optional(),
1295
- isDisabled: z7.union([z7.boolean(), z7.string()]).optional(),
1296
- isHidden: z7.union([z7.boolean(), z7.string()]).optional()
1373
+ template: z8.string().optional()
1374
+ });
1375
+ var WorkflowActionSchema = z8.object({
1376
+ label: z8.string(),
1377
+ handle: z8.string(),
1378
+ batch: z8.boolean().optional(),
1379
+ entityHandle: z8.string().optional(),
1380
+ inputs: z8.array(WorkflowActionInputSchema).optional()
1381
+ });
1382
+ var WorkflowDefinitionSchema = z8.object({
1383
+ path: z8.string(),
1384
+ label: z8.string().optional(),
1385
+ handle: z8.string().optional(),
1386
+ requires: z8.array(ResourceDependencySchema).optional(),
1387
+ actions: z8.array(WorkflowActionSchema)
1388
+ });
1389
+ var PageTypeSchema = z8.enum(["INSTANCE", "LIST"]);
1390
+ var PageBlockTypeSchema = z8.enum(["form", "spreadsheet", "kanban", "calendar", "link", "list", "card"]);
1391
+ var PageFieldTypeSchema = z8.enum(["STRING", "FILE", "NUMBER", "DATE", "BOOLEAN", "SELECT", "FORM", "RELATIONSHIP"]);
1392
+ var PageFieldSourceSchema = z8.object({
1393
+ model: z8.string(),
1394
+ field: z8.string()
1395
+ });
1396
+ var PageFormHeaderSchema = z8.object({
1397
+ title: z8.string(),
1398
+ description: z8.string().optional()
1399
+ });
1400
+ var PageActionDefinitionSchema = z8.object({
1401
+ handle: z8.string(),
1402
+ label: z8.string(),
1403
+ handler: z8.string().optional(),
1404
+ href: z8.string().optional(),
1405
+ icon: z8.string().optional(),
1406
+ variant: z8.enum(["primary", "secondary", "destructive", "outline"]).optional(),
1407
+ isDisabled: z8.union([z8.boolean(), z8.string()]).optional(),
1408
+ isHidden: z8.union([z8.boolean(), z8.string()]).optional()
1297
1409
  }).refine((data) => Boolean(data.handler || data.href), {
1298
1410
  message: "Page action requires handler or href"
1299
1411
  });
1300
- var FormV2StylePropsSchema = z7.object({
1301
- id: z7.string(),
1302
- row: z7.number(),
1303
- col: z7.number(),
1304
- className: z7.string().optional(),
1305
- hidden: z7.boolean().optional()
1306
- });
1307
- var FieldSettingButtonPropsSchema = z7.object({
1308
- label: z7.string(),
1309
- variant: z7.enum(["default", "destructive", "outline", "secondary", "ghost", "link"]).optional(),
1310
- size: z7.enum(["default", "sm", "lg", "icon"]).optional(),
1311
- isLoading: z7.boolean().optional(),
1412
+ var FormV2StylePropsSchema = z8.object({
1413
+ id: z8.string(),
1414
+ row: z8.number(),
1415
+ col: z8.number(),
1416
+ className: z8.string().optional(),
1417
+ hidden: z8.boolean().optional()
1418
+ });
1419
+ var FieldSettingButtonPropsSchema = z8.object({
1420
+ label: z8.string(),
1421
+ variant: z8.enum(["default", "destructive", "outline", "secondary", "ghost", "link"]).optional(),
1422
+ size: z8.enum(["default", "sm", "lg", "icon"]).optional(),
1423
+ isLoading: z8.boolean().optional(),
1312
1424
  /** Can be boolean or Liquid template string that resolves to boolean */
1313
- isDisabled: z7.union([z7.boolean(), z7.string()]).optional(),
1314
- leftIcon: z7.string().optional()
1425
+ isDisabled: z8.union([z8.boolean(), z8.string()]).optional(),
1426
+ leftIcon: z8.string().optional()
1315
1427
  });
1316
- var RelationshipExtensionSchema = z7.object({
1317
- model: z7.string()
1428
+ var RelationshipExtensionSchema = z8.object({
1429
+ model: z8.string()
1318
1430
  });
1319
- var FormLayoutColumnDefinitionSchema = z7.object({
1320
- field: z7.string(),
1321
- colSpan: z7.number(),
1322
- dataType: z7.string().optional(),
1323
- subQuery: z7.unknown().optional()
1431
+ var FormLayoutColumnDefinitionSchema = z8.object({
1432
+ field: z8.string(),
1433
+ colSpan: z8.number(),
1434
+ dataType: z8.string().optional(),
1435
+ subQuery: z8.unknown().optional()
1324
1436
  });
1325
- var FormLayoutRowDefinitionSchema = z7.object({
1326
- columns: z7.array(FormLayoutColumnDefinitionSchema)
1437
+ var FormLayoutRowDefinitionSchema = z8.object({
1438
+ columns: z8.array(FormLayoutColumnDefinitionSchema)
1327
1439
  });
1328
- var FormLayoutConfigDefinitionSchema = z7.object({
1329
- type: z7.literal("form"),
1330
- rows: z7.array(FormLayoutRowDefinitionSchema)
1440
+ var FormLayoutConfigDefinitionSchema = z8.object({
1441
+ type: z8.literal("form"),
1442
+ rows: z8.array(FormLayoutRowDefinitionSchema)
1331
1443
  });
1332
1444
  var InputComponentDefinitionSchema = FormV2StylePropsSchema.extend({
1333
- component: z7.literal("Input"),
1334
- props: z7.object({
1335
- label: z7.string().optional(),
1336
- placeholder: z7.string().optional(),
1337
- helpText: z7.string().optional(),
1338
- type: z7.enum(["text", "number", "email", "password", "tel", "url", "hidden"]).optional(),
1339
- required: z7.boolean().optional(),
1340
- disabled: z7.boolean().optional(),
1341
- value: z7.union([z7.string(), z7.number()]).optional()
1445
+ component: z8.literal("Input"),
1446
+ props: z8.object({
1447
+ label: z8.string().optional(),
1448
+ placeholder: z8.string().optional(),
1449
+ helpText: z8.string().optional(),
1450
+ type: z8.enum(["text", "number", "email", "password", "tel", "url", "hidden"]).optional(),
1451
+ required: z8.boolean().optional(),
1452
+ disabled: z8.boolean().optional(),
1453
+ value: z8.union([z8.string(), z8.number()]).optional()
1342
1454
  })
1343
1455
  });
1344
1456
  var TextareaComponentDefinitionSchema = FormV2StylePropsSchema.extend({
1345
- component: z7.literal("Textarea"),
1346
- props: z7.object({
1347
- label: z7.string().optional(),
1348
- placeholder: z7.string().optional(),
1349
- helpText: z7.string().optional(),
1350
- required: z7.boolean().optional(),
1351
- disabled: z7.boolean().optional(),
1352
- value: z7.string().optional()
1457
+ component: z8.literal("Textarea"),
1458
+ props: z8.object({
1459
+ label: z8.string().optional(),
1460
+ placeholder: z8.string().optional(),
1461
+ helpText: z8.string().optional(),
1462
+ required: z8.boolean().optional(),
1463
+ disabled: z8.boolean().optional(),
1464
+ value: z8.string().optional()
1353
1465
  })
1354
1466
  });
1355
1467
  var SelectComponentDefinitionSchema = FormV2StylePropsSchema.extend({
1356
- component: z7.literal("Select"),
1357
- props: z7.object({
1358
- label: z7.string().optional(),
1359
- placeholder: z7.string().optional(),
1360
- helpText: z7.string().optional(),
1468
+ component: z8.literal("Select"),
1469
+ props: z8.object({
1470
+ label: z8.string().optional(),
1471
+ placeholder: z8.string().optional(),
1472
+ helpText: z8.string().optional(),
1361
1473
  /** Static items array (will be populated by iterable if using dynamic items) */
1362
- items: z7.union([z7.array(z7.object({ value: z7.string(), label: z7.string() })), z7.string()]).optional(),
1363
- value: z7.string().optional(),
1364
- isDisabled: z7.boolean().optional(),
1365
- required: z7.boolean().optional()
1474
+ items: z8.union([z8.array(z8.object({ value: z8.string(), label: z8.string() })), z8.string()]).optional(),
1475
+ value: z8.string().optional(),
1476
+ isDisabled: z8.boolean().optional(),
1477
+ required: z8.boolean().optional()
1366
1478
  }),
1367
1479
  relationship: RelationshipExtensionSchema.optional(),
1368
1480
  /** For dynamic items using iterable pattern (e.g., 'system.models') */
1369
- iterable: z7.string().optional(),
1481
+ iterable: z8.string().optional(),
1370
1482
  /** Template for each item in the iterable */
1371
- itemTemplate: z7.object({
1372
- value: z7.string(),
1373
- label: z7.string()
1483
+ itemTemplate: z8.object({
1484
+ value: z8.string(),
1485
+ label: z8.string()
1374
1486
  }).optional()
1375
1487
  });
1376
1488
  var ComboboxComponentDefinitionSchema = FormV2StylePropsSchema.extend({
1377
- component: z7.literal("Combobox"),
1378
- props: z7.object({
1379
- label: z7.string().optional(),
1380
- placeholder: z7.string().optional(),
1381
- helpText: z7.string().optional(),
1382
- items: z7.array(z7.object({ value: z7.string(), label: z7.string() })).optional(),
1383
- value: z7.string().optional()
1489
+ component: z8.literal("Combobox"),
1490
+ props: z8.object({
1491
+ label: z8.string().optional(),
1492
+ placeholder: z8.string().optional(),
1493
+ helpText: z8.string().optional(),
1494
+ items: z8.array(z8.object({ value: z8.string(), label: z8.string() })).optional(),
1495
+ value: z8.string().optional()
1384
1496
  }),
1385
1497
  relationship: RelationshipExtensionSchema.optional()
1386
1498
  });
1387
1499
  var CheckboxComponentDefinitionSchema = FormV2StylePropsSchema.extend({
1388
- component: z7.literal("Checkbox"),
1389
- props: z7.object({
1390
- label: z7.string().optional(),
1391
- helpText: z7.string().optional(),
1392
- checked: z7.boolean().optional(),
1393
- disabled: z7.boolean().optional()
1500
+ component: z8.literal("Checkbox"),
1501
+ props: z8.object({
1502
+ label: z8.string().optional(),
1503
+ helpText: z8.string().optional(),
1504
+ checked: z8.boolean().optional(),
1505
+ disabled: z8.boolean().optional()
1394
1506
  })
1395
1507
  });
1396
1508
  var DatePickerComponentDefinitionSchema = FormV2StylePropsSchema.extend({
1397
- component: z7.literal("DatePicker"),
1398
- props: z7.object({
1399
- label: z7.string().optional(),
1400
- helpText: z7.string().optional(),
1401
- value: z7.union([z7.string(), z7.date()]).optional(),
1402
- disabled: z7.boolean().optional()
1509
+ component: z8.literal("DatePicker"),
1510
+ props: z8.object({
1511
+ label: z8.string().optional(),
1512
+ helpText: z8.string().optional(),
1513
+ value: z8.union([z8.string(), z8.date()]).optional(),
1514
+ disabled: z8.boolean().optional()
1403
1515
  })
1404
1516
  });
1405
1517
  var TimePickerComponentDefinitionSchema = FormV2StylePropsSchema.extend({
1406
- component: z7.literal("TimePicker"),
1407
- props: z7.object({
1408
- label: z7.string().optional(),
1409
- helpText: z7.string().optional(),
1410
- value: z7.string().optional(),
1411
- disabled: z7.boolean().optional()
1518
+ component: z8.literal("TimePicker"),
1519
+ props: z8.object({
1520
+ label: z8.string().optional(),
1521
+ helpText: z8.string().optional(),
1522
+ value: z8.string().optional(),
1523
+ disabled: z8.boolean().optional()
1412
1524
  })
1413
1525
  });
1414
1526
  var ImageSettingComponentDefinitionSchema = FormV2StylePropsSchema.extend({
1415
- component: z7.literal("ImageSetting"),
1416
- props: z7.object({
1417
- label: z7.string().optional(),
1418
- description: z7.string().optional(),
1419
- helpText: z7.string().optional(),
1420
- accept: z7.string().optional()
1527
+ component: z8.literal("ImageSetting"),
1528
+ props: z8.object({
1529
+ label: z8.string().optional(),
1530
+ description: z8.string().optional(),
1531
+ helpText: z8.string().optional(),
1532
+ accept: z8.string().optional()
1421
1533
  })
1422
1534
  });
1423
1535
  var FileSettingComponentDefinitionSchema = FormV2StylePropsSchema.extend({
1424
- component: z7.literal("FileSetting"),
1425
- props: z7.object({
1426
- label: z7.string().optional(),
1427
- description: z7.string().optional(),
1428
- helpText: z7.string().optional(),
1429
- accept: z7.string().optional(),
1430
- required: z7.boolean().optional(),
1431
- button: z7.object({
1432
- label: z7.string().optional(),
1433
- variant: z7.enum(["default", "outline", "ghost", "link"]).optional(),
1434
- size: z7.enum(["sm", "md", "lg"]).optional()
1536
+ component: z8.literal("FileSetting"),
1537
+ props: z8.object({
1538
+ label: z8.string().optional(),
1539
+ description: z8.string().optional(),
1540
+ helpText: z8.string().optional(),
1541
+ accept: z8.string().optional(),
1542
+ required: z8.boolean().optional(),
1543
+ button: z8.object({
1544
+ label: z8.string().optional(),
1545
+ variant: z8.enum(["default", "outline", "ghost", "link"]).optional(),
1546
+ size: z8.enum(["sm", "md", "lg"]).optional()
1435
1547
  }).optional()
1436
1548
  })
1437
1549
  });
1438
- var ListItemTemplateSchema = z7.object({
1439
- component: z7.string(),
1440
- span: z7.number().optional(),
1441
- mdSpan: z7.number().optional(),
1442
- lgSpan: z7.number().optional(),
1443
- props: z7.record(z7.string(), z7.unknown())
1550
+ var ListItemTemplateSchema = z8.object({
1551
+ component: z8.string(),
1552
+ span: z8.number().optional(),
1553
+ mdSpan: z8.number().optional(),
1554
+ lgSpan: z8.number().optional(),
1555
+ props: z8.record(z8.string(), z8.unknown())
1444
1556
  });
1445
1557
  var ListComponentDefinitionSchema = FormV2StylePropsSchema.extend({
1446
- component: z7.literal("List"),
1447
- props: z7.object({
1448
- title: z7.string().optional(),
1449
- items: z7.array(z7.object({
1450
- id: z7.string(),
1451
- label: z7.string(),
1452
- description: z7.string().optional()
1558
+ component: z8.literal("List"),
1559
+ props: z8.object({
1560
+ title: z8.string().optional(),
1561
+ items: z8.array(z8.object({
1562
+ id: z8.string(),
1563
+ label: z8.string(),
1564
+ description: z8.string().optional()
1453
1565
  })).optional(),
1454
- emptyMessage: z7.string().optional()
1566
+ emptyMessage: z8.string().optional()
1455
1567
  }),
1456
- model: z7.string().optional(),
1457
- labelField: z7.string().optional(),
1458
- descriptionField: z7.string().optional(),
1459
- icon: z7.string().optional(),
1568
+ model: z8.string().optional(),
1569
+ labelField: z8.string().optional(),
1570
+ descriptionField: z8.string().optional(),
1571
+ icon: z8.string().optional(),
1460
1572
  /** Context variable name to iterate over (e.g., 'phone_numbers') */
1461
- iterable: z7.string().optional(),
1573
+ iterable: z8.string().optional(),
1462
1574
  /** Template for each item - use {{ item.xyz }} for field values */
1463
1575
  itemTemplate: ListItemTemplateSchema.optional()
1464
1576
  });
1465
1577
  var EmptyFormComponentDefinitionSchema = FormV2StylePropsSchema.extend({
1466
- component: z7.literal("EmptyForm"),
1467
- props: z7.object({
1468
- title: z7.string().optional(),
1469
- description: z7.string().optional(),
1470
- icon: z7.string().optional()
1578
+ component: z8.literal("EmptyForm"),
1579
+ props: z8.object({
1580
+ title: z8.string().optional(),
1581
+ description: z8.string().optional(),
1582
+ icon: z8.string().optional()
1471
1583
  })
1472
1584
  });
1473
1585
  var AlertComponentDefinitionSchema = FormV2StylePropsSchema.extend({
1474
- component: z7.literal("Alert"),
1475
- props: z7.object({
1476
- title: z7.string(),
1477
- description: z7.string(),
1478
- icon: z7.string().optional(),
1479
- variant: z7.enum(["default", "destructive"]).optional()
1586
+ component: z8.literal("Alert"),
1587
+ props: z8.object({
1588
+ title: z8.string(),
1589
+ description: z8.string(),
1590
+ icon: z8.string().optional(),
1591
+ variant: z8.enum(["default", "destructive"]).optional()
1480
1592
  })
1481
1593
  });
1482
1594
  var EventWiringPanelComponentDefinitionSchema = FormV2StylePropsSchema.extend({
1483
- component: z7.literal("EventWiringPanel"),
1484
- props: z7.object({
1485
- eventTypes: z7.array(
1486
- z7.object({
1487
- type: z7.string(),
1488
- label: z7.string(),
1489
- glofoxType: z7.string().optional(),
1490
- description: z7.string().optional(),
1491
- icon: z7.string().optional()
1595
+ component: z8.literal("EventWiringPanel"),
1596
+ props: z8.object({
1597
+ eventTypes: z8.array(
1598
+ z8.object({
1599
+ type: z8.string(),
1600
+ label: z8.string(),
1601
+ glofoxType: z8.string().optional(),
1602
+ description: z8.string().optional(),
1603
+ icon: z8.string().optional()
1492
1604
  })
1493
1605
  ),
1494
- recommendedWorkflowHandle: z7.string().optional()
1606
+ recommendedWorkflowHandle: z8.string().optional()
1495
1607
  })
1496
1608
  });
1497
- var ModalFormDefinitionSchema = z7.object({
1609
+ var ModalFormDefinitionSchema = z8.object({
1498
1610
  header: PageFormHeaderSchema,
1499
- handler: z7.string(),
1611
+ handler: z8.string(),
1500
1612
  /** Named dialog template to use instead of inline fields */
1501
- template: z7.string().optional(),
1613
+ template: z8.string().optional(),
1502
1614
  /** Template-specific params to pass to the dialog */
1503
- templateParams: z7.record(z7.string(), z7.unknown()).optional(),
1615
+ templateParams: z8.record(z8.string(), z8.unknown()).optional(),
1504
1616
  /** Inline field definitions (used when template is not specified) */
1505
- fields: z7.lazy(() => z7.array(FormV2ComponentDefinitionSchema)).optional(),
1617
+ fields: z8.lazy(() => z8.array(FormV2ComponentDefinitionSchema)).optional(),
1506
1618
  layout: FormLayoutConfigDefinitionSchema.optional(),
1507
- actions: z7.array(PageActionDefinitionSchema).optional()
1619
+ actions: z8.array(PageActionDefinitionSchema).optional()
1508
1620
  });
1509
1621
  var FieldSettingComponentDefinitionSchema = FormV2StylePropsSchema.extend({
1510
- component: z7.literal("FieldSetting"),
1511
- props: z7.object({
1512
- label: z7.string(),
1513
- description: z7.string().optional(),
1514
- helpText: z7.string().optional(),
1515
- mode: z7.enum(["field", "setting"]).optional(),
1622
+ component: z8.literal("FieldSetting"),
1623
+ props: z8.object({
1624
+ label: z8.string(),
1625
+ description: z8.string().optional(),
1626
+ helpText: z8.string().optional(),
1627
+ mode: z8.enum(["field", "setting"]).optional(),
1516
1628
  /** Status indicator - can be literal or Liquid template */
1517
- status: z7.string().optional(),
1629
+ status: z8.string().optional(),
1518
1630
  /** Text to display alongside status badge - can be Liquid template */
1519
- statusText: z7.string().optional(),
1631
+ statusText: z8.string().optional(),
1520
1632
  button: FieldSettingButtonPropsSchema
1521
1633
  }),
1522
1634
  modalForm: ModalFormDefinitionSchema.optional()
1523
1635
  });
1524
- var FormV2ComponentDefinitionSchema = z7.discriminatedUnion("component", [
1636
+ var FormV2ComponentDefinitionSchema = z8.discriminatedUnion("component", [
1525
1637
  InputComponentDefinitionSchema,
1526
1638
  TextareaComponentDefinitionSchema,
1527
1639
  SelectComponentDefinitionSchema,
@@ -1537,82 +1649,82 @@ var FormV2ComponentDefinitionSchema = z7.discriminatedUnion("component", [
1537
1649
  AlertComponentDefinitionSchema,
1538
1650
  EventWiringPanelComponentDefinitionSchema
1539
1651
  ]);
1540
- var FormV2PropsDefinitionSchema = z7.object({
1541
- formVersion: z7.literal("v2"),
1542
- id: z7.string().optional(),
1543
- fields: z7.array(FormV2ComponentDefinitionSchema),
1652
+ var FormV2PropsDefinitionSchema = z8.object({
1653
+ formVersion: z8.literal("v2"),
1654
+ id: z8.string().optional(),
1655
+ fields: z8.array(FormV2ComponentDefinitionSchema),
1544
1656
  layout: FormLayoutConfigDefinitionSchema,
1545
1657
  /** Optional actions that trigger MCP tool calls */
1546
- actions: z7.array(PageActionDefinitionSchema).optional()
1658
+ actions: z8.array(PageActionDefinitionSchema).optional()
1547
1659
  });
1548
- var CardBlockHeaderSchema = z7.object({
1549
- title: z7.string(),
1550
- description: z7.string().optional(),
1551
- descriptionHref: z7.string().optional()
1660
+ var CardBlockHeaderSchema = z8.object({
1661
+ title: z8.string(),
1662
+ description: z8.string().optional(),
1663
+ descriptionHref: z8.string().optional()
1552
1664
  });
1553
- var CardBlockDefinitionSchema = z7.object({
1554
- type: z7.literal("card"),
1555
- restructurable: z7.boolean().optional(),
1665
+ var CardBlockDefinitionSchema = z8.object({
1666
+ type: z8.literal("card"),
1667
+ restructurable: z8.boolean().optional(),
1556
1668
  header: CardBlockHeaderSchema.optional(),
1557
1669
  form: FormV2PropsDefinitionSchema,
1558
- actions: z7.array(PageActionDefinitionSchema).optional(),
1559
- secondaryActions: z7.array(PageActionDefinitionSchema).optional(),
1560
- primaryActions: z7.array(PageActionDefinitionSchema).optional()
1670
+ actions: z8.array(PageActionDefinitionSchema).optional(),
1671
+ secondaryActions: z8.array(PageActionDefinitionSchema).optional(),
1672
+ primaryActions: z8.array(PageActionDefinitionSchema).optional()
1561
1673
  });
1562
- var PageFieldDefinitionBaseSchema = z7.object({
1563
- handle: z7.string(),
1674
+ var PageFieldDefinitionBaseSchema = z8.object({
1675
+ handle: z8.string(),
1564
1676
  type: PageFieldTypeSchema,
1565
- label: z7.string(),
1566
- description: z7.string().optional(),
1567
- required: z7.boolean().optional(),
1568
- handler: z7.string().optional(),
1677
+ label: z8.string(),
1678
+ description: z8.string().optional(),
1679
+ required: z8.boolean().optional(),
1680
+ handler: z8.string().optional(),
1569
1681
  source: PageFieldSourceSchema.optional(),
1570
- options: z7.array(z7.object({ value: z7.string(), label: z7.string() })).optional(),
1571
- accept: z7.string().optional(),
1572
- model: z7.string().optional()
1682
+ options: z8.array(z8.object({ value: z8.string(), label: z8.string() })).optional(),
1683
+ accept: z8.string().optional(),
1684
+ model: z8.string().optional()
1573
1685
  });
1574
1686
  var PageFieldDefinitionSchema = PageFieldDefinitionBaseSchema.extend({
1575
1687
  header: PageFormHeaderSchema.optional(),
1576
- fields: z7.lazy(() => z7.array(PageFieldDefinitionSchema)).optional(),
1577
- actions: z7.lazy(() => z7.array(PageActionDefinitionSchema)).optional()
1578
- });
1579
- var LegacyFormBlockDefinitionSchema = z7.object({
1580
- type: z7.enum(["form", "spreadsheet", "kanban", "calendar", "link"]),
1581
- title: z7.string().optional(),
1582
- fields: z7.array(PageFieldDefinitionSchema).optional(),
1583
- readonly: z7.boolean().optional()
1584
- });
1585
- var ListBlockDefinitionSchema = z7.object({
1586
- type: z7.literal("list"),
1587
- title: z7.string().optional(),
1588
- model: z7.string(),
1589
- labelField: z7.string().optional(),
1590
- descriptionField: z7.string().optional(),
1591
- icon: z7.string().optional(),
1592
- emptyMessage: z7.string().optional()
1593
- });
1594
- var ModelMapperBlockDefinitionSchema = z7.object({
1595
- type: z7.literal("model_mapper"),
1688
+ fields: z8.lazy(() => z8.array(PageFieldDefinitionSchema)).optional(),
1689
+ actions: z8.lazy(() => z8.array(PageActionDefinitionSchema)).optional()
1690
+ });
1691
+ var LegacyFormBlockDefinitionSchema = z8.object({
1692
+ type: z8.enum(["form", "spreadsheet", "kanban", "calendar", "link"]),
1693
+ title: z8.string().optional(),
1694
+ fields: z8.array(PageFieldDefinitionSchema).optional(),
1695
+ readonly: z8.boolean().optional()
1696
+ });
1697
+ var ListBlockDefinitionSchema = z8.object({
1698
+ type: z8.literal("list"),
1699
+ title: z8.string().optional(),
1700
+ model: z8.string(),
1701
+ labelField: z8.string().optional(),
1702
+ descriptionField: z8.string().optional(),
1703
+ icon: z8.string().optional(),
1704
+ emptyMessage: z8.string().optional()
1705
+ });
1706
+ var ModelMapperBlockDefinitionSchema = z8.object({
1707
+ type: z8.literal("model_mapper"),
1596
1708
  /** The SHARED model handle from install config (e.g., "client", "patient") */
1597
- model: z7.string()
1709
+ model: z8.string()
1598
1710
  });
1599
- var PageBlockDefinitionSchema = z7.union([
1711
+ var PageBlockDefinitionSchema = z8.union([
1600
1712
  CardBlockDefinitionSchema,
1601
1713
  LegacyFormBlockDefinitionSchema,
1602
1714
  ListBlockDefinitionSchema,
1603
1715
  ModelMapperBlockDefinitionSchema
1604
1716
  ]);
1605
- var PageContextModeSchema = z7.enum(["first", "many", "count", "all"]).transform((val) => val === "all" ? "many" : val);
1606
- var PageContextFiltersSchema = z7.record(
1607
- z7.string(),
1608
- z7.record(
1609
- z7.string(),
1610
- z7.union([PrimitiveSchema, z7.array(PrimitiveSchema), z7.string()])
1717
+ var PageContextModeSchema = z8.enum(["first", "many", "count", "all"]).transform((val) => val === "all" ? "many" : val);
1718
+ var PageContextFiltersSchema = z8.record(
1719
+ z8.string(),
1720
+ z8.record(
1721
+ z8.string(),
1722
+ z8.union([PrimitiveSchema, z8.array(PrimitiveSchema), z8.string()])
1611
1723
  )
1612
1724
  );
1613
- var PageContextItemDefinitionSchema = z7.object({
1725
+ var PageContextItemDefinitionSchema = z8.object({
1614
1726
  /** Model handle to fetch data from */
1615
- model: z7.string(),
1727
+ model: z8.string(),
1616
1728
  /** Fetch mode: 'first' returns single object, 'many' returns array, 'count' returns number */
1617
1729
  mode: PageContextModeSchema,
1618
1730
  /**
@@ -1622,69 +1734,69 @@ var PageContextItemDefinitionSchema = z7.object({
1622
1734
  */
1623
1735
  filters: PageContextFiltersSchema.optional(),
1624
1736
  /** Optional limit for 'many' mode */
1625
- limit: z7.number().optional()
1737
+ limit: z8.number().optional()
1626
1738
  });
1627
- var PageContextToolItemDefinitionSchema = z7.object({
1739
+ var PageContextToolItemDefinitionSchema = z8.object({
1628
1740
  /** Tool name to invoke for fetching context data */
1629
- tool: z7.string()
1741
+ tool: z8.string()
1630
1742
  });
1631
- var PageContextDefinitionSchema = z7.record(
1632
- z7.string(),
1633
- z7.union([PageContextItemDefinitionSchema, PageContextToolItemDefinitionSchema])
1743
+ var PageContextDefinitionSchema = z8.record(
1744
+ z8.string(),
1745
+ z8.union([PageContextItemDefinitionSchema, PageContextToolItemDefinitionSchema])
1634
1746
  );
1635
- var PageInstanceFilterSchema = z7.object({
1636
- model: z7.string(),
1637
- where: z7.record(z7.string(), z7.unknown()).optional()
1747
+ var PageInstanceFilterSchema = z8.object({
1748
+ model: z8.string(),
1749
+ where: z8.record(z8.string(), z8.unknown()).optional()
1638
1750
  });
1639
- var NavigationItemSchema = z7.object({
1751
+ var NavigationItemSchema = z8.object({
1640
1752
  /** Display label (supports Liquid templates) */
1641
- label: z7.string(),
1753
+ label: z8.string(),
1642
1754
  /** URL href (supports Liquid templates with path_params and context) */
1643
- href: z7.string(),
1755
+ href: z8.string(),
1644
1756
  /** Optional icon name */
1645
- icon: z7.string().optional(),
1757
+ icon: z8.string().optional(),
1646
1758
  /** When true, item is omitted from rendered navigation (supports Liquid templates) */
1647
- hidden: z7.union([z7.boolean(), z7.string()]).optional()
1759
+ hidden: z8.union([z8.boolean(), z8.string()]).optional()
1648
1760
  });
1649
- var NavigationSectionSchema = z7.object({
1761
+ var NavigationSectionSchema = z8.object({
1650
1762
  /** Section title (supports Liquid templates) */
1651
- title: z7.string().optional(),
1763
+ title: z8.string().optional(),
1652
1764
  /** Navigation items in this section */
1653
- items: z7.array(NavigationItemSchema)
1765
+ items: z8.array(NavigationItemSchema)
1654
1766
  });
1655
- var NavigationSidebarSchema = z7.object({
1767
+ var NavigationSidebarSchema = z8.object({
1656
1768
  /** Sections to display in the sidebar */
1657
- sections: z7.array(NavigationSectionSchema)
1769
+ sections: z8.array(NavigationSectionSchema)
1658
1770
  });
1659
- var BreadcrumbItemSchema = z7.object({
1771
+ var BreadcrumbItemSchema = z8.object({
1660
1772
  /** Display label (supports Liquid templates) */
1661
- label: z7.string(),
1773
+ label: z8.string(),
1662
1774
  /** Optional href - if not provided, item is not clickable */
1663
- href: z7.string().optional()
1775
+ href: z8.string().optional()
1664
1776
  });
1665
- var NavigationBreadcrumbSchema = z7.object({
1777
+ var NavigationBreadcrumbSchema = z8.object({
1666
1778
  /** Breadcrumb items from left to right */
1667
- items: z7.array(BreadcrumbItemSchema)
1779
+ items: z8.array(BreadcrumbItemSchema)
1668
1780
  });
1669
- var NavigationConfigSchema = z7.object({
1781
+ var NavigationConfigSchema = z8.object({
1670
1782
  /** Sidebar navigation */
1671
1783
  sidebar: NavigationSidebarSchema.optional(),
1672
1784
  /** Breadcrumb navigation */
1673
1785
  breadcrumb: NavigationBreadcrumbSchema.optional()
1674
1786
  });
1675
- var PageAudienceSchema = z7.enum(["install", "developer", "both"]);
1676
- var PageDefinitionSchema = z7.object({
1787
+ var PageAudienceSchema = z8.enum(["install", "developer", "both"]);
1788
+ var PageDefinitionSchema = z8.object({
1677
1789
  /** Unique identifier within the app (snake_case) */
1678
- handle: z7.string().optional(),
1790
+ handle: z8.string().optional(),
1679
1791
  /** Human-readable display name */
1680
- label: z7.string(),
1792
+ label: z8.string(),
1681
1793
  /** Optional description for documentation/UI */
1682
- description: z7.string().optional(),
1794
+ description: z8.string().optional(),
1683
1795
  type: PageTypeSchema,
1684
1796
  /** URL path for this page (e.g., '/phone-numbers' or '/phone-numbers/[id]' for dynamic segments) */
1685
- path: z7.string(),
1797
+ path: z8.string(),
1686
1798
  /** When true, this page is the default landing page for the app installation */
1687
- default: z7.boolean().optional(),
1799
+ default: z8.boolean().optional(),
1688
1800
  /**
1689
1801
  * Page audience:
1690
1802
  * - 'install': Visible only to app installers (default)
@@ -1698,115 +1810,171 @@ var PageDefinitionSchema = z7.object({
1698
1810
  * - string: Liquid template that evaluates to true/false
1699
1811
  * - NavigationConfigSchema: full navigation override for this page (replaces base navigation)
1700
1812
  */
1701
- navigation: z7.union([z7.boolean(), z7.string(), NavigationConfigSchema]).optional().default(true),
1702
- blocks: z7.array(PageBlockDefinitionSchema),
1703
- actions: z7.array(PageActionDefinitionSchema).optional(),
1813
+ navigation: z8.union([z8.boolean(), z8.string(), NavigationConfigSchema]).optional().default(true),
1814
+ blocks: z8.array(PageBlockDefinitionSchema),
1815
+ actions: z8.array(PageActionDefinitionSchema).optional(),
1704
1816
  /** Context data to load for Liquid templates. appInstallationId filtering is automatic. */
1705
1817
  context: PageContextDefinitionSchema.optional(),
1706
1818
  /** @deprecated Use context instead */
1707
1819
  filter: PageInstanceFilterSchema.optional()
1708
1820
  });
1709
- var WebhookHttpMethodSchema = z7.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]);
1710
- var WebhookTypeSchema = z7.enum(["WEBHOOK", "CALLBACK"]);
1711
- var WebhookHandlerDefinitionSchema = z7.object({
1712
- description: z7.string().optional(),
1713
- methods: z7.array(WebhookHttpMethodSchema).optional(),
1821
+ var WebhookHttpMethodSchema = z8.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]);
1822
+ var WebhookTypeSchema = z8.enum(["WEBHOOK", "CALLBACK"]);
1823
+ var WebhookHandlerDefinitionSchema = z8.object({
1824
+ description: z8.string().optional(),
1825
+ methods: z8.array(WebhookHttpMethodSchema).optional(),
1714
1826
  /** Invocation type: WEBHOOK (fire-and-forget) or CALLBACK (waits for response). Defaults to WEBHOOK. */
1715
1827
  type: WebhookTypeSchema.optional(),
1716
- handler: z7.unknown()
1828
+ handler: z8.unknown()
1717
1829
  });
1718
- var WebhooksSchema = z7.record(z7.string(), WebhookHandlerDefinitionSchema);
1719
- var AgentDefinitionSchema = z7.object({
1830
+ var WebhooksSchema = z8.record(z8.string(), WebhookHandlerDefinitionSchema);
1831
+ var AgentDefinitionSchema = z8.object({
1720
1832
  /** Unique identifier within the app (used for upserts) */
1721
- handle: z7.string().regex(/^[a-z0-9_-]+$/, "Handle must be lowercase alphanumeric with dashes/underscores"),
1833
+ handle: z8.string().regex(/^[a-z0-9_-]+$/, "Handle must be lowercase alphanumeric with dashes/underscores"),
1722
1834
  /** Display name */
1723
- name: z7.string().min(1),
1835
+ name: z8.string().min(1),
1724
1836
  /** Description of what the agent does */
1725
- description: z7.string(),
1837
+ description: z8.string(),
1726
1838
  /** System prompt (static, no templating) */
1727
- system: z7.string(),
1839
+ system: z8.string(),
1728
1840
  /** Tool names to bind (can be empty for orchestrator agents) */
1729
- tools: z7.array(z7.string()),
1841
+ tools: z8.array(z8.string()),
1730
1842
  /** Optional LLM model override */
1731
- llmModelId: z7.string().optional(),
1843
+ llmModelId: z8.string().optional(),
1732
1844
  /** Parent agent that can call this agent ('composer' or another agent handle) */
1733
- parentAgent: z7.string().optional()
1845
+ parentAgent: z8.string().optional()
1734
1846
  });
1735
- var InstallConfigSchema = z7.object({
1847
+ var InstallConfigSchema = z8.object({
1736
1848
  env: EnvSchemaSchema.optional(),
1737
1849
  /** SHARED model definitions (mapped to user's existing data during installation) */
1738
- models: z7.array(ModelDefinitionSchema).optional(),
1850
+ models: z8.array(ModelDefinitionSchema).optional(),
1739
1851
  /** Relationship definitions between SHARED models */
1740
- relationships: z7.array(RelationshipDefinitionSchema).optional()
1852
+ relationships: z8.array(RelationshipDefinitionSchema).optional()
1741
1853
  });
1742
- var ProvisionConfigSchema = z7.object({
1854
+ var ProvisionConfigSchema = z8.object({
1743
1855
  env: EnvSchemaSchema.optional(),
1744
1856
  /** INTERNAL model definitions (app-owned, not visible to users) */
1745
- models: z7.array(ModelDefinitionSchema).optional(),
1857
+ models: z8.array(ModelDefinitionSchema).optional(),
1746
1858
  /** Relationship definitions between INTERNAL models */
1747
- relationships: z7.array(RelationshipDefinitionSchema).optional(),
1748
- channels: z7.array(ChannelDefinitionSchema).optional(),
1749
- workflows: z7.array(WorkflowDefinitionSchema).optional(),
1859
+ relationships: z8.array(RelationshipDefinitionSchema).optional(),
1860
+ channels: z8.array(ChannelDefinitionSchema).optional(),
1861
+ workflows: z8.array(WorkflowDefinitionSchema).optional(),
1750
1862
  /** Base navigation configuration for all pages (can be overridden per page) */
1751
1863
  navigation: NavigationConfigSchema.optional(),
1752
- pages: z7.array(PageDefinitionSchema).optional()
1864
+ pages: z8.array(PageDefinitionSchema).optional()
1753
1865
  });
1754
- var SkedyulConfigSchema = z7.object({
1755
- name: z7.string(),
1756
- version: z7.string().optional(),
1757
- description: z7.string().optional(),
1866
+ var SkedyulConfigSchema = z8.object({
1867
+ name: z8.string(),
1868
+ version: z8.string().optional(),
1869
+ description: z8.string().optional(),
1758
1870
  computeLayer: ComputeLayerTypeSchema.optional(),
1759
- tools: z7.unknown().optional(),
1760
- webhooks: z7.unknown().optional(),
1761
- provision: z7.union([ProvisionConfigSchema, z7.unknown()]).optional(),
1762
- agents: z7.array(AgentDefinitionSchema).optional()
1871
+ tools: z8.unknown().optional(),
1872
+ webhooks: z8.unknown().optional(),
1873
+ provision: z8.union([ProvisionConfigSchema, z8.unknown()]).optional(),
1874
+ agents: z8.array(AgentDefinitionSchema).optional()
1763
1875
  });
1764
1876
  function safeParseConfig(data) {
1765
1877
  const result = SkedyulConfigSchema.safeParse(data);
1766
1878
  return result.success ? result.data : null;
1767
1879
  }
1768
- var MessageSendChannelSchema = z7.object({
1769
- id: z7.string(),
1770
- handle: z7.string(),
1771
- identifierValue: z7.string()
1772
- });
1773
- var MessageSendSubscriptionSchema = z7.object({
1774
- id: z7.string(),
1775
- identifierValue: z7.string()
1776
- });
1777
- var MessageSendContactSchema = z7.object({
1778
- id: z7.string(),
1779
- name: z7.string().optional()
1780
- });
1781
- var MessageSendRecipientSchema = z7.object({
1782
- address: z7.string(),
1783
- name: z7.string().optional(),
1784
- participantId: z7.string().optional(),
1785
- contactId: z7.string().optional()
1786
- });
1787
- var MessageSendAttachmentSchema = z7.object({
1788
- filename: z7.string(),
1789
- url: z7.string(),
1790
- mimeType: z7.string(),
1791
- size: z7.number()
1792
- });
1793
- var MessageSendMessageSchema = z7.object({
1794
- id: z7.string(),
1795
- content: z7.string(),
1796
- contentRaw: z7.string().optional(),
1797
- title: z7.string().optional(),
1798
- attachments: z7.array(MessageSendAttachmentSchema).optional()
1799
- });
1800
- var MessageSendInputSchema = z7.object({
1880
+ var MessageSendChannelSchema = z8.object({
1881
+ id: z8.string(),
1882
+ handle: z8.string(),
1883
+ identifierValue: z8.string()
1884
+ });
1885
+ var MessageSendSubscriptionSchema = z8.object({
1886
+ id: z8.string(),
1887
+ identifierValue: z8.string()
1888
+ });
1889
+ var MessageSendContactSchema = z8.object({
1890
+ id: z8.string(),
1891
+ name: z8.string().optional()
1892
+ });
1893
+ var MessageSendRecipientSchema = z8.object({
1894
+ address: z8.string(),
1895
+ name: z8.string().optional(),
1896
+ participantId: z8.string().optional(),
1897
+ contactId: z8.string().optional()
1898
+ });
1899
+ var MessageSendAttachmentSchema = z8.object({
1900
+ filename: z8.string(),
1901
+ url: z8.string(),
1902
+ mimeType: z8.string(),
1903
+ size: z8.number()
1904
+ });
1905
+ var MessageSendMessageSchema = z8.object({
1906
+ id: z8.string(),
1907
+ content: z8.string(),
1908
+ contentRaw: z8.string().optional(),
1909
+ title: z8.string().optional(),
1910
+ attachments: z8.array(MessageSendAttachmentSchema).optional()
1911
+ });
1912
+ var MessageSendInputSchema = z8.object({
1801
1913
  channel: MessageSendChannelSchema,
1802
1914
  subscription: MessageSendSubscriptionSchema.optional(),
1803
1915
  contact: MessageSendContactSchema.optional(),
1804
1916
  recipient: MessageSendRecipientSchema.optional(),
1805
1917
  message: MessageSendMessageSchema
1806
1918
  });
1807
- var MessageSendOutputSchema = z7.object({
1808
- status: z7.enum(["sent", "queued", "failed"]),
1809
- remoteId: z7.string().optional()
1919
+ var MessageSendOutputSchema = z8.object({
1920
+ status: z8.enum(["sent", "queued", "failed"]),
1921
+ remoteId: z8.string().optional()
1922
+ });
1923
+ var MessageBulkRecipientSchema = z8.object({
1924
+ address: z8.string(),
1925
+ renderedBody: z8.string(),
1926
+ instanceId: z8.string().optional(),
1927
+ threadId: z8.string().optional(),
1928
+ messageId: z8.string().optional(),
1929
+ contactId: z8.string().optional()
1930
+ });
1931
+ var MessageBulkSendInputSchema = z8.object({
1932
+ channel: MessageSendChannelSchema,
1933
+ recipients: z8.array(MessageBulkRecipientSchema).min(1).max(1e4),
1934
+ schedule: z8.object({ at: z8.string() }).optional()
1935
+ });
1936
+ var MessageBulkSendOutputSchema = z8.object({
1937
+ status: z8.enum(["accepted", "failed"]),
1938
+ operationId: z8.string().optional(),
1939
+ acceptedCount: z8.number().int().nonnegative(),
1940
+ rejectedCount: z8.number().int().nonnegative().optional()
1941
+ });
1942
+ var MessageBulkStatusMessageSchema = z8.object({
1943
+ address: z8.string(),
1944
+ status: z8.string(),
1945
+ messageId: z8.string().optional(),
1946
+ errorCode: z8.union([z8.string(), z8.number()]).optional(),
1947
+ errorMessage: z8.string().optional()
1948
+ });
1949
+ var MessageBulkStatusStatsSchema = z8.object({
1950
+ total: z8.number().int().nonnegative().optional(),
1951
+ recipients: z8.number().int().nonnegative().optional(),
1952
+ attempts: z8.number().int().nonnegative().optional(),
1953
+ unaddressable: z8.number().int().nonnegative().optional(),
1954
+ queued: z8.number().int().nonnegative().optional(),
1955
+ sent: z8.number().int().nonnegative().optional(),
1956
+ scheduled: z8.number().int().nonnegative().optional(),
1957
+ delivered: z8.number().int().nonnegative().optional(),
1958
+ read: z8.number().int().nonnegative().optional(),
1959
+ undelivered: z8.number().int().nonnegative().optional(),
1960
+ failed: z8.number().int().nonnegative().optional(),
1961
+ canceled: z8.number().int().nonnegative().optional()
1962
+ });
1963
+ var MessageBulkStatusInputSchema = z8.object({
1964
+ channel: MessageSendChannelSchema,
1965
+ operationId: z8.string().min(1)
1966
+ });
1967
+ var MessageBulkStatusOutputSchema = z8.object({
1968
+ operationId: z8.string(),
1969
+ status: z8.string(),
1970
+ complete: z8.boolean(),
1971
+ /**
1972
+ * When true, the provider skipped real delivery (e.g. MOCK_OUTBOUND_MESSAGES).
1973
+ * Core should mark all recipients in the operation as sent without per-message rows.
1974
+ */
1975
+ mock: z8.boolean().optional(),
1976
+ stats: MessageBulkStatusStatsSchema.optional(),
1977
+ messages: z8.array(MessageBulkStatusMessageSchema)
1810
1978
  });
1811
1979
  function isModelDependency(dep) {
1812
1980
  return "model" in dep;
@@ -1820,7 +1988,7 @@ function isWorkflowDependency(dep) {
1820
1988
 
1821
1989
  // src/server/index.ts
1822
1990
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
1823
- import * as z10 from "zod";
1991
+ import * as z11 from "zod";
1824
1992
 
1825
1993
  // src/core/service.ts
1826
1994
  var CoreApiService = class {
@@ -1929,17 +2097,20 @@ function getQueueConfigWithRetry(queueName) {
1929
2097
  }
1930
2098
 
1931
2099
  // src/server/utils/schema.ts
1932
- import * as z8 from "zod";
2100
+ import * as z9 from "zod";
1933
2101
  function normalizeBilling(billing) {
1934
- if (!billing || typeof billing.credits !== "number") {
2102
+ if (!billing || typeof billing !== "object") {
1935
2103
  return { credits: 0 };
1936
2104
  }
2105
+ if (typeof billing.credits !== "number") {
2106
+ return { ...billing, credits: 0 };
2107
+ }
1937
2108
  return billing;
1938
2109
  }
1939
2110
  function toJsonSchema(schema) {
1940
2111
  if (!schema) return void 0;
1941
2112
  try {
1942
- return z8.toJSONSchema(schema, {
2113
+ return z9.toJSONSchema(schema, {
1943
2114
  unrepresentable: "any"
1944
2115
  // Handle z.date(), z.bigint() etc gracefully
1945
2116
  });
@@ -1950,12 +2121,12 @@ function toJsonSchema(schema) {
1950
2121
  }
1951
2122
  function isToolSchemaWithJson(schema) {
1952
2123
  return Boolean(
1953
- schema && typeof schema === "object" && "zod" in schema && schema.zod instanceof z8.ZodType
2124
+ schema && typeof schema === "object" && "zod" in schema && schema.zod instanceof z9.ZodType
1954
2125
  );
1955
2126
  }
1956
2127
  function getZodSchema(schema) {
1957
2128
  if (!schema) return void 0;
1958
- if (schema instanceof z8.ZodType) {
2129
+ if (schema instanceof z9.ZodType) {
1959
2130
  return schema;
1960
2131
  }
1961
2132
  if (isToolSchemaWithJson(schema)) {
@@ -2102,7 +2273,7 @@ function buildToolCallErrorOutput(result) {
2102
2273
 
2103
2274
  // src/core/client.ts
2104
2275
  import { AsyncLocalStorage } from "async_hooks";
2105
- import { z as z9 } from "zod/v4";
2276
+ import { z as z10 } from "zod/v4";
2106
2277
  var requestConfigStorage = new AsyncLocalStorage();
2107
2278
  var globalConfig = {
2108
2279
  baseUrl: process.env.SKEDYUL_API_URL ?? process.env.SKEDYUL_NODE_URL ?? "",
@@ -3082,7 +3253,7 @@ var resource = {
3082
3253
  }
3083
3254
  };
3084
3255
  function zodSchemaToJsonSchema(schema) {
3085
- return z9.toJSONSchema(schema);
3256
+ return z10.toJSONSchema(schema);
3086
3257
  }
3087
3258
  var ai = {
3088
3259
  /**
@@ -3308,10 +3479,27 @@ function getActiveQueuedOperation() {
3308
3479
  function getActiveQueuedOperationStack() {
3309
3480
  return activeOperationStackStorage.getStore() ?? [];
3310
3481
  }
3311
- function isInsidePetbooqzCalendarBookingMutex() {
3312
- return getActiveQueuedOperationStack().some(
3313
- (operation) => operation.resolved.name === "petbooqz_calendar_booking" && operation.lease !== null
3314
- );
3482
+ function getActiveMutexQueueNames() {
3483
+ const names = /* @__PURE__ */ new Set();
3484
+ for (const operation of getActiveQueuedOperationStack()) {
3485
+ if (operation.lease === null) {
3486
+ continue;
3487
+ }
3488
+ const config = getQueueConfigWithRetry(operation.resolved.name);
3489
+ if (config?.mutex === true) {
3490
+ names.add(operation.resolved.name);
3491
+ }
3492
+ }
3493
+ return [...names];
3494
+ }
3495
+ function shouldSkipNestedAcquire(queueName) {
3496
+ for (const mutexQueueName of getActiveMutexQueueNames()) {
3497
+ const config = getQueueConfigWithRetry(mutexQueueName);
3498
+ if (config?.suppressesQueues?.includes(queueName)) {
3499
+ return true;
3500
+ }
3501
+ }
3502
+ return false;
3315
3503
  }
3316
3504
  function setActiveQueuedOperationLease(lease) {
3317
3505
  const op = activeOperationStorage.getStore();
@@ -3548,6 +3736,7 @@ function buildToolMetadata(registry) {
3548
3736
  const timeout = typeof rawTimeout === "number" && rawTimeout > 0 ? rawTimeout : 1e4;
3549
3737
  const retries = typeof rawRetries === "number" && rawRetries >= 1 ? rawRetries : 1;
3550
3738
  const queueTouchPoints = tool.queueTouchPoints ?? toolConfig.queueTouchPoints;
3739
+ const rateLimitHandoff = tool.rateLimitHandoff ?? toolConfig.rateLimitHandoff;
3551
3740
  return {
3552
3741
  name: tool.name,
3553
3742
  displayName: tool.label || tool.name,
@@ -3558,11 +3747,13 @@ function buildToolMetadata(registry) {
3558
3747
  timeout,
3559
3748
  retries,
3560
3749
  queueTouchPoints,
3750
+ rateLimitHandoff,
3561
3751
  config: {
3562
3752
  timeout,
3563
3753
  retries,
3564
3754
  completionHints: toolConfig.completionHints,
3565
- queueTouchPoints
3755
+ queueTouchPoints,
3756
+ rateLimitHandoff
3566
3757
  }
3567
3758
  };
3568
3759
  });
@@ -3604,7 +3795,8 @@ function createCallToolHandler(registry, state, onMaxRequests) {
3604
3795
  }
3605
3796
  const fn = tool.handler;
3606
3797
  const args = toolArgsInput ?? {};
3607
- const estimateMode = args.estimate === true;
3798
+ const rawContextForMode = args.context ?? {};
3799
+ const estimateMode = args.estimate === true || rawContextForMode.mode === "estimate";
3608
3800
  if (!estimateMode) {
3609
3801
  state.incrementRequestCount();
3610
3802
  if (state.shouldShutdown()) {
@@ -4091,7 +4283,8 @@ function serializeConfig(config) {
4091
4283
  // Read timeout/retries from top-level first, then fallback to config
4092
4284
  timeout: tool.timeout ?? tool.config?.timeout,
4093
4285
  retries: tool.retries ?? tool.config?.retries,
4094
- queueTouchPoints: tool.queueTouchPoints ?? tool.config?.queueTouchPoints
4286
+ queueTouchPoints: tool.queueTouchPoints ?? tool.config?.queueTouchPoints,
4287
+ rateLimitHandoff: tool.rateLimitHandoff ?? tool.config?.rateLimitHandoff
4095
4288
  })) : [],
4096
4289
  webhooks: webhookRegistry ? Object.values(webhookRegistry).map((w) => ({
4097
4290
  name: w.name,
@@ -4786,11 +4979,12 @@ async function handleMcpRoute(req, ctx) {
4786
4979
  async function handleMcpToolsCall(params, id, ctx) {
4787
4980
  const toolName = params?.name;
4788
4981
  const rawArgs = params?.arguments ?? {};
4789
- const hasSkedyulFormat = "inputs" in rawArgs || "env" in rawArgs || "context" in rawArgs || "invocation" in rawArgs;
4982
+ const hasSkedyulFormat = "inputs" in rawArgs || "env" in rawArgs || "context" in rawArgs || "invocation" in rawArgs || "estimate" in rawArgs;
4790
4983
  const toolInputs = hasSkedyulFormat ? rawArgs.inputs ?? {} : rawArgs;
4791
4984
  const toolContext = hasSkedyulFormat ? rawArgs.context : void 0;
4792
4985
  const toolEnv = hasSkedyulFormat ? rawArgs.env : void 0;
4793
4986
  const toolInvocation = hasSkedyulFormat ? rawArgs.invocation : void 0;
4987
+ const estimate = hasSkedyulFormat && rawArgs.estimate === true;
4794
4988
  const found = findToolInRegistry(ctx.registry, toolName);
4795
4989
  if (!found) {
4796
4990
  return {
@@ -4815,7 +5009,8 @@ async function handleMcpToolsCall(params, id, ctx) {
4815
5009
  inputs: validatedInputs,
4816
5010
  context: toolContext,
4817
5011
  env: toolEnv,
4818
- invocation: toolInvocation
5012
+ invocation: toolInvocation,
5013
+ estimate
4819
5014
  });
4820
5015
  let result;
4821
5016
  const isFailure2 = isToolCallFailure(toolResult);
@@ -5273,12 +5468,12 @@ function createSkedyulServer(config) {
5273
5468
  const toolDisplayName = tool.label || toolName;
5274
5469
  const inputZodSchema = getZodSchema(tool.inputSchema);
5275
5470
  const outputZodSchema = getZodSchema(tool.outputSchema);
5276
- const wrappedInputSchema = z10.object({
5277
- inputs: inputZodSchema ?? z10.record(z10.string(), z10.unknown()).optional(),
5278
- context: z10.record(z10.string(), z10.unknown()).optional(),
5279
- env: z10.record(z10.string(), z10.string()).optional(),
5280
- invocation: z10.record(z10.string(), z10.unknown()).optional(),
5281
- estimate: z10.boolean().optional()
5471
+ const wrappedInputSchema = z11.object({
5472
+ inputs: inputZodSchema ?? z11.record(z11.string(), z11.unknown()).optional(),
5473
+ context: z11.record(z11.string(), z11.unknown()).optional(),
5474
+ env: z11.record(z11.string(), z11.string()).optional(),
5475
+ invocation: z11.record(z11.string(), z11.unknown()).optional(),
5476
+ estimate: z11.boolean().optional()
5282
5477
  }).passthrough();
5283
5478
  mcpServer.registerTool(
5284
5479
  toolName,
@@ -5987,7 +6182,7 @@ async function executeWithRetries(operation, maxRetries) {
5987
6182
  operation.resolved.queueKey,
5988
6183
  rateLimitCtx
5989
6184
  );
5990
- if (operation.resolved.name === "petbooqz_api" && isInsidePetbooqzCalendarBookingMutex()) {
6185
+ if (shouldSkipNestedAcquire(operation.resolved.name)) {
5991
6186
  return operation.fn();
5992
6187
  }
5993
6188
  if (preAcquired) {
@@ -6091,86 +6286,86 @@ async function queuedFetchResponse(queueInput, url, init) {
6091
6286
  }
6092
6287
 
6093
6288
  // src/triggers/types.ts
6094
- import { z as z11 } from "zod/v4";
6095
- var CRMDataSchema = z11.object({
6096
- model: z11.string(),
6097
- instanceId: z11.string(),
6098
- data: z11.record(z11.string(), z11.unknown())
6289
+ import { z as z12 } from "zod/v4";
6290
+ var CRMDataSchema = z12.object({
6291
+ model: z12.string(),
6292
+ instanceId: z12.string(),
6293
+ data: z12.record(z12.string(), z12.unknown())
6099
6294
  });
6100
- var SenderContextSchema2 = z11.object({
6295
+ var SenderContextSchema2 = z12.object({
6101
6296
  kind: ParticipantKindSchema,
6102
- displayName: z11.string().optional(),
6297
+ displayName: z12.string().optional(),
6103
6298
  crm: CRMDataSchema.optional()
6104
6299
  });
6105
- var ThreadContextItemSchema2 = z11.object({
6106
- handle: z11.string(),
6107
- model: z11.string(),
6108
- instanceId: z11.string(),
6109
- data: z11.record(z11.string(), z11.unknown()).optional()
6300
+ var ThreadContextItemSchema2 = z12.object({
6301
+ handle: z12.string(),
6302
+ model: z12.string(),
6303
+ instanceId: z12.string(),
6304
+ data: z12.record(z12.string(), z12.unknown()).optional()
6110
6305
  });
6111
- var ParticipantContextSchema = z11.object({
6112
- id: z11.string(),
6306
+ var ParticipantContextSchema = z12.object({
6307
+ id: z12.string(),
6113
6308
  kind: ParticipantKindSchema,
6114
- displayName: z11.string().optional(),
6115
- contactId: z11.string().optional(),
6116
- memberId: z11.string().optional(),
6117
- agentId: z11.string().optional(),
6118
- workflowId: z11.string().optional()
6309
+ displayName: z12.string().optional(),
6310
+ contactId: z12.string().optional(),
6311
+ memberId: z12.string().optional(),
6312
+ agentId: z12.string().optional(),
6313
+ workflowId: z12.string().optional()
6119
6314
  });
6120
- var TriggerContextSchema = z11.object({
6315
+ var TriggerContextSchema = z12.object({
6121
6316
  // The event that triggered this
6122
- event: z11.object({
6317
+ event: z12.object({
6123
6318
  type: EventTypeSchema,
6124
- payload: z11.record(z11.string(), z11.unknown()),
6319
+ payload: z12.record(z12.string(), z12.unknown()),
6125
6320
  participant: ParticipantContextSchema.optional()
6126
6321
  }),
6127
6322
  // Thread information
6128
- thread: z11.object({
6129
- id: z11.string(),
6130
- title: z11.string().optional(),
6131
- status: z11.string().optional(),
6323
+ thread: z12.object({
6324
+ id: z12.string(),
6325
+ title: z12.string().optional(),
6326
+ status: z12.string().optional(),
6132
6327
  sender: SenderContextSchema2.optional(),
6133
- context: z11.record(z11.string(), CRMDataSchema).optional(),
6134
- participants: z11.array(ParticipantContextSchema).optional()
6328
+ context: z12.record(z12.string(), CRMDataSchema).optional(),
6329
+ participants: z12.array(ParticipantContextSchema).optional()
6135
6330
  }),
6136
6331
  // Workplace info
6137
- workplace: z11.object({
6138
- id: z11.string(),
6139
- name: z11.string().optional(),
6140
- settings: z11.record(z11.string(), z11.unknown()).optional()
6332
+ workplace: z12.object({
6333
+ id: z12.string(),
6334
+ name: z12.string().optional(),
6335
+ settings: z12.record(z12.string(), z12.unknown()).optional()
6141
6336
  })
6142
6337
  });
6143
- var InputMappingSchema = z11.record(z11.string(), z11.string());
6144
- var EventConditionsSchema = z11.record(z11.string(), z11.string());
6145
- var TriggerConfigSchema = z11.object({
6146
- id: z11.string(),
6147
- workflowId: z11.string(),
6148
- workflowVersionId: z11.string().optional(),
6149
- workplaceId: z11.string(),
6150
- handle: z11.string(),
6338
+ var InputMappingSchema = z12.record(z12.string(), z12.string());
6339
+ var EventConditionsSchema = z12.record(z12.string(), z12.string());
6340
+ var TriggerConfigSchema = z12.object({
6341
+ id: z12.string(),
6342
+ workflowId: z12.string(),
6343
+ workflowVersionId: z12.string().optional(),
6344
+ workplaceId: z12.string(),
6345
+ handle: z12.string(),
6151
6346
  // Input mappings: how to resolve workflow inputs from thread context
6152
6347
  inputMappings: InputMappingSchema.optional(),
6153
6348
  // Event conditions: additional workplace-specific conditions
6154
6349
  eventConditions: EventConditionsSchema.optional(),
6155
6350
  // Workplace-specific config overrides
6156
- config: z11.record(z11.string(), z11.unknown()).optional(),
6351
+ config: z12.record(z12.string(), z12.unknown()).optional(),
6157
6352
  // Trigger type and status
6158
- type: z11.string().optional(),
6159
- isEnabled: z11.boolean().optional()
6353
+ type: z12.string().optional(),
6354
+ isEnabled: z12.boolean().optional()
6160
6355
  });
6161
- var ResolvedTriggerSchema = z11.object({
6356
+ var ResolvedTriggerSchema = z12.object({
6162
6357
  trigger: TriggerConfigSchema,
6163
- workflow: z11.object({
6164
- id: z11.string(),
6165
- handle: z11.string(),
6166
- name: z11.string().optional(),
6167
- inputs: z11.record(z11.string(), z11.unknown()).optional(),
6168
- events: z11.object({
6169
- subscribes: z11.array(EventTypeSchema).optional(),
6170
- condition: z11.string().optional()
6358
+ workflow: z12.object({
6359
+ id: z12.string(),
6360
+ handle: z12.string(),
6361
+ name: z12.string().optional(),
6362
+ inputs: z12.record(z12.string(), z12.unknown()).optional(),
6363
+ events: z12.object({
6364
+ subscribes: z12.array(EventTypeSchema).optional(),
6365
+ condition: z12.string().optional()
6171
6366
  }).optional()
6172
6367
  }),
6173
- inputs: z11.record(z11.string(), z11.unknown()),
6368
+ inputs: z12.record(z12.string(), z12.unknown()),
6174
6369
  context: TriggerContextSchema
6175
6370
  });
6176
6371
  var TriggerResolutionError = class extends Error {
@@ -6181,13 +6376,13 @@ var TriggerResolutionError = class extends Error {
6181
6376
  this.name = "TriggerResolutionError";
6182
6377
  }
6183
6378
  };
6184
- var WorkflowInputDefinitionSchema = z11.object({
6185
- type: z11.string(),
6186
- required: z11.boolean().optional(),
6187
- description: z11.string().optional(),
6188
- default: z11.unknown().optional()
6379
+ var WorkflowInputDefinitionSchema = z12.object({
6380
+ type: z12.string(),
6381
+ required: z12.boolean().optional(),
6382
+ description: z12.string().optional(),
6383
+ default: z12.unknown().optional()
6189
6384
  });
6190
- var WorkflowInputSchemaSchema = z11.record(z11.string(), WorkflowInputDefinitionSchema);
6385
+ var WorkflowInputSchemaSchema = z12.record(z12.string(), WorkflowInputDefinitionSchema);
6191
6386
 
6192
6387
  // src/triggers/resolver.ts
6193
6388
  function evaluateTemplate(template, context) {
@@ -6269,67 +6464,67 @@ function matchesTrigger(trigger, eventType, context) {
6269
6464
  }
6270
6465
 
6271
6466
  // src/workflows/types.ts
6272
- import { z as z12 } from "zod/v4";
6467
+ import { z as z13 } from "zod/v4";
6273
6468
  var WORKFLOW_SCHEMA_VERSION = "https://skedyul.com/schemas/workflow/v1";
6274
- var WorkflowInputSchema = z12.object({
6275
- type: z12.string(),
6276
- required: z12.boolean().optional().default(false),
6277
- description: z12.string().optional(),
6278
- default: z12.unknown().optional()
6279
- });
6280
- var WorkflowStepInputSchema = z12.union([z12.string(), z12.number(), z12.boolean(), z12.record(z12.string(), z12.unknown())]);
6281
- var WorkflowStepSchema = z12.object({
6469
+ var WorkflowInputSchema = z13.object({
6470
+ type: z13.string(),
6471
+ required: z13.boolean().optional().default(false),
6472
+ description: z13.string().optional(),
6473
+ default: z13.unknown().optional()
6474
+ });
6475
+ var WorkflowStepInputSchema = z13.union([z13.string(), z13.number(), z13.boolean(), z13.record(z13.string(), z13.unknown())]);
6476
+ var WorkflowStepSchema = z13.object({
6282
6477
  // Service and command
6283
- service: z12.string(),
6284
- cmd: z12.string(),
6478
+ service: z13.string(),
6479
+ cmd: z13.string(),
6285
6480
  // Dependencies
6286
- needs: z12.array(z12.string()).optional(),
6481
+ needs: z13.array(z13.string()).optional(),
6287
6482
  // Inputs (Liquid templates supported)
6288
- inputs: z12.record(z12.string(), WorkflowStepInputSchema).optional(),
6483
+ inputs: z13.record(z13.string(), WorkflowStepInputSchema).optional(),
6289
6484
  // Conditional execution
6290
- condition: z12.string().optional(),
6485
+ condition: z13.string().optional(),
6291
6486
  // Retry configuration
6292
- retry: z12.object({
6293
- attempts: z12.number().optional(),
6294
- backoff: z12.enum(["linear", "exponential"]).optional()
6487
+ retry: z13.object({
6488
+ attempts: z13.number().optional(),
6489
+ backoff: z13.enum(["linear", "exponential"]).optional()
6295
6490
  }).optional(),
6296
6491
  // Timeout
6297
- timeout: z12.string().optional()
6298
- });
6299
- var WorkflowRuntimeSchema = z12.object({
6300
- durable: z12.boolean().optional().default(true),
6301
- timeout: z12.string().optional(),
6302
- retry: z12.object({
6303
- attempts: z12.number().optional(),
6304
- backoff: z12.enum(["linear", "exponential"]).optional()
6492
+ timeout: z13.string().optional()
6493
+ });
6494
+ var WorkflowRuntimeSchema = z13.object({
6495
+ durable: z13.boolean().optional().default(true),
6496
+ timeout: z13.string().optional(),
6497
+ retry: z13.object({
6498
+ attempts: z13.number().optional(),
6499
+ backoff: z13.enum(["linear", "exponential"]).optional()
6305
6500
  }).optional()
6306
6501
  });
6307
- var WorkflowYAMLSchema = z12.object({
6502
+ var WorkflowYAMLSchema = z13.object({
6308
6503
  // Schema version
6309
- $schema: z12.string().optional(),
6504
+ $schema: z13.string().optional(),
6310
6505
  // Identity
6311
- handle: z12.string(),
6312
- name: z12.string(),
6313
- version: z12.string().optional(),
6314
- description: z12.string().optional(),
6506
+ handle: z13.string(),
6507
+ name: z13.string(),
6508
+ version: z13.string().optional(),
6509
+ description: z13.string().optional(),
6315
6510
  // Inputs this workflow needs (portable, declared in YAML)
6316
- inputs: z12.record(z12.string(), WorkflowInputSchema).optional(),
6511
+ inputs: z13.record(z13.string(), WorkflowInputSchema).optional(),
6317
6512
  // Event subscriptions and conditions
6318
6513
  events: EventsConfigSchema.optional(),
6319
6514
  // Deterministic steps
6320
- steps: z12.record(z12.string(), WorkflowStepSchema),
6515
+ steps: z13.record(z13.string(), WorkflowStepSchema),
6321
6516
  // Runtime configuration
6322
6517
  runtime: WorkflowRuntimeSchema.optional()
6323
6518
  });
6324
- var WorkflowMetadataSchema = z12.object({
6325
- handle: z12.string(),
6326
- name: z12.string(),
6327
- version: z12.string().optional(),
6328
- description: z12.string().optional(),
6329
- inputs: z12.record(z12.string(), WorkflowInputDefinitionSchema).optional(),
6519
+ var WorkflowMetadataSchema = z13.object({
6520
+ handle: z13.string(),
6521
+ name: z13.string(),
6522
+ version: z13.string().optional(),
6523
+ description: z13.string().optional(),
6524
+ inputs: z13.record(z13.string(), WorkflowInputDefinitionSchema).optional(),
6330
6525
  events: EventsConfigSchema.optional()
6331
6526
  });
6332
- var WorkflowExecutionStatusSchema = z12.enum([
6527
+ var WorkflowExecutionStatusSchema = z13.enum([
6333
6528
  "PENDING",
6334
6529
  "RUNNING",
6335
6530
  "COMPLETED",
@@ -6337,14 +6532,14 @@ var WorkflowExecutionStatusSchema = z12.enum([
6337
6532
  "CANCELLED",
6338
6533
  "WAITING"
6339
6534
  ]);
6340
- var WorkflowExecutionResultSchema = z12.object({
6535
+ var WorkflowExecutionResultSchema = z13.object({
6341
6536
  status: WorkflowExecutionStatusSchema,
6342
- outputs: z12.record(z12.string(), z12.unknown()).optional(),
6343
- error: z12.string().optional(),
6344
- startedAt: z12.string().datetime().optional(),
6345
- completedAt: z12.string().datetime().optional(),
6346
- cancelledAt: z12.string().datetime().optional(),
6347
- cancelReason: z12.string().optional()
6537
+ outputs: z13.record(z13.string(), z13.unknown()).optional(),
6538
+ error: z13.string().optional(),
6539
+ startedAt: z13.string().datetime().optional(),
6540
+ completedAt: z13.string().datetime().optional(),
6541
+ cancelledAt: z13.string().datetime().optional(),
6542
+ cancelReason: z13.string().optional()
6348
6543
  });
6349
6544
  function defineWorkflowYAML(workflow) {
6350
6545
  return WorkflowYAMLSchema.parse(workflow);
@@ -6422,8 +6617,8 @@ function getAssociationByModel(context, model) {
6422
6617
  }
6423
6618
 
6424
6619
  // src/memory/types.ts
6425
- import { z as z13 } from "zod/v4";
6426
- var MemoryEntryTypeSchema = z13.enum([
6620
+ import { z as z14 } from "zod/v4";
6621
+ var MemoryEntryTypeSchema = z14.enum([
6427
6622
  "WORKING",
6428
6623
  // Current conversation context
6429
6624
  "OBSERVATION",
@@ -6433,80 +6628,80 @@ var MemoryEntryTypeSchema = z13.enum([
6433
6628
  "SEMANTIC"
6434
6629
  // Semantic memory for retrieval
6435
6630
  ]);
6436
- var MemoryEntrySchema = z13.object({
6437
- id: z13.string(),
6631
+ var MemoryEntrySchema = z14.object({
6632
+ id: z14.string(),
6438
6633
  type: MemoryEntryTypeSchema,
6439
- key: z13.string(),
6440
- value: z13.unknown(),
6441
- metadata: z13.record(z13.string(), z13.unknown()).optional(),
6442
- expiresAt: z13.string().datetime().optional(),
6443
- createdAt: z13.string().datetime(),
6444
- updatedAt: z13.string().datetime()
6445
- });
6446
- var WorkingMemoryConfigSchema2 = z13.object({
6447
- strategy: z13.enum(["full", "rolling_summary", "sliding_window"]).default("rolling_summary"),
6448
- maxTokens: z13.number().default(8e3),
6449
- summarizeAt: z13.number().optional(),
6450
- ttl: z13.string().optional()
6451
- });
6452
- var SemanticMemoryConfigSchema2 = z13.object({
6453
- enabled: z13.boolean().default(false),
6454
- topK: z13.number().default(5),
6455
- scope: z13.enum(["thread", "instance", "workspace"]).default("thread"),
6456
- minScore: z13.number().default(0.7)
6457
- });
6458
- var ExternalMemoryConfigSchema2 = z13.object({
6459
- namespace: z13.string(),
6460
- ttl: z13.string().optional()
6461
- });
6462
- var MemoryConfigSchema = z13.object({
6634
+ key: z14.string(),
6635
+ value: z14.unknown(),
6636
+ metadata: z14.record(z14.string(), z14.unknown()).optional(),
6637
+ expiresAt: z14.string().datetime().optional(),
6638
+ createdAt: z14.string().datetime(),
6639
+ updatedAt: z14.string().datetime()
6640
+ });
6641
+ var WorkingMemoryConfigSchema2 = z14.object({
6642
+ strategy: z14.enum(["full", "rolling_summary", "sliding_window"]).default("rolling_summary"),
6643
+ maxTokens: z14.number().default(8e3),
6644
+ summarizeAt: z14.number().optional(),
6645
+ ttl: z14.string().optional()
6646
+ });
6647
+ var SemanticMemoryConfigSchema2 = z14.object({
6648
+ enabled: z14.boolean().default(false),
6649
+ topK: z14.number().default(5),
6650
+ scope: z14.enum(["thread", "instance", "workspace"]).default("thread"),
6651
+ minScore: z14.number().default(0.7)
6652
+ });
6653
+ var ExternalMemoryConfigSchema2 = z14.object({
6654
+ namespace: z14.string(),
6655
+ ttl: z14.string().optional()
6656
+ });
6657
+ var MemoryConfigSchema = z14.object({
6463
6658
  working: WorkingMemoryConfigSchema2.optional(),
6464
6659
  semantic: SemanticMemoryConfigSchema2.optional(),
6465
6660
  external: ExternalMemoryConfigSchema2.optional(),
6466
- persistent: z13.object({
6467
- namespace: z13.string()
6661
+ persistent: z14.object({
6662
+ namespace: z14.string()
6468
6663
  }).optional()
6469
6664
  });
6470
- var MemoryScopeSchema = z13.object({
6471
- threadId: z13.string().optional(),
6472
- participantId: z13.string().optional(),
6473
- agentId: z13.string().optional(),
6474
- workplaceId: z13.string().optional(),
6475
- namespace: z13.string().optional()
6476
- });
6477
- var MemoryQueryOptionsSchema = z13.object({
6478
- types: z13.array(MemoryEntryTypeSchema).optional(),
6479
- keys: z13.array(z13.string()).optional(),
6480
- limit: z13.number().default(100),
6481
- includeExpired: z13.boolean().default(false)
6482
- });
6483
- var ConversationSummarySchema = z13.object({
6484
- summary: z13.string(),
6485
- keyPoints: z13.array(z13.string()),
6486
- entities: z13.array(z13.object({
6487
- name: z13.string(),
6488
- type: z13.string(),
6489
- relevance: z13.number()
6665
+ var MemoryScopeSchema = z14.object({
6666
+ threadId: z14.string().optional(),
6667
+ participantId: z14.string().optional(),
6668
+ agentId: z14.string().optional(),
6669
+ workplaceId: z14.string().optional(),
6670
+ namespace: z14.string().optional()
6671
+ });
6672
+ var MemoryQueryOptionsSchema = z14.object({
6673
+ types: z14.array(MemoryEntryTypeSchema).optional(),
6674
+ keys: z14.array(z14.string()).optional(),
6675
+ limit: z14.number().default(100),
6676
+ includeExpired: z14.boolean().default(false)
6677
+ });
6678
+ var ConversationSummarySchema = z14.object({
6679
+ summary: z14.string(),
6680
+ keyPoints: z14.array(z14.string()),
6681
+ entities: z14.array(z14.object({
6682
+ name: z14.string(),
6683
+ type: z14.string(),
6684
+ relevance: z14.number()
6490
6685
  })),
6491
- lastMessageId: z13.string().optional(),
6492
- messageCount: z13.number(),
6493
- tokenCount: z13.number(),
6494
- createdAt: z13.string().datetime()
6495
- });
6496
- var AgentObservationSchema = z13.object({
6497
- observation: z13.string(),
6498
- confidence: z13.number().min(0).max(1),
6499
- source: z13.enum(["inference", "explicit", "tool_result"]),
6500
- context: z13.record(z13.string(), z13.unknown()).optional(),
6501
- createdAt: z13.string().datetime()
6502
- });
6503
- var ExternalDataCacheSchema = z13.object({
6504
- source: z13.string(),
6505
- endpoint: z13.string().optional(),
6506
- data: z13.unknown(),
6507
- fetchedAt: z13.string().datetime(),
6508
- expiresAt: z13.string().datetime().optional(),
6509
- metadata: z13.record(z13.string(), z13.unknown()).optional()
6686
+ lastMessageId: z14.string().optional(),
6687
+ messageCount: z14.number(),
6688
+ tokenCount: z14.number(),
6689
+ createdAt: z14.string().datetime()
6690
+ });
6691
+ var AgentObservationSchema = z14.object({
6692
+ observation: z14.string(),
6693
+ confidence: z14.number().min(0).max(1),
6694
+ source: z14.enum(["inference", "explicit", "tool_result"]),
6695
+ context: z14.record(z14.string(), z14.unknown()).optional(),
6696
+ createdAt: z14.string().datetime()
6697
+ });
6698
+ var ExternalDataCacheSchema = z14.object({
6699
+ source: z14.string(),
6700
+ endpoint: z14.string().optional(),
6701
+ data: z14.unknown(),
6702
+ fetchedAt: z14.string().datetime(),
6703
+ expiresAt: z14.string().datetime().optional(),
6704
+ metadata: z14.record(z14.string(), z14.unknown()).optional()
6510
6705
  });
6511
6706
 
6512
6707
  // src/memory/service.ts
@@ -7097,16 +7292,16 @@ function estimateTokens(agent, skills) {
7097
7292
  }
7098
7293
 
7099
7294
  // src/scheduling/types.ts
7100
- import { z as z14 } from "zod/v4";
7101
- var TimeStampSchema = z14.union([
7102
- z14.number().describe("Hour of day (0-23)"),
7103
- z14.object({
7104
- hour: z14.number(),
7105
- minute: z14.number().optional().default(0),
7106
- second: z14.number().optional().default(0)
7295
+ import { z as z15 } from "zod/v4";
7296
+ var TimeStampSchema = z15.union([
7297
+ z15.number().describe("Hour of day (0-23)"),
7298
+ z15.object({
7299
+ hour: z15.number(),
7300
+ minute: z15.number().optional().default(0),
7301
+ second: z15.number().optional().default(0)
7107
7302
  })
7108
7303
  ]);
7109
- var DayOfWeekSchema = z14.enum([
7304
+ var DayOfWeekSchema = z15.enum([
7110
7305
  "monday",
7111
7306
  "tuesday",
7112
7307
  "wednesday",
@@ -7115,13 +7310,13 @@ var DayOfWeekSchema = z14.enum([
7115
7310
  "saturday",
7116
7311
  "sunday"
7117
7312
  ]);
7118
- var TimeWindowSlotSchema = z14.object({
7313
+ var TimeWindowSlotSchema = z15.object({
7119
7314
  startTime: TimeStampSchema,
7120
7315
  endTime: TimeStampSchema,
7121
- days: z14.array(DayOfWeekSchema),
7122
- timezone: z14.string().optional()
7316
+ days: z15.array(DayOfWeekSchema),
7317
+ timezone: z15.string().optional()
7123
7318
  });
7124
- var WaitUnitSchema = z14.enum([
7319
+ var WaitUnitSchema = z15.enum([
7125
7320
  "second",
7126
7321
  "seconds",
7127
7322
  "minute",
@@ -7137,17 +7332,17 @@ var WaitUnitSchema = z14.enum([
7137
7332
  "year",
7138
7333
  "years"
7139
7334
  ]);
7140
- var WaitInputRelativeSchema = z14.object({
7141
- mode: z14.literal("relative"),
7142
- amount: z14.number(),
7335
+ var WaitInputRelativeSchema = z15.object({
7336
+ mode: z15.literal("relative"),
7337
+ amount: z15.number(),
7143
7338
  unit: WaitUnitSchema,
7144
- windows: z14.array(TimeWindowSlotSchema).optional()
7339
+ windows: z15.array(TimeWindowSlotSchema).optional()
7145
7340
  });
7146
- var WaitInputAbsoluteSchema = z14.object({
7147
- mode: z14.literal("absolute"),
7148
- scheduleAt: z14.union([z14.string(), z14.number()])
7341
+ var WaitInputAbsoluteSchema = z15.object({
7342
+ mode: z15.literal("absolute"),
7343
+ scheduleAt: z15.union([z15.string(), z15.number()])
7149
7344
  });
7150
- var WaitInputSchema = z14.union([
7345
+ var WaitInputSchema = z15.union([
7151
7346
  WaitInputRelativeSchema,
7152
7347
  WaitInputAbsoluteSchema
7153
7348
  ]);
@@ -7457,8 +7652,62 @@ function isTimeInPolicy(date, policy) {
7457
7652
  return false;
7458
7653
  }
7459
7654
 
7655
+ // src/tools/sms/gsm7.ts
7656
+ var GSM7_BASIC = `@\xA3$\xA5\xE8\xE9\xF9\xEC\xF2\xC7
7657
+ \xD8\xF8\r\xC5\xE5\u0394_\u03A6\u0393\u039B\u03A9\u03A0\u03A8\u03A3\u0398\u039E\xC6\xE6\xDF\xC9 !"#\xA4%&'()*+,-./0123456789:;<=>?\xA1ABCDEFGHIJKLMNOPQRSTUVWXYZ\xC4\xD6\xD1\xDC\xA7\xBFabcdefghijklmnopqrstuvwxyz\xE4\xF6\xF1\xFC\xE0`;
7658
+ var GSM7_EXTENDED = "^{}\\[~]|\u20AC";
7659
+ var GSM7_BASIC_SET = new Set(GSM7_BASIC.split(""));
7660
+ var GSM7_EXTENDED_SET = new Set(GSM7_EXTENDED.split(""));
7661
+ function toGsm7(value) {
7662
+ if (value === null || value === void 0) {
7663
+ return "";
7664
+ }
7665
+ const str = String(value);
7666
+ let result = "";
7667
+ for (const char of str) {
7668
+ if (GSM7_BASIC_SET.has(char) || GSM7_EXTENDED_SET.has(char)) {
7669
+ result += char;
7670
+ }
7671
+ }
7672
+ return result;
7673
+ }
7674
+ function isGsm7Character(char) {
7675
+ return GSM7_BASIC_SET.has(char) || GSM7_EXTENDED_SET.has(char);
7676
+ }
7677
+ function countGsm7Septets(text) {
7678
+ let septets = 0;
7679
+ for (const char of text) {
7680
+ septets += GSM7_EXTENDED_SET.has(char) ? 2 : 1;
7681
+ }
7682
+ return septets;
7683
+ }
7684
+ function estimateSmsSegments(text) {
7685
+ const normalized = text ?? "";
7686
+ const characters = [...normalized].length;
7687
+ if (characters === 0) {
7688
+ return { encoding: "GSM-7", characters: 0, septets: 0, segments: 0 };
7689
+ }
7690
+ const isGsm7 = [...normalized].every(isGsm7Character);
7691
+ if (isGsm7) {
7692
+ const septets = countGsm7Septets(normalized);
7693
+ const segments2 = septets <= 160 ? 1 : Math.ceil(septets / 153);
7694
+ return {
7695
+ encoding: "GSM-7",
7696
+ characters,
7697
+ septets,
7698
+ segments: segments2
7699
+ };
7700
+ }
7701
+ const segments = characters <= 70 ? 1 : Math.ceil(characters / 67);
7702
+ return {
7703
+ encoding: "UCS-2",
7704
+ characters,
7705
+ segments
7706
+ };
7707
+ }
7708
+
7460
7709
  // src/index.ts
7461
- var src_default = { z: z15 };
7710
+ var src_default = { z: z16 };
7462
7711
  export {
7463
7712
  AgentContextSchema,
7464
7713
  AgentDefinitionSchema,
@@ -7488,6 +7737,7 @@ export {
7488
7737
  CRMSchemaZ,
7489
7738
  CardBlockDefinitionSchema,
7490
7739
  CardBlockHeaderSchema,
7740
+ ChannelBatchCapabilitySchema,
7491
7741
  ChannelCapabilitySchema,
7492
7742
  ChannelCapabilityTypeSchema,
7493
7743
  ChannelDefinitionSchema,
@@ -7514,6 +7764,8 @@ export {
7514
7764
  EnvSchemaSchema,
7515
7765
  EnvVariableDefinitionSchema,
7516
7766
  EnvVisibilitySchema,
7767
+ EstimationSchema,
7768
+ EstimationSkippedBreakdownSchema,
7517
7769
  EventConditionsSchema,
7518
7770
  EventSubscriptionSchema,
7519
7771
  EventTypeSchema,
@@ -7555,6 +7807,13 @@ export {
7555
7807
  MemoryQueryOptionsSchema,
7556
7808
  MemoryScopeSchema,
7557
7809
  MemoryService,
7810
+ MessageBulkRecipientSchema,
7811
+ MessageBulkSendInputSchema,
7812
+ MessageBulkSendOutputSchema,
7813
+ MessageBulkStatusInputSchema,
7814
+ MessageBulkStatusMessageSchema,
7815
+ MessageBulkStatusOutputSchema,
7816
+ MessageBulkStatusStatsSchema,
7558
7817
  MessageEventPayloadSchema,
7559
7818
  MessageSendAttachmentSchema,
7560
7819
  MessageSendChannelSchema,
@@ -7573,6 +7832,7 @@ export {
7573
7832
  ModelDependencySchema,
7574
7833
  ModelFieldDefinitionSchema,
7575
7834
  ModelMapperBlockDefinitionSchema,
7835
+ MoneyMinorRangeSchema,
7576
7836
  NavigationBreadcrumbSchema,
7577
7837
  NavigationConfigSchema,
7578
7838
  NavigationItemSchema,
@@ -7676,15 +7936,18 @@ export {
7676
7936
  communicationChannel,
7677
7937
  compileAgent,
7678
7938
  compileWorkflow,
7939
+ computeSkewedExpectedMinorUnits,
7679
7940
  configure,
7680
7941
  createAuthError,
7681
7942
  createConflictError,
7682
7943
  createContextLogger,
7683
7944
  createErrorResponse,
7945
+ createEstimation,
7684
7946
  createExternalError,
7685
7947
  createInMemoryService,
7686
7948
  createInstanceClient,
7687
7949
  createListResponse,
7950
+ createMoneyMinorRange,
7688
7951
  createNotFoundError,
7689
7952
  createPermissionError,
7690
7953
  createQueueHandle,
@@ -7710,11 +7973,14 @@ export {
7710
7973
  defineSkill,
7711
7974
  defineWorkflow,
7712
7975
  defineWorkflowYAML,
7976
+ estimateSmsSegments,
7713
7977
  evaluateCondition,
7714
7978
  evaluateTemplate,
7715
7979
  event,
7716
7980
  file,
7717
7981
  formatContextForPrompt,
7982
+ formatMoneyMinorEstimate,
7983
+ formatMoneyMinorRange,
7718
7984
  formatSkillInstructions,
7719
7985
  getAllEnvKeys,
7720
7986
  getAssociationByModel,
@@ -7740,6 +8006,7 @@ export {
7740
8006
  isWorkflowDependency,
7741
8007
  matchesTrigger,
7742
8008
  parseCRMSchema,
8009
+ parseEstimationFromBilling,
7743
8010
  queuedFetch,
7744
8011
  queuedFetchResponse,
7745
8012
  registerQueueConfig,
@@ -7753,11 +8020,12 @@ export {
7753
8020
  safeParseCRMSchema,
7754
8021
  safeParseConfig,
7755
8022
  server,
8023
+ toGsm7,
7756
8024
  token,
7757
8025
  validateCRMSchema,
7758
8026
  validateSkillYAML,
7759
8027
  validateWorkflowYAML,
7760
8028
  webhook,
7761
8029
  workplace,
7762
- z15 as z
8030
+ z16 as z
7763
8031
  };