skedyul 1.5.2 → 1.5.10

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,110 @@ 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 EstimationSchema = z.object({
68
+ deliverableCount: z.number().int().nonnegative(),
69
+ skippedCount: z.number().int().nonnegative().optional(),
70
+ cost: MoneyMinorRangeSchema.optional()
71
+ });
72
+ function createMoneyMinorRange(params) {
73
+ return {
74
+ currency: params.currency,
75
+ minorUnitsLow: params.minorUnitsLow,
76
+ minorUnitsHigh: params.minorUnitsHigh,
77
+ ...params.minorUnitsExpected !== void 0 ? { minorUnitsExpected: params.minorUnitsExpected } : {}
78
+ };
79
+ }
80
+ function createEstimation(params) {
81
+ return {
82
+ deliverableCount: params.deliverableCount,
83
+ ...params.skippedCount !== void 0 ? { skippedCount: params.skippedCount } : {},
84
+ ...params.cost ? { cost: params.cost } : {}
85
+ };
86
+ }
87
+ function computeSkewedExpectedMinorUnits(range) {
88
+ if (range.minorUnitsExpected !== void 0) {
89
+ return range.minorUnitsExpected;
90
+ }
91
+ if (range.minorUnitsLow === range.minorUnitsHigh) {
92
+ return range.minorUnitsLow;
93
+ }
94
+ return Math.round(0.8 * range.minorUnitsLow + 0.2 * range.minorUnitsHigh);
95
+ }
96
+ function formatMoneyMinorRange(range, locale) {
97
+ const formatter = new Intl.NumberFormat(locale, {
98
+ style: "currency",
99
+ currency: range.currency
100
+ });
101
+ const low = formatter.format(range.minorUnitsLow / 100);
102
+ const high = formatter.format(range.minorUnitsHigh / 100);
103
+ if (range.minorUnitsLow === range.minorUnitsHigh) {
104
+ return low;
105
+ }
106
+ return `${low} \u2013 ${high}`;
107
+ }
108
+ function formatMoneyMinorEstimate(range, options) {
109
+ const formatter = new Intl.NumberFormat(options?.locale, {
110
+ style: "currency",
111
+ currency: range.currency
112
+ });
113
+ const maxSpreadRatio = options?.maxSpreadRatio ?? 3;
114
+ const spreadRatio = range.minorUnitsLow > 0 ? range.minorUnitsHigh / range.minorUnitsLow : 1;
115
+ if (spreadRatio > maxSpreadRatio) {
116
+ return formatMoneyMinorRange(range, options?.locale);
117
+ }
118
+ const expectedMinorUnits = options?.expectedMinorUnits ?? computeSkewedExpectedMinorUnits(range);
119
+ const expected = formatter.format(expectedMinorUnits / 100);
120
+ if (range.minorUnitsLow === range.minorUnitsHigh) {
121
+ return expected;
122
+ }
123
+ return `~${expected}`;
124
+ }
125
+ function parseEstimationFromBilling(billing) {
126
+ if (!billing || typeof billing !== "object") {
127
+ return void 0;
128
+ }
129
+ const record2 = billing;
130
+ const nested = record2.estimation;
131
+ if (nested && typeof nested === "object") {
132
+ const parsed = EstimationSchema.safeParse(nested);
133
+ if (parsed.success) {
134
+ return parsed.data;
135
+ }
136
+ }
137
+ const currency = typeof record2.currency === "string" && record2.currency.trim() !== "" ? record2.currency : void 0;
138
+ const minorUnitsLow = typeof record2.minorUnitsLow === "number" ? record2.minorUnitsLow : typeof record2.costCentsLow === "number" ? record2.costCentsLow : void 0;
139
+ const minorUnitsHigh = typeof record2.minorUnitsHigh === "number" ? record2.minorUnitsHigh : typeof record2.costCentsHigh === "number" ? record2.costCentsHigh : void 0;
140
+ const minorUnitsExpected = typeof record2.minorUnitsExpected === "number" ? record2.minorUnitsExpected : typeof record2.costCentsExpected === "number" ? record2.costCentsExpected : void 0;
141
+ const deliverableCount = typeof record2.deliverableCount === "number" ? record2.deliverableCount : void 0;
142
+ if (deliverableCount === void 0 || minorUnitsLow === void 0 || minorUnitsHigh === void 0 || !currency) {
143
+ return void 0;
144
+ }
145
+ return createEstimation({
146
+ deliverableCount,
147
+ skippedCount: typeof record2.skippedCount === "number" ? record2.skippedCount : void 0,
148
+ cost: createMoneyMinorRange({
149
+ currency,
150
+ minorUnitsLow,
151
+ minorUnitsHigh,
152
+ ...minorUnitsExpected !== void 0 ? { minorUnitsExpected } : {}
153
+ })
154
+ });
155
+ }
156
+
157
+ // src/types/tool.ts
158
+ import { z as z2 } from "zod/v4";
159
+ var ToolResponseMetaSchema = z2.object({
160
+ success: z2.boolean(),
161
+ message: z2.string(),
162
+ toolName: z2.string()
65
163
  });
66
164
 
67
165
  // src/types/tool-response.ts
@@ -202,11 +300,11 @@ function isRuntimeWebhookContext(ctx) {
202
300
  }
203
301
 
204
302
  // src/schemas.ts
205
- import { z as z7 } from "zod/v4";
303
+ import { z as z8 } from "zod/v4";
206
304
 
207
305
  // src/schemas/crm-schema.ts
208
- import { z as z2 } from "zod/v4";
209
- var CRMFieldTypeSchema = z2.enum([
306
+ import { z as z3 } from "zod/v4";
307
+ var CRMFieldTypeSchema = z3.enum([
210
308
  "string",
211
309
  "long_string",
212
310
  "number",
@@ -218,125 +316,125 @@ var CRMFieldTypeSchema = z2.enum([
218
316
  "image",
219
317
  "object"
220
318
  ]);
221
- var CRMFieldRequirementSchema = z2.enum([
319
+ var CRMFieldRequirementSchema = z3.enum([
222
320
  "optional",
223
321
  "on_create",
224
322
  "required"
225
323
  ]);
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(),
324
+ var CRMFieldOptionSchema = z3.object({
325
+ label: z3.string(),
326
+ value: z3.string(),
327
+ color: z3.string().optional()
328
+ });
329
+ var CRMFieldDefinitionObjectSchema = z3.object({
330
+ options: z3.array(CRMFieldOptionSchema).optional(),
331
+ limitChoices: z3.number().optional(),
332
+ minLength: z3.number().optional(),
333
+ maxLength: z3.number().optional(),
334
+ min: z3.number().optional(),
335
+ max: z3.number().optional(),
336
+ pattern: z3.string().optional()
337
+ });
338
+ var CRMFieldDefinitionSchema = z3.union([
339
+ z3.string(),
242
340
  CRMFieldDefinitionObjectSchema
243
341
  ]);
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"),
342
+ var CRMFieldAppearanceSchemaZ = z3.object({
343
+ leftIcon: z3.string().optional(),
344
+ rightIcon: z3.string().optional(),
345
+ placeholder: z3.string().optional(),
346
+ helpText: z3.string().optional()
347
+ });
348
+ var CRMFieldSchemaZ = z3.object({
349
+ handle: z3.string().regex(/^[a-z][a-z0-9_]*$/, "Handle must be lowercase alphanumeric with underscores, starting with a letter"),
350
+ label: z3.string().min(1, "Label is required"),
253
351
  type: CRMFieldTypeSchema,
254
352
  /** Field description - explains what the field is for (metadata, not UI) */
255
- description: z2.string().optional(),
353
+ description: z3.string().optional(),
256
354
  /** Field appearance - UI presentation settings */
257
355
  appearance: CRMFieldAppearanceSchemaZ.optional(),
258
356
  requirement: CRMFieldRequirementSchema.optional(),
259
- unique: z2.boolean().optional(),
260
- list: z2.boolean().optional(),
261
- default: z2.unknown().optional(),
357
+ unique: z3.boolean().optional(),
358
+ list: z3.boolean().optional(),
359
+ default: z3.unknown().optional(),
262
360
  definition: CRMFieldDefinitionSchema.optional()
263
361
  });
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({
362
+ var CRMModelSchemaZ = z3.object({
363
+ handle: z3.string().regex(/^[a-z][a-z0-9_]*$/, "Handle must be lowercase alphanumeric with underscores, starting with a letter"),
364
+ name: z3.string().min(1, "Name is required"),
365
+ namePlural: z3.string().optional(),
366
+ labelTemplate: z3.string().optional(),
367
+ description: z3.string().optional(),
368
+ icon: z3.string().optional(),
369
+ fields: z3.array(CRMFieldSchemaZ)
370
+ });
371
+ var CRMCardinalitySchema = z3.enum(["one_to_one", "one_to_many"]);
372
+ var CRMOnDeleteSchema = z3.enum(["none", "cascade", "restrict"]);
373
+ var CRMRelationshipLinkSchema = z3.object({
374
+ model: z3.string(),
375
+ field: z3.string(),
376
+ label: z3.string()
377
+ });
378
+ var CRMRelationshipSchemaZ = z3.object({
281
379
  source: CRMRelationshipLinkSchema,
282
380
  target: CRMRelationshipLinkSchema,
283
381
  cardinality: CRMCardinalitySchema,
284
382
  onDelete: CRMOnDeleteSchema.optional()
285
383
  });
286
- var CRMBlockTypeSchema = z2.enum([
384
+ var CRMBlockTypeSchema = z3.enum([
287
385
  "spreadsheet",
288
386
  "form",
289
387
  "card",
290
388
  "metric",
291
389
  "kanban"
292
390
  ]);
293
- var CRMBlockSchemaZ = z2.object({
391
+ var CRMBlockSchemaZ = z3.object({
294
392
  type: CRMBlockTypeSchema,
295
- title: z2.string().optional(),
296
- config: z2.unknown().optional(),
297
- default: z2.boolean().optional()
393
+ title: z3.string().optional(),
394
+ config: z3.unknown().optional(),
395
+ default: z3.boolean().optional()
298
396
  });
299
- var CRMPageTypeSchema = z2.enum(["list", "instance"]);
300
- var CRMPageSchemaZ = z2.object({
301
- path: z2.string(),
397
+ var CRMPageTypeSchema = z3.enum(["list", "instance"]);
398
+ var CRMPageSchemaZ = z3.object({
399
+ path: z3.string(),
302
400
  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(
401
+ title: z3.string(),
402
+ icon: z3.string().optional(),
403
+ modelHandle: z3.string(),
404
+ parentPath: z3.string().optional(),
405
+ baseQuery: z3.unknown().optional(),
406
+ blocks: z3.array(CRMBlockSchemaZ).optional()
407
+ });
408
+ var CRMNavigationNodeBaseSchemaZ = z3.object({
409
+ label: z3.string(),
410
+ icon: z3.string().optional(),
411
+ path: z3.string().optional(),
412
+ kind: z3.enum(["section", "group"]).optional(),
413
+ sortIndex: z3.number().optional()
414
+ });
415
+ var CRMNavigationItemSchemaZ = z3.lazy(
318
416
  () => CRMNavigationNodeBaseSchemaZ.extend({
319
- children: z2.array(CRMNavigationItemSchemaZ).optional()
417
+ children: z3.array(CRMNavigationItemSchemaZ).optional()
320
418
  })
321
419
  );
322
- var CRMNavigationSchemaZ = z2.object({
323
- sidebar: z2.array(CRMNavigationItemSchemaZ).optional()
420
+ var CRMNavigationSchemaZ = z3.object({
421
+ sidebar: z3.array(CRMNavigationItemSchemaZ).optional()
324
422
  });
325
- var CRMSchemaZ = z2.object({
423
+ var CRMSchemaZ = z3.object({
326
424
  /** Schema format version for future compatibility */
327
- $schema: z2.literal("https://skedyul.com/schemas/crm/v1").optional(),
425
+ $schema: z3.literal("https://skedyul.com/schemas/crm/v1").optional(),
328
426
  /** Schema name for identification */
329
- name: z2.string().min(1, "Name is required"),
427
+ name: z3.string().min(1, "Name is required"),
330
428
  /** Optional description */
331
- description: z2.string().optional(),
429
+ description: z3.string().optional(),
332
430
  /** Schema version (semver) */
333
- version: z2.string().optional(),
431
+ version: z3.string().optional(),
334
432
  /** Model definitions */
335
- models: z2.array(CRMModelSchemaZ),
433
+ models: z3.array(CRMModelSchemaZ),
336
434
  /** Relationship definitions */
337
- relationships: z2.array(CRMRelationshipSchemaZ).optional(),
435
+ relationships: z3.array(CRMRelationshipSchemaZ).optional(),
338
436
  /** Page definitions */
339
- pages: z2.array(CRMPageSchemaZ).optional(),
437
+ pages: z3.array(CRMPageSchemaZ).optional(),
340
438
  /** Navigation definitions */
341
439
  navigation: CRMNavigationSchemaZ.optional()
342
440
  });
@@ -363,11 +461,11 @@ function safeParseCRMSchema(data) {
363
461
  }
364
462
 
365
463
  // src/schemas/agent-schema-v3.ts
366
- import { z as z6 } from "zod/v4";
464
+ import { z as z7 } from "zod/v4";
367
465
 
368
466
  // src/events/types.ts
369
- import { z as z3 } from "zod/v4";
370
- var ThreadEventTypeSchema = z3.enum([
467
+ import { z as z4 } from "zod/v4";
468
+ var ThreadEventTypeSchema = z4.enum([
371
469
  // Message events
372
470
  "thread.message.received",
373
471
  "thread.message.sent",
@@ -389,73 +487,73 @@ var ThreadEventTypeSchema = z3.enum([
389
487
  // Signal events
390
488
  "thread.signal.created"
391
489
  ]);
392
- var CustomEventTypeSchema = z3.string().regex(/^custom\.[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)*$/, {
490
+ var CustomEventTypeSchema = z4.string().regex(/^custom\.[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)*$/, {
393
491
  message: "Custom event type must match pattern: custom.{namespace}.{event}"
394
492
  });
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()
493
+ var EventTypeSchema = z4.union([ThreadEventTypeSchema, CustomEventTypeSchema]);
494
+ var ParticipantKindSchema = z4.enum(["CONTACT", "MEMBER", "AGENT", "WORKFLOW"]);
495
+ var BaseEventPayloadSchema = z4.object({
496
+ threadId: z4.string(),
497
+ workplaceId: z4.string(),
498
+ timestamp: z4.string().datetime().optional()
401
499
  });
402
500
  var MessageEventPayloadSchema = BaseEventPayloadSchema.extend({
403
- message: z3.object({
404
- id: z3.string(),
405
- content: z3.string(),
406
- senderId: z3.string().optional()
501
+ message: z4.object({
502
+ id: z4.string(),
503
+ content: z4.string(),
504
+ senderId: z4.string().optional()
407
505
  }),
408
- participant: z3.object({
409
- id: z3.string(),
506
+ participant: z4.object({
507
+ id: z4.string(),
410
508
  kind: ParticipantKindSchema,
411
- displayName: z3.string().optional()
509
+ displayName: z4.string().optional()
412
510
  }).optional(),
413
- isFirstMessage: z3.boolean().optional(),
414
- messageCount: z3.number().optional()
511
+ isFirstMessage: z4.boolean().optional(),
512
+ messageCount: z4.number().optional()
415
513
  });
416
514
  var ParticipantEventPayloadSchema = BaseEventPayloadSchema.extend({
417
- participant: z3.object({
418
- id: z3.string(),
515
+ participant: z4.object({
516
+ id: z4.string(),
419
517
  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()
518
+ displayName: z4.string().optional(),
519
+ contactId: z4.string().optional(),
520
+ memberId: z4.string().optional(),
521
+ agentId: z4.string().optional(),
522
+ workflowId: z4.string().optional()
425
523
  })
426
524
  });
427
525
  var ContextChangedPayloadSchema = BaseEventPayloadSchema.extend({
428
- context: z3.object({
429
- handle: z3.string(),
430
- model: z3.string(),
431
- instanceId: z3.string()
526
+ context: z4.object({
527
+ handle: z4.string(),
528
+ model: z4.string(),
529
+ instanceId: z4.string()
432
530
  }),
433
- change: z3.object({
434
- field: z3.string().optional(),
435
- oldValue: z3.unknown().optional(),
436
- newValue: z3.unknown().optional()
531
+ change: z4.object({
532
+ field: z4.string().optional(),
533
+ oldValue: z4.unknown().optional(),
534
+ newValue: z4.unknown().optional()
437
535
  }).optional()
438
536
  });
439
537
  var StatusChangedPayloadSchema = BaseEventPayloadSchema.extend({
440
- oldStatus: z3.string(),
441
- newStatus: z3.string()
538
+ oldStatus: z4.string(),
539
+ newStatus: z4.string()
442
540
  });
443
541
  var ScheduledEventPayloadSchema = BaseEventPayloadSchema.extend({
444
- scheduledEventId: z3.string(),
445
- reason: z3.string().optional(),
446
- context: z3.record(z3.string(), z3.unknown()).optional()
542
+ scheduledEventId: z4.string(),
543
+ reason: z4.string().optional(),
544
+ context: z4.record(z4.string(), z4.unknown()).optional()
447
545
  });
448
546
  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()
547
+ agentId: z4.string().optional(),
548
+ workflowId: z4.string().optional(),
549
+ workflowRunId: z4.string().optional(),
550
+ outputs: z4.record(z4.string(), z4.unknown()).optional(),
551
+ error: z4.string().optional()
454
552
  });
455
553
  var CustomEventPayloadSchema = BaseEventPayloadSchema.extend({
456
- data: z3.record(z3.string(), z3.unknown()).optional()
554
+ data: z4.record(z4.string(), z4.unknown()).optional()
457
555
  });
458
- var ThreadEventPayloadSchema = z3.union([
556
+ var ThreadEventPayloadSchema = z4.union([
459
557
  MessageEventPayloadSchema,
460
558
  ParticipantEventPayloadSchema,
461
559
  ContextChangedPayloadSchema,
@@ -464,164 +562,164 @@ var ThreadEventPayloadSchema = z3.union([
464
562
  AgentWorkflowEventPayloadSchema,
465
563
  CustomEventPayloadSchema
466
564
  ]);
467
- var ThreadEventSchema = z3.object({
468
- id: z3.string(),
469
- threadId: z3.string(),
565
+ var ThreadEventSchema = z4.object({
566
+ id: z4.string(),
567
+ threadId: z4.string(),
470
568
  type: EventTypeSchema,
471
569
  payload: ThreadEventPayloadSchema,
472
- emittedBy: z3.string().optional(),
473
- createdAt: z3.string().datetime()
570
+ emittedBy: z4.string().optional(),
571
+ createdAt: z4.string().datetime()
474
572
  });
475
- var CreateThreadEventInputSchema = z3.object({
476
- threadId: z3.string(),
573
+ var CreateThreadEventInputSchema = z4.object({
574
+ threadId: z4.string(),
477
575
  type: EventTypeSchema,
478
- payload: z3.record(z3.string(), z3.unknown()),
479
- emittedBy: z3.string().optional()
576
+ payload: z4.record(z4.string(), z4.unknown()),
577
+ emittedBy: z4.string().optional()
480
578
  });
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()
579
+ var EventSubscriptionSchema = z4.object({
580
+ subscribes: z4.array(EventTypeSchema),
581
+ condition: z4.string().optional(),
582
+ cancels: z4.array(EventTypeSchema).optional(),
583
+ cancelCondition: z4.string().optional()
486
584
  });
487
- var EventWaitSchema = z3.object({
585
+ var EventWaitSchema = z4.object({
488
586
  event: EventTypeSchema,
489
- timeout: z3.string().optional(),
490
- onTimeout: z3.string().optional()
587
+ timeout: z4.string().optional(),
588
+ onTimeout: z4.string().optional()
491
589
  });
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()
590
+ var EventsConfigSchema = z4.object({
591
+ subscribes: z4.array(EventTypeSchema).optional(),
592
+ condition: z4.string().optional(),
593
+ emits: z4.array(EventTypeSchema).optional(),
594
+ waits: z4.array(EventWaitSchema).optional(),
595
+ cancels: z4.array(EventTypeSchema).optional(),
596
+ cancelCondition: z4.string().optional()
499
597
  });
500
598
 
501
599
  // src/skills/types.ts
502
- import { z as z4 } from "zod/v4";
600
+ import { z as z5 } from "zod/v4";
503
601
  var SKILL_SCHEMA_VERSION = "https://skedyul.com/schemas/skill/v1";
504
602
  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(),
603
+ var SkillSourceSchema = z5.enum(["BUILTIN", "S3", "APP", "EXTERNAL"]);
604
+ var SkillToolRequirementSchema = z5.object({
605
+ requires: z5.array(z5.string()).optional(),
606
+ provides: z5.array(z5.string()).optional()
607
+ });
608
+ var SkillToolSandboxSchema = z5.object({
609
+ mock: z5.unknown().optional()
610
+ });
611
+ var ToolConstraintsSchema = z5.object({
612
+ maxCallsPerRun: z5.number().optional(),
613
+ idempotent: z5.boolean().optional(),
614
+ restricted: z5.boolean().optional(),
615
+ tags: z5.array(z5.string()).optional()
616
+ });
617
+ var SkillToolDefinitionSchema = z5.object({
618
+ tool: z5.string(),
619
+ description: z5.string().optional(),
620
+ overrides: z5.record(z5.string(), z5.unknown()).optional(),
523
621
  sandbox: SkillToolSandboxSchema.optional(),
524
- requiresApproval: z4.boolean().optional(),
622
+ requiresApproval: z5.boolean().optional(),
525
623
  constraints: ToolConstraintsSchema.optional()
526
624
  });
527
- var SkillToolsSchema = z4.union([
625
+ var SkillToolsSchema = z5.union([
528
626
  SkillToolRequirementSchema,
529
- z4.array(SkillToolDefinitionSchema)
627
+ z5.array(SkillToolDefinitionSchema)
530
628
  ]);
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()
629
+ var SkillExampleSchema = z5.object({
630
+ context: z5.string().optional(),
631
+ input: z5.string(),
632
+ reasoning: z5.string().optional(),
633
+ output: z5.string(),
634
+ tool_call: z5.string().optional()
537
635
  });
538
- var CRMModelFieldRequirementsSchema = z4.object({
539
- required: z4.array(z4.string()).optional(),
540
- recommended: z4.array(z4.string()).optional()
636
+ var CRMModelFieldRequirementsSchema = z5.object({
637
+ required: z5.array(z5.string()).optional(),
638
+ recommended: z5.array(z5.string()).optional()
541
639
  });
542
- var CRMContextSchema = z4.object({
543
- models: z4.record(z4.string(), CRMModelFieldRequirementsSchema)
640
+ var CRMContextSchema = z5.object({
641
+ models: z5.record(z5.string(), CRMModelFieldRequirementsSchema)
544
642
  });
545
- var SkillYAMLSchema = z4.object({
643
+ var SkillYAMLSchema = z5.object({
546
644
  // Schema version
547
- $schema: z4.string().optional(),
645
+ $schema: z5.string().optional(),
548
646
  // Identity
549
- handle: z4.string(),
550
- name: z4.string(),
551
- version: z4.string().optional(),
552
- description: z4.string().optional(),
647
+ handle: z5.string(),
648
+ name: z5.string(),
649
+ version: z5.string().optional(),
650
+ description: z5.string().optional(),
553
651
  // Instructions injected into agent system prompt
554
- instructions: z4.string(),
652
+ instructions: z5.string(),
555
653
  // Tool configuration - supports both v1 and v2 formats
556
654
  tools: SkillToolsSchema.optional(),
557
655
  // CRM context - specifies which models/fields to include in schema
558
656
  crmContext: CRMContextSchema.optional(),
559
657
  // 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(),
658
+ examples: z5.array(SkillExampleSchema).optional()
659
+ });
660
+ var SkillYAMLV2Schema = z5.object({
661
+ $schema: z5.literal(SKILL_SCHEMA_VERSION_V2).optional(),
662
+ handle: z5.string(),
663
+ name: z5.string(),
664
+ version: z5.string().optional(),
665
+ description: z5.string().optional(),
666
+ instructions: z5.string(),
667
+ tools: z5.array(SkillToolDefinitionSchema).optional(),
570
668
  crmContext: CRMContextSchema.optional(),
571
- examples: z4.array(SkillExampleSchema).optional()
669
+ examples: z5.array(SkillExampleSchema).optional()
572
670
  });
573
- var SkillVersionWeightSchema = z4.object({
574
- version: z4.number(),
575
- weight: z4.number()
671
+ var SkillVersionWeightSchema = z5.object({
672
+ version: z5.number(),
673
+ weight: z5.number()
576
674
  });
577
- var SkillRefSchema = z4.union([
578
- z4.string(),
675
+ var SkillRefSchema = z5.union([
676
+ z5.string(),
579
677
  // Just handle - uses latest published version
580
- z4.object({
581
- skill: z4.string(),
582
- description: z4.string().optional(),
678
+ z5.object({
679
+ skill: z5.string(),
680
+ description: z5.string().optional(),
583
681
  // For AI SDK Agent Skills discovery
584
682
  /** Auto-inject this skill's instructions and tools on every agent turn */
585
- alwaysLoad: z4.boolean().optional(),
683
+ alwaysLoad: z5.boolean().optional(),
586
684
  // Version selection (pick one):
587
- version: z4.number().optional(),
685
+ version: z5.number().optional(),
588
686
  // Pin to specific version number
589
- versions: z4.array(SkillVersionWeightSchema).optional(),
687
+ versions: z5.array(SkillVersionWeightSchema).optional(),
590
688
  // A/B testing weights
591
689
  // Legacy support:
592
- instructions: z4.string().optional(),
690
+ instructions: z5.string().optional(),
593
691
  // Inline instructions (deprecated)
594
- enabled: z4.boolean().optional()
692
+ enabled: z5.boolean().optional()
595
693
  })
596
694
  ]);
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(),
695
+ var SkillMetadataSchema = z5.object({
696
+ id: z5.string(),
697
+ handle: z5.string(),
698
+ name: z5.string(),
699
+ version: z5.string().optional(),
700
+ description: z5.string().optional(),
603
701
  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()
702
+ s3Key: z5.string().optional(),
703
+ appVersionId: z5.string().optional(),
704
+ workplaceId: z5.string().optional(),
705
+ createdAt: z5.string().datetime().optional(),
706
+ updatedAt: z5.string().datetime().optional()
707
+ });
708
+ var ResolvedSkillSchema = z5.object({
709
+ handle: z5.string(),
710
+ name: z5.string(),
711
+ instructions: z5.string().optional(),
712
+ description: z5.string().optional(),
713
+ tools: z5.array(z5.string()).optional(),
714
+ examples: z5.array(SkillExampleSchema).optional()
715
+ });
716
+ var LoadedSkillSchema = z5.object({
717
+ handle: z5.string(),
718
+ name: z5.string(),
719
+ instructions: z5.string().optional(),
720
+ description: z5.string().optional(),
721
+ tools: z5.array(SkillToolDefinitionSchema).optional(),
722
+ examples: z5.array(SkillExampleSchema).optional()
625
723
  });
626
724
  function isV2SkillTools(tools) {
627
725
  if (!tools) return false;
@@ -677,182 +775,182 @@ ${sections.join("\n\n---\n\n")}`;
677
775
  }
678
776
 
679
777
  // 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())
778
+ import { z as z6 } from "zod/v4";
779
+ var CRMContextSchema2 = z6.object({
780
+ model: z6.string(),
781
+ instanceId: z6.string(),
782
+ data: z6.record(z6.string(), z6.unknown())
685
783
  });
686
- var SenderContextSchema = z5.object({
784
+ var SenderContextSchema = z6.object({
687
785
  kind: ParticipantKindSchema,
688
- displayName: z5.string().optional(),
689
- email: z5.string().optional(),
690
- role: z5.string().optional(),
691
- permissions: z5.array(z5.string()).optional(),
786
+ displayName: z6.string().optional(),
787
+ email: z6.string().optional(),
788
+ role: z6.string().optional(),
789
+ permissions: z6.array(z6.string()).optional(),
692
790
  crm: CRMContextSchema2.optional()
693
791
  });
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(),
792
+ var ThreadContextItemSchema = z6.object({
793
+ handle: z6.string(),
794
+ model: z6.string(),
795
+ instanceId: z6.string(),
796
+ data: z6.record(z6.string(), z6.unknown()).optional()
797
+ });
798
+ var ThreadInfoSchema = z6.object({
799
+ id: z6.string(),
800
+ title: z6.string().optional(),
801
+ status: z6.string().optional(),
802
+ kind: z6.string().optional()
803
+ });
804
+ var SubscriptionSchema = z6.object({
805
+ identifierValue: z6.string(),
806
+ channelHandle: z6.string().optional()
807
+ });
808
+ var AssociationSchema = z6.object({
809
+ id: z6.string().optional(),
810
+ data: z6.record(z6.string(), z6.unknown())
811
+ });
812
+ var ContactSchema = z6.object({
813
+ id: z6.string().optional(),
814
+ name: z6.string().optional(),
717
815
  subscription: SubscriptionSchema.optional(),
718
- associations: z5.record(z5.string(), AssociationSchema).optional()
816
+ associations: z6.record(z6.string(), AssociationSchema).optional()
719
817
  });
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(),
818
+ var AgentSenderContextSchema = z6.object({
819
+ kind: z6.enum(["contact", "member"]),
820
+ displayName: z6.string().optional(),
821
+ role: z6.string().optional(),
822
+ permissions: z6.array(z6.string()).optional(),
725
823
  contact: ContactSchema.optional()
726
824
  });
727
- var AgentThreadContextSchema = z5.object({
728
- handle: z5.string(),
729
- model: z5.string(),
730
- data: z5.record(z5.string(), z5.unknown())
825
+ var AgentThreadContextSchema = z6.object({
826
+ handle: z6.string(),
827
+ model: z6.string(),
828
+ data: z6.record(z6.string(), z6.unknown())
731
829
  });
732
- var AgentContextSchema = z5.object({
830
+ var AgentContextSchema = z6.object({
733
831
  sender: AgentSenderContextSchema,
734
- contexts: z5.array(AgentThreadContextSchema).optional()
832
+ contexts: z6.array(AgentThreadContextSchema).optional()
735
833
  });
736
- var ContextIssueSeveritySchema = z5.enum(["ERROR", "WARNING"]);
737
- var ContextIssueTypeSchema = z5.enum([
834
+ var ContextIssueSeveritySchema = z6.enum(["ERROR", "WARNING"]);
835
+ var ContextIssueTypeSchema = z6.enum([
738
836
  "MISSING_ROUTING_PARTICIPANT",
739
837
  "MISSING_ASSOCIATION",
740
838
  "MISSING_REQUIRED_FIELD",
741
839
  "MISSING_RECOMMENDED_FIELD"
742
840
  ]);
743
- var ContextIssueSchema = z5.object({
841
+ var ContextIssueSchema = z6.object({
744
842
  type: ContextIssueTypeSchema,
745
843
  severity: ContextIssueSeveritySchema,
746
- model: z5.string().optional(),
747
- field: z5.string().optional(),
748
- message: z5.string(),
749
- suggestion: z5.string().optional()
844
+ model: z6.string().optional(),
845
+ field: z6.string().optional(),
846
+ message: z6.string(),
847
+ suggestion: z6.string().optional()
750
848
  });
751
- var ContextValidationResultSchema = z5.object({
752
- valid: z5.boolean(),
753
- degraded: z5.boolean(),
754
- issues: z5.array(ContextIssueSchema)
849
+ var ContextValidationResultSchema = z6.object({
850
+ valid: z6.boolean(),
851
+ degraded: z6.boolean(),
852
+ issues: z6.array(ContextIssueSchema)
755
853
  });
756
854
  var MockSenderContextSchema = AgentSenderContextSchema;
757
855
  var MockThreadContextSchema = AgentThreadContextSchema;
758
856
  var MockContextSchema = AgentContextSchema;
759
- var SandboxConfigSchema = z5.object({
760
- enabled: z5.boolean().optional(),
857
+ var SandboxConfigSchema = z6.object({
858
+ enabled: z6.boolean().optional(),
761
859
  /** @deprecated Use 'context' instead of 'mockContext' */
762
860
  mockContext: AgentContextSchema.optional(),
763
861
  context: AgentContextSchema.optional()
764
862
  });
765
863
 
766
864
  // 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(),
865
+ var PersonaVoiceFormatV3Schema = z7.object({
866
+ maxChars: z7.number().optional(),
867
+ noEmojis: z7.boolean().optional(),
868
+ noHyphens: z7.boolean().optional(),
869
+ noBulletPoints: z7.boolean().optional(),
870
+ maxQuestionsPerMessage: z7.number().optional(),
871
+ noSignOffs: z7.boolean().optional()
872
+ });
873
+ var PersonaVoiceV3Schema = z7.object({
874
+ style: z7.string(),
777
875
  format: PersonaVoiceFormatV3Schema.optional()
778
876
  });
779
- var PersonaV3Schema = z6.object({
780
- name: z6.string(),
877
+ var PersonaV3Schema = z7.object({
878
+ name: z7.string(),
781
879
  voice: PersonaVoiceV3Schema
782
880
  });
783
- var ToolApprovalConfigSchema = z6.object({
784
- required: z6.boolean().optional(),
785
- requiredIf: z6.array(z6.string()).optional()
881
+ var ToolApprovalConfigSchema = z7.object({
882
+ required: z7.boolean().optional(),
883
+ requiredIf: z7.array(z7.string()).optional()
786
884
  });
787
- var ToolSandboxConfigSchema = z6.object({
788
- mock: z6.unknown().optional()
885
+ var ToolSandboxConfigSchema = z7.object({
886
+ mock: z7.unknown().optional()
789
887
  });
790
- var ToolRefV3Schema = z6.union([
791
- z6.string(),
792
- z6.object({
793
- tool: z6.string(),
794
- description: z6.string().optional(),
888
+ var ToolRefV3Schema = z7.union([
889
+ z7.string(),
890
+ z7.object({
891
+ tool: z7.string(),
892
+ description: z7.string().optional(),
795
893
  approval: ToolApprovalConfigSchema.optional(),
796
894
  sandbox: ToolSandboxConfigSchema.optional(),
797
- overrides: z6.record(z6.string(), z6.unknown()).optional()
895
+ overrides: z7.record(z7.string(), z7.unknown()).optional()
798
896
  })
799
897
  ]);
800
- var AgentToolRefSchema = z6.union([
801
- z6.string(),
802
- z6.object({
803
- tool: z6.string(),
804
- description: z6.string().optional()
898
+ var AgentToolRefSchema = z7.union([
899
+ z7.string(),
900
+ z7.object({
901
+ tool: z7.string(),
902
+ description: z7.string().optional()
805
903
  })
806
904
  ]);
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()
905
+ var WorkingMemoryConfigSchema = z7.object({
906
+ strategy: z7.enum(["full", "rolling_summary", "sliding_window"]).optional(),
907
+ maxTokens: z7.number().optional(),
908
+ summarizeAt: z7.number().optional()
811
909
  });
812
- var ExternalMemoryConfigSchema = z6.object({
813
- enabled: z6.boolean().optional(),
814
- ttl: z6.string().optional()
910
+ var ExternalMemoryConfigSchema = z7.object({
911
+ enabled: z7.boolean().optional(),
912
+ ttl: z7.string().optional()
815
913
  });
816
- var SemanticMemoryConfigSchema = z6.object({
817
- enabled: z6.boolean().optional(),
818
- topK: z6.number().optional(),
819
- scope: z6.enum(["thread", "instance", "workspace"]).optional()
914
+ var SemanticMemoryConfigSchema = z7.object({
915
+ enabled: z7.boolean().optional(),
916
+ topK: z7.number().optional(),
917
+ scope: z7.enum(["thread", "instance", "workspace"]).optional()
820
918
  });
821
- var MemoryConfigV3Schema = z6.object({
919
+ var MemoryConfigV3Schema = z7.object({
822
920
  working: WorkingMemoryConfigSchema.optional(),
823
- persistent: z6.object({
824
- namespace: z6.string().optional()
921
+ persistent: z7.object({
922
+ namespace: z7.string().optional()
825
923
  }).optional(),
826
924
  external: ExternalMemoryConfigSchema.optional(),
827
925
  semantic: SemanticMemoryConfigSchema.optional()
828
926
  });
829
- var RequiresApprovalPolicySchema = z6.object({
830
- requiresApproval: z6.boolean().optional()
927
+ var RequiresApprovalPolicySchema = z7.object({
928
+ requiresApproval: z7.boolean().optional()
831
929
  });
832
- var PoliciesConfigV3Schema = z6.object({
833
- messages: z6.object({
930
+ var PoliciesConfigV3Schema = z7.object({
931
+ messages: z7.object({
834
932
  send: RequiresApprovalPolicySchema.optional(),
835
933
  schedule: RequiresApprovalPolicySchema.optional()
836
934
  }).optional(),
837
- tools: z6.object({
838
- externalRequiresApproval: z6.boolean().optional(),
839
- systemRequiresApproval: z6.boolean().optional()
935
+ tools: z7.object({
936
+ externalRequiresApproval: z7.boolean().optional(),
937
+ systemRequiresApproval: z7.boolean().optional()
840
938
  }).optional()
841
939
  });
842
- var RuntimeConfigV3Schema = z6.object({
940
+ var RuntimeConfigV3Schema = z7.object({
843
941
  /** LLM model identifier for reasoning (e.g., "google/gemini-3.1-flash-lite") */
844
- model: z6.string().optional(),
942
+ model: z7.string().optional(),
845
943
  /** LLM model for persona transformation (e.g., "openai/gpt-5-nano") */
846
- personaModel: z6.string().optional()
944
+ personaModel: z7.string().optional()
847
945
  });
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)
946
+ var TimeWindowTimeStampSchema = z7.union([
947
+ z7.number().describe("Hour of day (0-23)"),
948
+ z7.object({
949
+ hour: z7.number(),
950
+ minute: z7.number().optional().default(0)
853
951
  })
854
952
  ]);
855
- var TimeWindowDayOfWeekSchema = z6.enum([
953
+ var TimeWindowDayOfWeekSchema = z7.enum([
856
954
  "monday",
857
955
  "tuesday",
858
956
  "wednesday",
@@ -861,47 +959,47 @@ var TimeWindowDayOfWeekSchema = z6.enum([
861
959
  "saturday",
862
960
  "sunday"
863
961
  ]);
864
- var TimeWindowSlotAgentSchema = z6.object({
962
+ var TimeWindowSlotAgentSchema = z7.object({
865
963
  startTime: TimeWindowTimeStampSchema,
866
964
  endTime: TimeWindowTimeStampSchema,
867
- days: z6.array(TimeWindowDayOfWeekSchema)
965
+ days: z7.array(TimeWindowDayOfWeekSchema)
868
966
  });
869
- var ResponseModeSchema = z6.enum([
967
+ var ResponseModeSchema = z7.enum([
870
968
  "immediate",
871
969
  "ack_and_schedule",
872
970
  "schedule_only"
873
971
  ]);
874
- var TimeWindowBehaviorSchema = z6.object({
972
+ var TimeWindowBehaviorSchema = z7.object({
875
973
  /** How to handle responses in this window */
876
974
  responseMode: ResponseModeSchema,
877
975
  /** Prompt injection for this time context */
878
- prompt: z6.string().optional().describe("Prompt injection for this time context"),
976
+ prompt: z7.string().optional().describe("Prompt injection for this time context"),
879
977
  /** 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")
978
+ scheduleFor: z7.string().optional().describe("Window name to schedule responses for")
881
979
  });
882
- var TimeWindowPolicySchema = z6.object({
980
+ var TimeWindowPolicySchema = z7.object({
883
981
  /** IANA timezone for the window (e.g., "Australia/Sydney") */
884
- timezone: z6.string().describe('IANA timezone, e.g., "Australia/Sydney"'),
982
+ timezone: z7.string().describe('IANA timezone, e.g., "Australia/Sydney"'),
885
983
  /** Time slots when this window is active */
886
- windows: z6.array(TimeWindowSlotAgentSchema),
984
+ windows: z7.array(TimeWindowSlotAgentSchema),
887
985
  /** Behavior for this window (optional - defaults to immediate response) */
888
986
  behavior: TimeWindowBehaviorSchema.optional()
889
987
  });
890
- var TimeWindowPoliciesSchema = z6.record(z6.string(), TimeWindowPolicySchema);
988
+ var TimeWindowPoliciesSchema = z7.record(z7.string(), TimeWindowPolicySchema);
891
989
  var TimeWindowDefaultSchema = TimeWindowBehaviorSchema.describe(
892
990
  "Fallback behavior when no time window matches"
893
991
  );
894
- var ResponsesBehaviorConfigSchema = z6.object({
992
+ var ResponsesBehaviorConfigSchema = z7.object({
895
993
  /**
896
994
  * Maximum immediate messages per agent run (acks, progress updates).
897
995
  * @default 1
898
996
  */
899
- maxImmediate: z6.number().optional(),
997
+ maxImmediate: z7.number().optional(),
900
998
  /**
901
999
  * Maximum scheduled messages per agent run (follow-ups via sendAt).
902
1000
  * @default 2
903
1001
  */
904
- maxScheduled: z6.number().optional(),
1002
+ maxScheduled: z7.number().optional(),
905
1003
  /**
906
1004
  * Maximum intermediate messages per agent run.
907
1005
  * Intermediate = progress updates, acknowledgments before task completion.
@@ -909,74 +1007,74 @@ var ResponsesBehaviorConfigSchema = z6.object({
909
1007
  * @deprecated Use maxImmediate instead
910
1008
  * @default 2
911
1009
  */
912
- maxIntermediate: z6.number().optional(),
1010
+ maxIntermediate: z7.number().optional(),
913
1011
  /**
914
1012
  * Whether a final message is required before the run completes.
915
1013
  * If true and no final message is sent, the run fails.
916
1014
  * @default true
917
1015
  */
918
- requireFinal: z6.boolean().optional(),
1016
+ requireFinal: z7.boolean().optional(),
919
1017
  /**
920
1018
  * Whether the agent can schedule messages for future delivery.
921
1019
  * Scheduled messages typically require approval.
922
1020
  * @default false
923
1021
  */
924
- allowSchedule: z6.boolean().optional(),
1022
+ allowSchedule: z7.boolean().optional(),
925
1023
  /**
926
1024
  * Message splitting configuration.
927
1025
  * Controls whether and how the agent splits responses into multiple messages.
928
1026
  */
929
- messageSplitting: z6.object({
1027
+ messageSplitting: z7.object({
930
1028
  /**
931
1029
  * Whether to allow natural message splitting.
932
1030
  * When true, the agent may split responses into multiple messages
933
1031
  * when it improves conversational flow.
934
1032
  */
935
- enabled: z6.boolean(),
1033
+ enabled: z7.boolean(),
936
1034
  /**
937
1035
  * Custom prompt to override the default message splitting guidance.
938
1036
  * If not provided, uses sensible defaults for when to split vs. keep together.
939
1037
  */
940
- prompt: z6.string().optional()
1038
+ prompt: z7.string().optional()
941
1039
  }).optional()
942
1040
  });
943
- var SchedulingDelaySchema = z6.object({
1041
+ var SchedulingDelaySchema = z7.object({
944
1042
  /** Time unit amount */
945
- amount: z6.number(),
1043
+ amount: z7.number(),
946
1044
  /** Time unit (e.g., "week", "weeks", "day", "days", "month", "months") */
947
- unit: z6.string(),
1045
+ unit: z7.string(),
948
1046
  /** Optional time window to constrain the delay */
949
- timeWindow: z6.string().optional()
1047
+ timeWindow: z7.string().optional()
950
1048
  });
951
- var SchedulingPatternSchema = z6.object({
1049
+ var SchedulingPatternSchema = z7.object({
952
1050
  /** Trigger name for this pattern */
953
- trigger: z6.string(),
1051
+ trigger: z7.string(),
954
1052
  /** Human-readable description of when this pattern applies */
955
- description: z6.string().optional(),
1053
+ description: z7.string().optional(),
956
1054
  /** Example user phrases that match this pattern */
957
- examples: z6.array(z6.string()).optional(),
1055
+ examples: z7.array(z7.string()).optional(),
958
1056
  /** Default delay for this pattern */
959
1057
  defaultDelay: SchedulingDelaySchema.optional()
960
1058
  });
961
- var SchedulingBehaviorConfigSchema = z6.object({
1059
+ var SchedulingBehaviorConfigSchema = z7.object({
962
1060
  /**
963
1061
  * Patterns that trigger scheduling suggestions.
964
1062
  * The agent uses these to know when to add sendAt to messages.
965
1063
  */
966
- patterns: z6.array(SchedulingPatternSchema).optional(),
1064
+ patterns: z7.array(SchedulingPatternSchema).optional(),
967
1065
  /**
968
1066
  * Default settings for scheduled messages.
969
1067
  */
970
- defaults: z6.object({
1068
+ defaults: z7.object({
971
1069
  /** Cancel scheduled message if user replies before send time (default: true) */
972
- cancelOnActivity: z6.boolean().optional(),
1070
+ cancelOnActivity: z7.boolean().optional(),
973
1071
  /** Whether scheduled messages require approval (default: true) */
974
- requiresApproval: z6.boolean().optional(),
1072
+ requiresApproval: z7.boolean().optional(),
975
1073
  /** Default time window policy to constrain all scheduled messages */
976
- timeWindow: z6.string().optional().describe("Time window policy name for scheduled messages")
1074
+ timeWindow: z7.string().optional().describe("Time window policy name for scheduled messages")
977
1075
  }).optional()
978
1076
  });
979
- var BehaviorConfigV3Schema = z6.object({
1077
+ var BehaviorConfigV3Schema = z7.object({
980
1078
  /**
981
1079
  * Response behavior - controls message sending via tool calls.
982
1080
  * When configured, agents must explicitly call system:message:send
@@ -989,32 +1087,32 @@ var BehaviorConfigV3Schema = z6.object({
989
1087
  */
990
1088
  scheduling: SchedulingBehaviorConfigSchema.optional()
991
1089
  });
992
- var PromptsConfigV3Schema = z6.object({
1090
+ var PromptsConfigV3Schema = z7.object({
993
1091
  /** Main system prompt with workflow instructions */
994
- system: z6.string().optional(),
1092
+ system: z7.string().optional(),
995
1093
  /** Injected during second pass when skills were loaded but tools not used */
996
- recovery: z6.string().optional(),
1094
+ recovery: z7.string().optional(),
997
1095
  /** Injected during follow-up passes when context needs updating */
998
- followUp: z6.string().optional(),
1096
+ followUp: z7.string().optional(),
999
1097
  /** Thread list title generation (system + user template with {{var}} placeholders) */
1000
- titleEnrichment: z6.object({
1001
- system: z6.string().optional(),
1002
- user: z6.string().optional()
1098
+ titleEnrichment: z7.object({
1099
+ system: z7.string().optional(),
1100
+ user: z7.string().optional()
1003
1101
  }).optional()
1004
1102
  });
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(),
1103
+ var AgentYAMLV3Schema = z7.object({
1104
+ $schema: z7.string().optional(),
1105
+ handle: z7.string(),
1106
+ name: z7.string(),
1107
+ version: z7.string().optional(),
1108
+ description: z7.string().optional(),
1011
1109
  // Persona - Who the agent is
1012
1110
  persona: PersonaV3Schema.optional(),
1013
1111
  // Skills - What the agent knows how to do (skills own their tools)
1014
- skills: z6.array(SkillRefSchema).optional(),
1112
+ skills: z7.array(SkillRefSchema).optional(),
1015
1113
  // Tools - Always-available tools before any skill loads
1016
1114
  // Examples: system:settings:business_information:get
1017
- tools: z6.array(AgentToolRefSchema).optional(),
1115
+ tools: z7.array(AgentToolRefSchema).optional(),
1018
1116
  /**
1019
1117
  * Events - When the agent activates
1020
1118
  * @deprecated Not yet implemented - this is a planned feature for event-driven agents.
@@ -1047,21 +1145,21 @@ var AgentYAMLV3Schema = z6.object({
1047
1145
  });
1048
1146
 
1049
1147
  // src/schemas.ts
1050
- var EnvVisibilitySchema = z7.enum(["visible", "encrypted"]);
1051
- var EnvVariableDefinitionSchema = z7.object({
1052
- label: z7.string(),
1053
- required: z7.boolean().optional(),
1148
+ var EnvVisibilitySchema = z8.enum(["visible", "encrypted"]);
1149
+ var EnvVariableDefinitionSchema = z8.object({
1150
+ label: z8.string(),
1151
+ required: z8.boolean().optional(),
1054
1152
  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([
1153
+ default: z8.string().optional(),
1154
+ description: z8.string().optional(),
1155
+ placeholder: z8.string().optional()
1156
+ });
1157
+ var EnvSchemaSchema = z8.record(z8.string(), EnvVariableDefinitionSchema);
1158
+ var ComputeLayerTypeSchema = z8.enum(["serverless", "dedicated"]);
1159
+ var FieldOwnerSchema = z8.enum(["APP", "SHARED"]);
1160
+ var PrimitiveSchema = z8.union([z8.string(), z8.number(), z8.boolean()]);
1161
+ var PrimitiveOrArraySchema = z8.union([PrimitiveSchema, z8.array(PrimitiveSchema)]);
1162
+ var FilterOperatorSchema = z8.enum([
1065
1163
  "eq",
1066
1164
  "neq",
1067
1165
  "gt",
@@ -1079,7 +1177,7 @@ var FilterOperatorSchema = z7.enum([
1079
1177
  "isEmpty",
1080
1178
  "isNotEmpty"
1081
1179
  ]);
1082
- var FilterConditionSchema = z7.object({
1180
+ var FilterConditionSchema = z8.object({
1083
1181
  eq: PrimitiveOrArraySchema,
1084
1182
  neq: PrimitiveOrArraySchema,
1085
1183
  gt: PrimitiveOrArraySchema,
@@ -1097,27 +1195,27 @@ var FilterConditionSchema = z7.object({
1097
1195
  isEmpty: PrimitiveOrArraySchema,
1098
1196
  isNotEmpty: PrimitiveOrArraySchema
1099
1197
  }).partial();
1100
- var StructuredFilterSchema = z7.record(
1101
- z7.string(),
1198
+ var StructuredFilterSchema = z8.record(
1199
+ z8.string(),
1102
1200
  FilterConditionSchema
1103
1201
  );
1104
- var ModelDependencySchema = z7.object({
1105
- model: z7.string(),
1106
- fields: z7.array(z7.string()).optional(),
1202
+ var ModelDependencySchema = z8.object({
1203
+ model: z8.string(),
1204
+ fields: z8.array(z8.string()).optional(),
1107
1205
  where: StructuredFilterSchema.optional()
1108
1206
  });
1109
- var ChannelDependencySchema = z7.object({
1110
- channel: z7.string()
1207
+ var ChannelDependencySchema = z8.object({
1208
+ channel: z8.string()
1111
1209
  });
1112
- var WorkflowDependencySchema = z7.object({
1113
- workflow: z7.string()
1210
+ var WorkflowDependencySchema = z8.object({
1211
+ workflow: z8.string()
1114
1212
  });
1115
- var ResourceDependencySchema = z7.union([
1213
+ var ResourceDependencySchema = z8.union([
1116
1214
  ModelDependencySchema,
1117
1215
  ChannelDependencySchema,
1118
1216
  WorkflowDependencySchema
1119
1217
  ]);
1120
- var FieldDataTypeSchema = z7.enum([
1218
+ var FieldDataTypeSchema = z8.enum([
1121
1219
  "LONG_STRING",
1122
1220
  "STRING",
1123
1221
  "NUMBER",
@@ -1130,74 +1228,74 @@ var FieldDataTypeSchema = z7.enum([
1130
1228
  "RELATION",
1131
1229
  "OBJECT"
1132
1230
  ]);
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(),
1231
+ var FieldOptionSchema = z8.object({
1232
+ label: z8.string(),
1233
+ value: z8.string(),
1234
+ color: z8.string().optional()
1235
+ });
1236
+ var InlineFieldDefinitionSchema = z8.object({
1237
+ limitChoices: z8.number().optional(),
1238
+ options: z8.array(FieldOptionSchema).optional(),
1239
+ minLength: z8.number().optional(),
1240
+ maxLength: z8.number().optional(),
1241
+ min: z8.number().optional(),
1242
+ max: z8.number().optional(),
1243
+ relatedModel: z8.string().optional(),
1244
+ pattern: z8.string().optional()
1245
+ });
1246
+ var AppFieldVisibilitySchema = z8.object({
1247
+ data: z8.boolean().optional(),
1248
+ list: z8.boolean().optional(),
1249
+ filters: z8.boolean().optional()
1250
+ });
1251
+ var FieldRequirementTypeSchema = z8.enum(["optional", "on_create", "required"]);
1252
+ var ModelFieldDefinitionSchema = z8.object({
1253
+ handle: z8.string(),
1254
+ label: z8.string(),
1157
1255
  type: FieldDataTypeSchema.optional(),
1158
- definition: z7.union([InlineFieldDefinitionSchema, z7.string()]).optional(),
1256
+ definition: z8.union([InlineFieldDefinitionSchema, z8.string()]).optional(),
1159
1257
  /** Field requirement type: 'optional', 'on_create', or 'required' */
1160
1258
  requirement: FieldRequirementTypeSchema.optional(),
1161
1259
  /** @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(),
1260
+ required: z8.boolean().optional(),
1261
+ unique: z8.boolean().optional(),
1262
+ system: z8.boolean().optional(),
1263
+ isList: z8.boolean().optional(),
1264
+ defaultValue: z8.object({ value: z8.unknown() }).optional(),
1265
+ description: z8.string().optional(),
1168
1266
  visibility: AppFieldVisibilitySchema.optional(),
1169
1267
  owner: FieldOwnerSchema.optional()
1170
1268
  });
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(),
1269
+ var ModelDefinitionSchema = z8.object({
1270
+ handle: z8.string(),
1271
+ name: z8.string(),
1272
+ namePlural: z8.string().optional(),
1273
+ labelTemplate: z8.string().optional(),
1274
+ description: z8.string().optional(),
1275
+ fields: z8.array(ModelFieldDefinitionSchema),
1276
+ requires: z8.array(ResourceDependencySchema).optional(),
1277
+ addDefaultPages: z8.boolean().optional(),
1278
+ addNavigation: z8.boolean().optional(),
1181
1279
  /** Root path for developer resource UI (e.g., '/access_requests'). Links internal model to a provision.pages entry. */
1182
- page: z7.string().optional()
1280
+ page: z8.string().optional()
1183
1281
  });
1184
- var RelationshipCardinalitySchema = z7.enum([
1282
+ var RelationshipCardinalitySchema = z8.enum([
1185
1283
  "ONE_TO_ONE",
1186
1284
  "ONE_TO_MANY"
1187
1285
  ]);
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()
1286
+ var OnDeleteBehaviorSchema = z8.enum(["NONE", "CASCADE", "RESTRICT"]);
1287
+ var RelationshipLinkSchema = z8.object({
1288
+ model: z8.string(),
1289
+ field: z8.string(),
1290
+ label: z8.string()
1193
1291
  });
1194
- var RelationshipDefinitionSchema = z7.object({
1292
+ var RelationshipDefinitionSchema = z8.object({
1195
1293
  source: RelationshipLinkSchema,
1196
1294
  target: RelationshipLinkSchema,
1197
1295
  cardinality: RelationshipCardinalitySchema,
1198
1296
  onDelete: OnDeleteBehaviorSchema.default("NONE")
1199
1297
  });
1200
- var ChannelCapabilityTypeSchema = z7.enum([
1298
+ var ChannelCapabilityTypeSchema = z8.enum([
1201
1299
  "messaging",
1202
1300
  // Text-based: SMS, WhatsApp, Messenger, DMs
1203
1301
  "voice",
@@ -1205,323 +1303,325 @@ var ChannelCapabilityTypeSchema = z7.enum([
1205
1303
  "video"
1206
1304
  // Video calls (future)
1207
1305
  ]);
1208
- var ChannelCapabilitySchema = z7.object({
1209
- label: z7.string(),
1306
+ var ChannelCapabilitySchema = z8.object({
1307
+ label: z8.string(),
1210
1308
  // Display name: "SMS", "WhatsApp Messages"
1211
- icon: z7.string().optional(),
1309
+ icon: z8.string().optional(),
1212
1310
  // Lucide icon name
1213
- receive: z7.string().optional(),
1311
+ receive: z8.string().optional(),
1214
1312
  // Inbound webhook handler
1215
- send: z7.string().optional()
1313
+ send: z8.string().optional(),
1216
1314
  // Outbound tool handle
1315
+ send_batch: z8.string().optional()
1316
+ // Batch outbound tool handle
1217
1317
  });
1218
- var ChannelFieldDefinitionSchema = z7.object({
1219
- handle: z7.string(),
1220
- label: z7.string(),
1318
+ var ChannelFieldDefinitionSchema = z8.object({
1319
+ handle: z8.string(),
1320
+ label: z8.string(),
1221
1321
  /** Field definition reference or inline definition */
1222
- definition: z7.union([InlineFieldDefinitionSchema, z7.string()]).optional(),
1322
+ definition: z8.union([InlineFieldDefinitionSchema, z8.string()]).optional(),
1223
1323
  /** Marks this field as the identifier field for the channel */
1224
- identifier: z7.boolean().optional(),
1324
+ identifier: z8.boolean().optional(),
1225
1325
  /** Whether this field is required */
1226
- required: z7.boolean().optional(),
1326
+ required: z8.boolean().optional(),
1227
1327
  /** Default value when creating a new field */
1228
- defaultValue: z7.object({ value: z7.unknown() }).passthrough().optional(),
1328
+ defaultValue: z8.object({ value: z8.unknown() }).passthrough().optional(),
1229
1329
  /** Visibility settings for the field */
1230
- visibility: z7.object({
1231
- data: z7.boolean().optional(),
1232
- list: z7.boolean().optional(),
1233
- filters: z7.boolean().optional()
1330
+ visibility: z8.object({
1331
+ data: z8.boolean().optional(),
1332
+ list: z8.boolean().optional(),
1333
+ filters: z8.boolean().optional()
1234
1334
  }).passthrough().optional(),
1235
1335
  /** Permission settings for the field */
1236
- permissions: z7.object({
1237
- read: z7.boolean().optional(),
1238
- write: z7.boolean().optional()
1336
+ permissions: z8.object({
1337
+ read: z8.boolean().optional(),
1338
+ write: z8.boolean().optional()
1239
1339
  }).passthrough().optional()
1240
1340
  }).passthrough();
1241
- var ChannelDefinitionSchema = z7.object({
1242
- handle: z7.string(),
1243
- label: z7.string(),
1244
- icon: z7.string().optional(),
1341
+ var ChannelDefinitionSchema = z8.object({
1342
+ handle: z8.string(),
1343
+ label: z8.string(),
1344
+ icon: z8.string().optional(),
1245
1345
  /** Array of field definitions for this channel. One field must have identifier: true. */
1246
- fields: z7.array(ChannelFieldDefinitionSchema),
1346
+ fields: z8.array(ChannelFieldDefinitionSchema),
1247
1347
  // Capabilities keyed by standard type (messaging, voice, video) - all optional
1248
- capabilities: z7.object({
1348
+ capabilities: z8.object({
1249
1349
  messaging: ChannelCapabilitySchema.optional(),
1250
1350
  voice: ChannelCapabilitySchema.optional(),
1251
1351
  video: ChannelCapabilitySchema.optional()
1252
1352
  })
1253
1353
  });
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()
1354
+ var WorkflowActionInputSchema = z8.object({
1355
+ key: z8.string(),
1356
+ label: z8.string(),
1357
+ fieldRef: z8.object({
1358
+ fieldHandle: z8.string(),
1359
+ entityHandle: z8.string()
1260
1360
  }).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()
1361
+ template: z8.string().optional()
1362
+ });
1363
+ var WorkflowActionSchema = z8.object({
1364
+ label: z8.string(),
1365
+ handle: z8.string(),
1366
+ batch: z8.boolean().optional(),
1367
+ entityHandle: z8.string().optional(),
1368
+ inputs: z8.array(WorkflowActionInputSchema).optional()
1369
+ });
1370
+ var WorkflowDefinitionSchema = z8.object({
1371
+ path: z8.string(),
1372
+ label: z8.string().optional(),
1373
+ handle: z8.string().optional(),
1374
+ requires: z8.array(ResourceDependencySchema).optional(),
1375
+ actions: z8.array(WorkflowActionSchema)
1376
+ });
1377
+ var PageTypeSchema = z8.enum(["INSTANCE", "LIST"]);
1378
+ var PageBlockTypeSchema = z8.enum(["form", "spreadsheet", "kanban", "calendar", "link", "list", "card"]);
1379
+ var PageFieldTypeSchema = z8.enum(["STRING", "FILE", "NUMBER", "DATE", "BOOLEAN", "SELECT", "FORM", "RELATIONSHIP"]);
1380
+ var PageFieldSourceSchema = z8.object({
1381
+ model: z8.string(),
1382
+ field: z8.string()
1383
+ });
1384
+ var PageFormHeaderSchema = z8.object({
1385
+ title: z8.string(),
1386
+ description: z8.string().optional()
1387
+ });
1388
+ var PageActionDefinitionSchema = z8.object({
1389
+ handle: z8.string(),
1390
+ label: z8.string(),
1391
+ handler: z8.string().optional(),
1392
+ href: z8.string().optional(),
1393
+ icon: z8.string().optional(),
1394
+ variant: z8.enum(["primary", "secondary", "destructive", "outline"]).optional(),
1395
+ isDisabled: z8.union([z8.boolean(), z8.string()]).optional(),
1396
+ isHidden: z8.union([z8.boolean(), z8.string()]).optional()
1297
1397
  }).refine((data) => Boolean(data.handler || data.href), {
1298
1398
  message: "Page action requires handler or href"
1299
1399
  });
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(),
1400
+ var FormV2StylePropsSchema = z8.object({
1401
+ id: z8.string(),
1402
+ row: z8.number(),
1403
+ col: z8.number(),
1404
+ className: z8.string().optional(),
1405
+ hidden: z8.boolean().optional()
1406
+ });
1407
+ var FieldSettingButtonPropsSchema = z8.object({
1408
+ label: z8.string(),
1409
+ variant: z8.enum(["default", "destructive", "outline", "secondary", "ghost", "link"]).optional(),
1410
+ size: z8.enum(["default", "sm", "lg", "icon"]).optional(),
1411
+ isLoading: z8.boolean().optional(),
1312
1412
  /** 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()
1413
+ isDisabled: z8.union([z8.boolean(), z8.string()]).optional(),
1414
+ leftIcon: z8.string().optional()
1315
1415
  });
1316
- var RelationshipExtensionSchema = z7.object({
1317
- model: z7.string()
1416
+ var RelationshipExtensionSchema = z8.object({
1417
+ model: z8.string()
1318
1418
  });
1319
- var FormLayoutColumnDefinitionSchema = z7.object({
1320
- field: z7.string(),
1321
- colSpan: z7.number(),
1322
- dataType: z7.string().optional(),
1323
- subQuery: z7.unknown().optional()
1419
+ var FormLayoutColumnDefinitionSchema = z8.object({
1420
+ field: z8.string(),
1421
+ colSpan: z8.number(),
1422
+ dataType: z8.string().optional(),
1423
+ subQuery: z8.unknown().optional()
1324
1424
  });
1325
- var FormLayoutRowDefinitionSchema = z7.object({
1326
- columns: z7.array(FormLayoutColumnDefinitionSchema)
1425
+ var FormLayoutRowDefinitionSchema = z8.object({
1426
+ columns: z8.array(FormLayoutColumnDefinitionSchema)
1327
1427
  });
1328
- var FormLayoutConfigDefinitionSchema = z7.object({
1329
- type: z7.literal("form"),
1330
- rows: z7.array(FormLayoutRowDefinitionSchema)
1428
+ var FormLayoutConfigDefinitionSchema = z8.object({
1429
+ type: z8.literal("form"),
1430
+ rows: z8.array(FormLayoutRowDefinitionSchema)
1331
1431
  });
1332
1432
  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()
1433
+ component: z8.literal("Input"),
1434
+ props: z8.object({
1435
+ label: z8.string().optional(),
1436
+ placeholder: z8.string().optional(),
1437
+ helpText: z8.string().optional(),
1438
+ type: z8.enum(["text", "number", "email", "password", "tel", "url", "hidden"]).optional(),
1439
+ required: z8.boolean().optional(),
1440
+ disabled: z8.boolean().optional(),
1441
+ value: z8.union([z8.string(), z8.number()]).optional()
1342
1442
  })
1343
1443
  });
1344
1444
  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()
1445
+ component: z8.literal("Textarea"),
1446
+ props: z8.object({
1447
+ label: z8.string().optional(),
1448
+ placeholder: z8.string().optional(),
1449
+ helpText: z8.string().optional(),
1450
+ required: z8.boolean().optional(),
1451
+ disabled: z8.boolean().optional(),
1452
+ value: z8.string().optional()
1353
1453
  })
1354
1454
  });
1355
1455
  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(),
1456
+ component: z8.literal("Select"),
1457
+ props: z8.object({
1458
+ label: z8.string().optional(),
1459
+ placeholder: z8.string().optional(),
1460
+ helpText: z8.string().optional(),
1361
1461
  /** 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()
1462
+ items: z8.union([z8.array(z8.object({ value: z8.string(), label: z8.string() })), z8.string()]).optional(),
1463
+ value: z8.string().optional(),
1464
+ isDisabled: z8.boolean().optional(),
1465
+ required: z8.boolean().optional()
1366
1466
  }),
1367
1467
  relationship: RelationshipExtensionSchema.optional(),
1368
1468
  /** For dynamic items using iterable pattern (e.g., 'system.models') */
1369
- iterable: z7.string().optional(),
1469
+ iterable: z8.string().optional(),
1370
1470
  /** Template for each item in the iterable */
1371
- itemTemplate: z7.object({
1372
- value: z7.string(),
1373
- label: z7.string()
1471
+ itemTemplate: z8.object({
1472
+ value: z8.string(),
1473
+ label: z8.string()
1374
1474
  }).optional()
1375
1475
  });
1376
1476
  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()
1477
+ component: z8.literal("Combobox"),
1478
+ props: z8.object({
1479
+ label: z8.string().optional(),
1480
+ placeholder: z8.string().optional(),
1481
+ helpText: z8.string().optional(),
1482
+ items: z8.array(z8.object({ value: z8.string(), label: z8.string() })).optional(),
1483
+ value: z8.string().optional()
1384
1484
  }),
1385
1485
  relationship: RelationshipExtensionSchema.optional()
1386
1486
  });
1387
1487
  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()
1488
+ component: z8.literal("Checkbox"),
1489
+ props: z8.object({
1490
+ label: z8.string().optional(),
1491
+ helpText: z8.string().optional(),
1492
+ checked: z8.boolean().optional(),
1493
+ disabled: z8.boolean().optional()
1394
1494
  })
1395
1495
  });
1396
1496
  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()
1497
+ component: z8.literal("DatePicker"),
1498
+ props: z8.object({
1499
+ label: z8.string().optional(),
1500
+ helpText: z8.string().optional(),
1501
+ value: z8.union([z8.string(), z8.date()]).optional(),
1502
+ disabled: z8.boolean().optional()
1403
1503
  })
1404
1504
  });
1405
1505
  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()
1506
+ component: z8.literal("TimePicker"),
1507
+ props: z8.object({
1508
+ label: z8.string().optional(),
1509
+ helpText: z8.string().optional(),
1510
+ value: z8.string().optional(),
1511
+ disabled: z8.boolean().optional()
1412
1512
  })
1413
1513
  });
1414
1514
  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()
1515
+ component: z8.literal("ImageSetting"),
1516
+ props: z8.object({
1517
+ label: z8.string().optional(),
1518
+ description: z8.string().optional(),
1519
+ helpText: z8.string().optional(),
1520
+ accept: z8.string().optional()
1421
1521
  })
1422
1522
  });
1423
1523
  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()
1524
+ component: z8.literal("FileSetting"),
1525
+ props: z8.object({
1526
+ label: z8.string().optional(),
1527
+ description: z8.string().optional(),
1528
+ helpText: z8.string().optional(),
1529
+ accept: z8.string().optional(),
1530
+ required: z8.boolean().optional(),
1531
+ button: z8.object({
1532
+ label: z8.string().optional(),
1533
+ variant: z8.enum(["default", "outline", "ghost", "link"]).optional(),
1534
+ size: z8.enum(["sm", "md", "lg"]).optional()
1435
1535
  }).optional()
1436
1536
  })
1437
1537
  });
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())
1538
+ var ListItemTemplateSchema = z8.object({
1539
+ component: z8.string(),
1540
+ span: z8.number().optional(),
1541
+ mdSpan: z8.number().optional(),
1542
+ lgSpan: z8.number().optional(),
1543
+ props: z8.record(z8.string(), z8.unknown())
1444
1544
  });
1445
1545
  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()
1546
+ component: z8.literal("List"),
1547
+ props: z8.object({
1548
+ title: z8.string().optional(),
1549
+ items: z8.array(z8.object({
1550
+ id: z8.string(),
1551
+ label: z8.string(),
1552
+ description: z8.string().optional()
1453
1553
  })).optional(),
1454
- emptyMessage: z7.string().optional()
1554
+ emptyMessage: z8.string().optional()
1455
1555
  }),
1456
- model: z7.string().optional(),
1457
- labelField: z7.string().optional(),
1458
- descriptionField: z7.string().optional(),
1459
- icon: z7.string().optional(),
1556
+ model: z8.string().optional(),
1557
+ labelField: z8.string().optional(),
1558
+ descriptionField: z8.string().optional(),
1559
+ icon: z8.string().optional(),
1460
1560
  /** Context variable name to iterate over (e.g., 'phone_numbers') */
1461
- iterable: z7.string().optional(),
1561
+ iterable: z8.string().optional(),
1462
1562
  /** Template for each item - use {{ item.xyz }} for field values */
1463
1563
  itemTemplate: ListItemTemplateSchema.optional()
1464
1564
  });
1465
1565
  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()
1566
+ component: z8.literal("EmptyForm"),
1567
+ props: z8.object({
1568
+ title: z8.string().optional(),
1569
+ description: z8.string().optional(),
1570
+ icon: z8.string().optional()
1471
1571
  })
1472
1572
  });
1473
1573
  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()
1574
+ component: z8.literal("Alert"),
1575
+ props: z8.object({
1576
+ title: z8.string(),
1577
+ description: z8.string(),
1578
+ icon: z8.string().optional(),
1579
+ variant: z8.enum(["default", "destructive"]).optional()
1480
1580
  })
1481
1581
  });
1482
1582
  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()
1583
+ component: z8.literal("EventWiringPanel"),
1584
+ props: z8.object({
1585
+ eventTypes: z8.array(
1586
+ z8.object({
1587
+ type: z8.string(),
1588
+ label: z8.string(),
1589
+ glofoxType: z8.string().optional(),
1590
+ description: z8.string().optional(),
1591
+ icon: z8.string().optional()
1492
1592
  })
1493
1593
  ),
1494
- recommendedWorkflowHandle: z7.string().optional()
1594
+ recommendedWorkflowHandle: z8.string().optional()
1495
1595
  })
1496
1596
  });
1497
- var ModalFormDefinitionSchema = z7.object({
1597
+ var ModalFormDefinitionSchema = z8.object({
1498
1598
  header: PageFormHeaderSchema,
1499
- handler: z7.string(),
1599
+ handler: z8.string(),
1500
1600
  /** Named dialog template to use instead of inline fields */
1501
- template: z7.string().optional(),
1601
+ template: z8.string().optional(),
1502
1602
  /** Template-specific params to pass to the dialog */
1503
- templateParams: z7.record(z7.string(), z7.unknown()).optional(),
1603
+ templateParams: z8.record(z8.string(), z8.unknown()).optional(),
1504
1604
  /** Inline field definitions (used when template is not specified) */
1505
- fields: z7.lazy(() => z7.array(FormV2ComponentDefinitionSchema)).optional(),
1605
+ fields: z8.lazy(() => z8.array(FormV2ComponentDefinitionSchema)).optional(),
1506
1606
  layout: FormLayoutConfigDefinitionSchema.optional(),
1507
- actions: z7.array(PageActionDefinitionSchema).optional()
1607
+ actions: z8.array(PageActionDefinitionSchema).optional()
1508
1608
  });
1509
1609
  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(),
1610
+ component: z8.literal("FieldSetting"),
1611
+ props: z8.object({
1612
+ label: z8.string(),
1613
+ description: z8.string().optional(),
1614
+ helpText: z8.string().optional(),
1615
+ mode: z8.enum(["field", "setting"]).optional(),
1516
1616
  /** Status indicator - can be literal or Liquid template */
1517
- status: z7.string().optional(),
1617
+ status: z8.string().optional(),
1518
1618
  /** Text to display alongside status badge - can be Liquid template */
1519
- statusText: z7.string().optional(),
1619
+ statusText: z8.string().optional(),
1520
1620
  button: FieldSettingButtonPropsSchema
1521
1621
  }),
1522
1622
  modalForm: ModalFormDefinitionSchema.optional()
1523
1623
  });
1524
- var FormV2ComponentDefinitionSchema = z7.discriminatedUnion("component", [
1624
+ var FormV2ComponentDefinitionSchema = z8.discriminatedUnion("component", [
1525
1625
  InputComponentDefinitionSchema,
1526
1626
  TextareaComponentDefinitionSchema,
1527
1627
  SelectComponentDefinitionSchema,
@@ -1537,82 +1637,82 @@ var FormV2ComponentDefinitionSchema = z7.discriminatedUnion("component", [
1537
1637
  AlertComponentDefinitionSchema,
1538
1638
  EventWiringPanelComponentDefinitionSchema
1539
1639
  ]);
1540
- var FormV2PropsDefinitionSchema = z7.object({
1541
- formVersion: z7.literal("v2"),
1542
- id: z7.string().optional(),
1543
- fields: z7.array(FormV2ComponentDefinitionSchema),
1640
+ var FormV2PropsDefinitionSchema = z8.object({
1641
+ formVersion: z8.literal("v2"),
1642
+ id: z8.string().optional(),
1643
+ fields: z8.array(FormV2ComponentDefinitionSchema),
1544
1644
  layout: FormLayoutConfigDefinitionSchema,
1545
1645
  /** Optional actions that trigger MCP tool calls */
1546
- actions: z7.array(PageActionDefinitionSchema).optional()
1646
+ actions: z8.array(PageActionDefinitionSchema).optional()
1547
1647
  });
1548
- var CardBlockHeaderSchema = z7.object({
1549
- title: z7.string(),
1550
- description: z7.string().optional(),
1551
- descriptionHref: z7.string().optional()
1648
+ var CardBlockHeaderSchema = z8.object({
1649
+ title: z8.string(),
1650
+ description: z8.string().optional(),
1651
+ descriptionHref: z8.string().optional()
1552
1652
  });
1553
- var CardBlockDefinitionSchema = z7.object({
1554
- type: z7.literal("card"),
1555
- restructurable: z7.boolean().optional(),
1653
+ var CardBlockDefinitionSchema = z8.object({
1654
+ type: z8.literal("card"),
1655
+ restructurable: z8.boolean().optional(),
1556
1656
  header: CardBlockHeaderSchema.optional(),
1557
1657
  form: FormV2PropsDefinitionSchema,
1558
- actions: z7.array(PageActionDefinitionSchema).optional(),
1559
- secondaryActions: z7.array(PageActionDefinitionSchema).optional(),
1560
- primaryActions: z7.array(PageActionDefinitionSchema).optional()
1658
+ actions: z8.array(PageActionDefinitionSchema).optional(),
1659
+ secondaryActions: z8.array(PageActionDefinitionSchema).optional(),
1660
+ primaryActions: z8.array(PageActionDefinitionSchema).optional()
1561
1661
  });
1562
- var PageFieldDefinitionBaseSchema = z7.object({
1563
- handle: z7.string(),
1662
+ var PageFieldDefinitionBaseSchema = z8.object({
1663
+ handle: z8.string(),
1564
1664
  type: PageFieldTypeSchema,
1565
- label: z7.string(),
1566
- description: z7.string().optional(),
1567
- required: z7.boolean().optional(),
1568
- handler: z7.string().optional(),
1665
+ label: z8.string(),
1666
+ description: z8.string().optional(),
1667
+ required: z8.boolean().optional(),
1668
+ handler: z8.string().optional(),
1569
1669
  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()
1670
+ options: z8.array(z8.object({ value: z8.string(), label: z8.string() })).optional(),
1671
+ accept: z8.string().optional(),
1672
+ model: z8.string().optional()
1573
1673
  });
1574
1674
  var PageFieldDefinitionSchema = PageFieldDefinitionBaseSchema.extend({
1575
1675
  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"),
1676
+ fields: z8.lazy(() => z8.array(PageFieldDefinitionSchema)).optional(),
1677
+ actions: z8.lazy(() => z8.array(PageActionDefinitionSchema)).optional()
1678
+ });
1679
+ var LegacyFormBlockDefinitionSchema = z8.object({
1680
+ type: z8.enum(["form", "spreadsheet", "kanban", "calendar", "link"]),
1681
+ title: z8.string().optional(),
1682
+ fields: z8.array(PageFieldDefinitionSchema).optional(),
1683
+ readonly: z8.boolean().optional()
1684
+ });
1685
+ var ListBlockDefinitionSchema = z8.object({
1686
+ type: z8.literal("list"),
1687
+ title: z8.string().optional(),
1688
+ model: z8.string(),
1689
+ labelField: z8.string().optional(),
1690
+ descriptionField: z8.string().optional(),
1691
+ icon: z8.string().optional(),
1692
+ emptyMessage: z8.string().optional()
1693
+ });
1694
+ var ModelMapperBlockDefinitionSchema = z8.object({
1695
+ type: z8.literal("model_mapper"),
1596
1696
  /** The SHARED model handle from install config (e.g., "client", "patient") */
1597
- model: z7.string()
1697
+ model: z8.string()
1598
1698
  });
1599
- var PageBlockDefinitionSchema = z7.union([
1699
+ var PageBlockDefinitionSchema = z8.union([
1600
1700
  CardBlockDefinitionSchema,
1601
1701
  LegacyFormBlockDefinitionSchema,
1602
1702
  ListBlockDefinitionSchema,
1603
1703
  ModelMapperBlockDefinitionSchema
1604
1704
  ]);
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()])
1705
+ var PageContextModeSchema = z8.enum(["first", "many", "count", "all"]).transform((val) => val === "all" ? "many" : val);
1706
+ var PageContextFiltersSchema = z8.record(
1707
+ z8.string(),
1708
+ z8.record(
1709
+ z8.string(),
1710
+ z8.union([PrimitiveSchema, z8.array(PrimitiveSchema), z8.string()])
1611
1711
  )
1612
1712
  );
1613
- var PageContextItemDefinitionSchema = z7.object({
1713
+ var PageContextItemDefinitionSchema = z8.object({
1614
1714
  /** Model handle to fetch data from */
1615
- model: z7.string(),
1715
+ model: z8.string(),
1616
1716
  /** Fetch mode: 'first' returns single object, 'many' returns array, 'count' returns number */
1617
1717
  mode: PageContextModeSchema,
1618
1718
  /**
@@ -1622,69 +1722,69 @@ var PageContextItemDefinitionSchema = z7.object({
1622
1722
  */
1623
1723
  filters: PageContextFiltersSchema.optional(),
1624
1724
  /** Optional limit for 'many' mode */
1625
- limit: z7.number().optional()
1725
+ limit: z8.number().optional()
1626
1726
  });
1627
- var PageContextToolItemDefinitionSchema = z7.object({
1727
+ var PageContextToolItemDefinitionSchema = z8.object({
1628
1728
  /** Tool name to invoke for fetching context data */
1629
- tool: z7.string()
1729
+ tool: z8.string()
1630
1730
  });
1631
- var PageContextDefinitionSchema = z7.record(
1632
- z7.string(),
1633
- z7.union([PageContextItemDefinitionSchema, PageContextToolItemDefinitionSchema])
1731
+ var PageContextDefinitionSchema = z8.record(
1732
+ z8.string(),
1733
+ z8.union([PageContextItemDefinitionSchema, PageContextToolItemDefinitionSchema])
1634
1734
  );
1635
- var PageInstanceFilterSchema = z7.object({
1636
- model: z7.string(),
1637
- where: z7.record(z7.string(), z7.unknown()).optional()
1735
+ var PageInstanceFilterSchema = z8.object({
1736
+ model: z8.string(),
1737
+ where: z8.record(z8.string(), z8.unknown()).optional()
1638
1738
  });
1639
- var NavigationItemSchema = z7.object({
1739
+ var NavigationItemSchema = z8.object({
1640
1740
  /** Display label (supports Liquid templates) */
1641
- label: z7.string(),
1741
+ label: z8.string(),
1642
1742
  /** URL href (supports Liquid templates with path_params and context) */
1643
- href: z7.string(),
1743
+ href: z8.string(),
1644
1744
  /** Optional icon name */
1645
- icon: z7.string().optional(),
1745
+ icon: z8.string().optional(),
1646
1746
  /** When true, item is omitted from rendered navigation (supports Liquid templates) */
1647
- hidden: z7.union([z7.boolean(), z7.string()]).optional()
1747
+ hidden: z8.union([z8.boolean(), z8.string()]).optional()
1648
1748
  });
1649
- var NavigationSectionSchema = z7.object({
1749
+ var NavigationSectionSchema = z8.object({
1650
1750
  /** Section title (supports Liquid templates) */
1651
- title: z7.string().optional(),
1751
+ title: z8.string().optional(),
1652
1752
  /** Navigation items in this section */
1653
- items: z7.array(NavigationItemSchema)
1753
+ items: z8.array(NavigationItemSchema)
1654
1754
  });
1655
- var NavigationSidebarSchema = z7.object({
1755
+ var NavigationSidebarSchema = z8.object({
1656
1756
  /** Sections to display in the sidebar */
1657
- sections: z7.array(NavigationSectionSchema)
1757
+ sections: z8.array(NavigationSectionSchema)
1658
1758
  });
1659
- var BreadcrumbItemSchema = z7.object({
1759
+ var BreadcrumbItemSchema = z8.object({
1660
1760
  /** Display label (supports Liquid templates) */
1661
- label: z7.string(),
1761
+ label: z8.string(),
1662
1762
  /** Optional href - if not provided, item is not clickable */
1663
- href: z7.string().optional()
1763
+ href: z8.string().optional()
1664
1764
  });
1665
- var NavigationBreadcrumbSchema = z7.object({
1765
+ var NavigationBreadcrumbSchema = z8.object({
1666
1766
  /** Breadcrumb items from left to right */
1667
- items: z7.array(BreadcrumbItemSchema)
1767
+ items: z8.array(BreadcrumbItemSchema)
1668
1768
  });
1669
- var NavigationConfigSchema = z7.object({
1769
+ var NavigationConfigSchema = z8.object({
1670
1770
  /** Sidebar navigation */
1671
1771
  sidebar: NavigationSidebarSchema.optional(),
1672
1772
  /** Breadcrumb navigation */
1673
1773
  breadcrumb: NavigationBreadcrumbSchema.optional()
1674
1774
  });
1675
- var PageAudienceSchema = z7.enum(["install", "developer", "both"]);
1676
- var PageDefinitionSchema = z7.object({
1775
+ var PageAudienceSchema = z8.enum(["install", "developer", "both"]);
1776
+ var PageDefinitionSchema = z8.object({
1677
1777
  /** Unique identifier within the app (snake_case) */
1678
- handle: z7.string().optional(),
1778
+ handle: z8.string().optional(),
1679
1779
  /** Human-readable display name */
1680
- label: z7.string(),
1780
+ label: z8.string(),
1681
1781
  /** Optional description for documentation/UI */
1682
- description: z7.string().optional(),
1782
+ description: z8.string().optional(),
1683
1783
  type: PageTypeSchema,
1684
1784
  /** URL path for this page (e.g., '/phone-numbers' or '/phone-numbers/[id]' for dynamic segments) */
1685
- path: z7.string(),
1785
+ path: z8.string(),
1686
1786
  /** When true, this page is the default landing page for the app installation */
1687
- default: z7.boolean().optional(),
1787
+ default: z8.boolean().optional(),
1688
1788
  /**
1689
1789
  * Page audience:
1690
1790
  * - 'install': Visible only to app installers (default)
@@ -1698,115 +1798,134 @@ var PageDefinitionSchema = z7.object({
1698
1798
  * - string: Liquid template that evaluates to true/false
1699
1799
  * - NavigationConfigSchema: full navigation override for this page (replaces base navigation)
1700
1800
  */
1701
- navigation: z7.union([z7.boolean(), z7.string(), NavigationConfigSchema]).optional().default(true),
1702
- blocks: z7.array(PageBlockDefinitionSchema),
1703
- actions: z7.array(PageActionDefinitionSchema).optional(),
1801
+ navigation: z8.union([z8.boolean(), z8.string(), NavigationConfigSchema]).optional().default(true),
1802
+ blocks: z8.array(PageBlockDefinitionSchema),
1803
+ actions: z8.array(PageActionDefinitionSchema).optional(),
1704
1804
  /** Context data to load for Liquid templates. appInstallationId filtering is automatic. */
1705
1805
  context: PageContextDefinitionSchema.optional(),
1706
1806
  /** @deprecated Use context instead */
1707
1807
  filter: PageInstanceFilterSchema.optional()
1708
1808
  });
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(),
1809
+ var WebhookHttpMethodSchema = z8.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]);
1810
+ var WebhookTypeSchema = z8.enum(["WEBHOOK", "CALLBACK"]);
1811
+ var WebhookHandlerDefinitionSchema = z8.object({
1812
+ description: z8.string().optional(),
1813
+ methods: z8.array(WebhookHttpMethodSchema).optional(),
1714
1814
  /** Invocation type: WEBHOOK (fire-and-forget) or CALLBACK (waits for response). Defaults to WEBHOOK. */
1715
1815
  type: WebhookTypeSchema.optional(),
1716
- handler: z7.unknown()
1816
+ handler: z8.unknown()
1717
1817
  });
1718
- var WebhooksSchema = z7.record(z7.string(), WebhookHandlerDefinitionSchema);
1719
- var AgentDefinitionSchema = z7.object({
1818
+ var WebhooksSchema = z8.record(z8.string(), WebhookHandlerDefinitionSchema);
1819
+ var AgentDefinitionSchema = z8.object({
1720
1820
  /** Unique identifier within the app (used for upserts) */
1721
- handle: z7.string().regex(/^[a-z0-9_-]+$/, "Handle must be lowercase alphanumeric with dashes/underscores"),
1821
+ handle: z8.string().regex(/^[a-z0-9_-]+$/, "Handle must be lowercase alphanumeric with dashes/underscores"),
1722
1822
  /** Display name */
1723
- name: z7.string().min(1),
1823
+ name: z8.string().min(1),
1724
1824
  /** Description of what the agent does */
1725
- description: z7.string(),
1825
+ description: z8.string(),
1726
1826
  /** System prompt (static, no templating) */
1727
- system: z7.string(),
1827
+ system: z8.string(),
1728
1828
  /** Tool names to bind (can be empty for orchestrator agents) */
1729
- tools: z7.array(z7.string()),
1829
+ tools: z8.array(z8.string()),
1730
1830
  /** Optional LLM model override */
1731
- llmModelId: z7.string().optional(),
1831
+ llmModelId: z8.string().optional(),
1732
1832
  /** Parent agent that can call this agent ('composer' or another agent handle) */
1733
- parentAgent: z7.string().optional()
1833
+ parentAgent: z8.string().optional()
1734
1834
  });
1735
- var InstallConfigSchema = z7.object({
1835
+ var InstallConfigSchema = z8.object({
1736
1836
  env: EnvSchemaSchema.optional(),
1737
1837
  /** SHARED model definitions (mapped to user's existing data during installation) */
1738
- models: z7.array(ModelDefinitionSchema).optional(),
1838
+ models: z8.array(ModelDefinitionSchema).optional(),
1739
1839
  /** Relationship definitions between SHARED models */
1740
- relationships: z7.array(RelationshipDefinitionSchema).optional()
1840
+ relationships: z8.array(RelationshipDefinitionSchema).optional()
1741
1841
  });
1742
- var ProvisionConfigSchema = z7.object({
1842
+ var ProvisionConfigSchema = z8.object({
1743
1843
  env: EnvSchemaSchema.optional(),
1744
1844
  /** INTERNAL model definitions (app-owned, not visible to users) */
1745
- models: z7.array(ModelDefinitionSchema).optional(),
1845
+ models: z8.array(ModelDefinitionSchema).optional(),
1746
1846
  /** Relationship definitions between INTERNAL models */
1747
- relationships: z7.array(RelationshipDefinitionSchema).optional(),
1748
- channels: z7.array(ChannelDefinitionSchema).optional(),
1749
- workflows: z7.array(WorkflowDefinitionSchema).optional(),
1847
+ relationships: z8.array(RelationshipDefinitionSchema).optional(),
1848
+ channels: z8.array(ChannelDefinitionSchema).optional(),
1849
+ workflows: z8.array(WorkflowDefinitionSchema).optional(),
1750
1850
  /** Base navigation configuration for all pages (can be overridden per page) */
1751
1851
  navigation: NavigationConfigSchema.optional(),
1752
- pages: z7.array(PageDefinitionSchema).optional()
1852
+ pages: z8.array(PageDefinitionSchema).optional()
1753
1853
  });
1754
- var SkedyulConfigSchema = z7.object({
1755
- name: z7.string(),
1756
- version: z7.string().optional(),
1757
- description: z7.string().optional(),
1854
+ var SkedyulConfigSchema = z8.object({
1855
+ name: z8.string(),
1856
+ version: z8.string().optional(),
1857
+ description: z8.string().optional(),
1758
1858
  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()
1859
+ tools: z8.unknown().optional(),
1860
+ webhooks: z8.unknown().optional(),
1861
+ provision: z8.union([ProvisionConfigSchema, z8.unknown()]).optional(),
1862
+ agents: z8.array(AgentDefinitionSchema).optional()
1763
1863
  });
1764
1864
  function safeParseConfig(data) {
1765
1865
  const result = SkedyulConfigSchema.safeParse(data);
1766
1866
  return result.success ? result.data : null;
1767
1867
  }
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({
1868
+ var MessageSendChannelSchema = z8.object({
1869
+ id: z8.string(),
1870
+ handle: z8.string(),
1871
+ identifierValue: z8.string()
1872
+ });
1873
+ var MessageSendSubscriptionSchema = z8.object({
1874
+ id: z8.string(),
1875
+ identifierValue: z8.string()
1876
+ });
1877
+ var MessageSendContactSchema = z8.object({
1878
+ id: z8.string(),
1879
+ name: z8.string().optional()
1880
+ });
1881
+ var MessageSendRecipientSchema = z8.object({
1882
+ address: z8.string(),
1883
+ name: z8.string().optional(),
1884
+ participantId: z8.string().optional(),
1885
+ contactId: z8.string().optional()
1886
+ });
1887
+ var MessageSendAttachmentSchema = z8.object({
1888
+ filename: z8.string(),
1889
+ url: z8.string(),
1890
+ mimeType: z8.string(),
1891
+ size: z8.number()
1892
+ });
1893
+ var MessageSendMessageSchema = z8.object({
1894
+ id: z8.string(),
1895
+ content: z8.string(),
1896
+ contentRaw: z8.string().optional(),
1897
+ title: z8.string().optional(),
1898
+ attachments: z8.array(MessageSendAttachmentSchema).optional()
1899
+ });
1900
+ var MessageSendInputSchema = z8.object({
1801
1901
  channel: MessageSendChannelSchema,
1802
1902
  subscription: MessageSendSubscriptionSchema.optional(),
1803
1903
  contact: MessageSendContactSchema.optional(),
1804
1904
  recipient: MessageSendRecipientSchema.optional(),
1805
1905
  message: MessageSendMessageSchema
1806
1906
  });
1807
- var MessageSendOutputSchema = z7.object({
1808
- status: z7.enum(["sent", "queued", "failed"]),
1809
- remoteId: z7.string().optional()
1907
+ var MessageSendOutputSchema = z8.object({
1908
+ status: z8.enum(["sent", "queued", "failed"]),
1909
+ remoteId: z8.string().optional()
1910
+ });
1911
+ var MessageBulkRecipientSchema = z8.object({
1912
+ address: z8.string(),
1913
+ renderedBody: z8.string(),
1914
+ instanceId: z8.string().optional(),
1915
+ threadId: z8.string().optional(),
1916
+ messageId: z8.string().optional(),
1917
+ contactId: z8.string().optional()
1918
+ });
1919
+ var MessageBulkSendInputSchema = z8.object({
1920
+ channel: MessageSendChannelSchema,
1921
+ recipients: z8.array(MessageBulkRecipientSchema).min(1).max(1e4),
1922
+ schedule: z8.object({ at: z8.string() }).optional()
1923
+ });
1924
+ var MessageBulkSendOutputSchema = z8.object({
1925
+ status: z8.enum(["accepted", "failed"]),
1926
+ operationId: z8.string().optional(),
1927
+ acceptedCount: z8.number().int().nonnegative(),
1928
+ rejectedCount: z8.number().int().nonnegative().optional()
1810
1929
  });
1811
1930
  function isModelDependency(dep) {
1812
1931
  return "model" in dep;
@@ -1820,7 +1939,7 @@ function isWorkflowDependency(dep) {
1820
1939
 
1821
1940
  // src/server/index.ts
1822
1941
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
1823
- import * as z10 from "zod";
1942
+ import * as z11 from "zod";
1824
1943
 
1825
1944
  // src/core/service.ts
1826
1945
  var CoreApiService = class {
@@ -1929,17 +2048,20 @@ function getQueueConfigWithRetry(queueName) {
1929
2048
  }
1930
2049
 
1931
2050
  // src/server/utils/schema.ts
1932
- import * as z8 from "zod";
2051
+ import * as z9 from "zod";
1933
2052
  function normalizeBilling(billing) {
1934
- if (!billing || typeof billing.credits !== "number") {
2053
+ if (!billing || typeof billing !== "object") {
1935
2054
  return { credits: 0 };
1936
2055
  }
2056
+ if (typeof billing.credits !== "number") {
2057
+ return { ...billing, credits: 0 };
2058
+ }
1937
2059
  return billing;
1938
2060
  }
1939
2061
  function toJsonSchema(schema) {
1940
2062
  if (!schema) return void 0;
1941
2063
  try {
1942
- return z8.toJSONSchema(schema, {
2064
+ return z9.toJSONSchema(schema, {
1943
2065
  unrepresentable: "any"
1944
2066
  // Handle z.date(), z.bigint() etc gracefully
1945
2067
  });
@@ -1950,12 +2072,12 @@ function toJsonSchema(schema) {
1950
2072
  }
1951
2073
  function isToolSchemaWithJson(schema) {
1952
2074
  return Boolean(
1953
- schema && typeof schema === "object" && "zod" in schema && schema.zod instanceof z8.ZodType
2075
+ schema && typeof schema === "object" && "zod" in schema && schema.zod instanceof z9.ZodType
1954
2076
  );
1955
2077
  }
1956
2078
  function getZodSchema(schema) {
1957
2079
  if (!schema) return void 0;
1958
- if (schema instanceof z8.ZodType) {
2080
+ if (schema instanceof z9.ZodType) {
1959
2081
  return schema;
1960
2082
  }
1961
2083
  if (isToolSchemaWithJson(schema)) {
@@ -2102,7 +2224,7 @@ function buildToolCallErrorOutput(result) {
2102
2224
 
2103
2225
  // src/core/client.ts
2104
2226
  import { AsyncLocalStorage } from "async_hooks";
2105
- import { z as z9 } from "zod/v4";
2227
+ import { z as z10 } from "zod/v4";
2106
2228
  var requestConfigStorage = new AsyncLocalStorage();
2107
2229
  var globalConfig = {
2108
2230
  baseUrl: process.env.SKEDYUL_API_URL ?? process.env.SKEDYUL_NODE_URL ?? "",
@@ -3082,7 +3204,7 @@ var resource = {
3082
3204
  }
3083
3205
  };
3084
3206
  function zodSchemaToJsonSchema(schema) {
3085
- return z9.toJSONSchema(schema);
3207
+ return z10.toJSONSchema(schema);
3086
3208
  }
3087
3209
  var ai = {
3088
3210
  /**
@@ -3308,10 +3430,27 @@ function getActiveQueuedOperation() {
3308
3430
  function getActiveQueuedOperationStack() {
3309
3431
  return activeOperationStackStorage.getStore() ?? [];
3310
3432
  }
3311
- function isInsidePetbooqzCalendarBookingMutex() {
3312
- return getActiveQueuedOperationStack().some(
3313
- (operation) => operation.resolved.name === "petbooqz_calendar_booking" && operation.lease !== null
3314
- );
3433
+ function getActiveMutexQueueNames() {
3434
+ const names = /* @__PURE__ */ new Set();
3435
+ for (const operation of getActiveQueuedOperationStack()) {
3436
+ if (operation.lease === null) {
3437
+ continue;
3438
+ }
3439
+ const config = getQueueConfigWithRetry(operation.resolved.name);
3440
+ if (config?.mutex === true) {
3441
+ names.add(operation.resolved.name);
3442
+ }
3443
+ }
3444
+ return [...names];
3445
+ }
3446
+ function shouldSkipNestedAcquire(queueName) {
3447
+ for (const mutexQueueName of getActiveMutexQueueNames()) {
3448
+ const config = getQueueConfigWithRetry(mutexQueueName);
3449
+ if (config?.suppressesQueues?.includes(queueName)) {
3450
+ return true;
3451
+ }
3452
+ }
3453
+ return false;
3315
3454
  }
3316
3455
  function setActiveQueuedOperationLease(lease) {
3317
3456
  const op = activeOperationStorage.getStore();
@@ -3548,6 +3687,7 @@ function buildToolMetadata(registry) {
3548
3687
  const timeout = typeof rawTimeout === "number" && rawTimeout > 0 ? rawTimeout : 1e4;
3549
3688
  const retries = typeof rawRetries === "number" && rawRetries >= 1 ? rawRetries : 1;
3550
3689
  const queueTouchPoints = tool.queueTouchPoints ?? toolConfig.queueTouchPoints;
3690
+ const rateLimitHandoff = tool.rateLimitHandoff ?? toolConfig.rateLimitHandoff;
3551
3691
  return {
3552
3692
  name: tool.name,
3553
3693
  displayName: tool.label || tool.name,
@@ -3558,11 +3698,13 @@ function buildToolMetadata(registry) {
3558
3698
  timeout,
3559
3699
  retries,
3560
3700
  queueTouchPoints,
3701
+ rateLimitHandoff,
3561
3702
  config: {
3562
3703
  timeout,
3563
3704
  retries,
3564
3705
  completionHints: toolConfig.completionHints,
3565
- queueTouchPoints
3706
+ queueTouchPoints,
3707
+ rateLimitHandoff
3566
3708
  }
3567
3709
  };
3568
3710
  });
@@ -3604,7 +3746,8 @@ function createCallToolHandler(registry, state, onMaxRequests) {
3604
3746
  }
3605
3747
  const fn = tool.handler;
3606
3748
  const args = toolArgsInput ?? {};
3607
- const estimateMode = args.estimate === true;
3749
+ const rawContextForMode = args.context ?? {};
3750
+ const estimateMode = args.estimate === true || rawContextForMode.mode === "estimate";
3608
3751
  if (!estimateMode) {
3609
3752
  state.incrementRequestCount();
3610
3753
  if (state.shouldShutdown()) {
@@ -4091,7 +4234,8 @@ function serializeConfig(config) {
4091
4234
  // Read timeout/retries from top-level first, then fallback to config
4092
4235
  timeout: tool.timeout ?? tool.config?.timeout,
4093
4236
  retries: tool.retries ?? tool.config?.retries,
4094
- queueTouchPoints: tool.queueTouchPoints ?? tool.config?.queueTouchPoints
4237
+ queueTouchPoints: tool.queueTouchPoints ?? tool.config?.queueTouchPoints,
4238
+ rateLimitHandoff: tool.rateLimitHandoff ?? tool.config?.rateLimitHandoff
4095
4239
  })) : [],
4096
4240
  webhooks: webhookRegistry ? Object.values(webhookRegistry).map((w) => ({
4097
4241
  name: w.name,
@@ -4786,11 +4930,12 @@ async function handleMcpRoute(req, ctx) {
4786
4930
  async function handleMcpToolsCall(params, id, ctx) {
4787
4931
  const toolName = params?.name;
4788
4932
  const rawArgs = params?.arguments ?? {};
4789
- const hasSkedyulFormat = "inputs" in rawArgs || "env" in rawArgs || "context" in rawArgs || "invocation" in rawArgs;
4933
+ const hasSkedyulFormat = "inputs" in rawArgs || "env" in rawArgs || "context" in rawArgs || "invocation" in rawArgs || "estimate" in rawArgs;
4790
4934
  const toolInputs = hasSkedyulFormat ? rawArgs.inputs ?? {} : rawArgs;
4791
4935
  const toolContext = hasSkedyulFormat ? rawArgs.context : void 0;
4792
4936
  const toolEnv = hasSkedyulFormat ? rawArgs.env : void 0;
4793
4937
  const toolInvocation = hasSkedyulFormat ? rawArgs.invocation : void 0;
4938
+ const estimate = hasSkedyulFormat && rawArgs.estimate === true;
4794
4939
  const found = findToolInRegistry(ctx.registry, toolName);
4795
4940
  if (!found) {
4796
4941
  return {
@@ -4815,7 +4960,8 @@ async function handleMcpToolsCall(params, id, ctx) {
4815
4960
  inputs: validatedInputs,
4816
4961
  context: toolContext,
4817
4962
  env: toolEnv,
4818
- invocation: toolInvocation
4963
+ invocation: toolInvocation,
4964
+ estimate
4819
4965
  });
4820
4966
  let result;
4821
4967
  const isFailure2 = isToolCallFailure(toolResult);
@@ -5273,12 +5419,12 @@ function createSkedyulServer(config) {
5273
5419
  const toolDisplayName = tool.label || toolName;
5274
5420
  const inputZodSchema = getZodSchema(tool.inputSchema);
5275
5421
  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()
5422
+ const wrappedInputSchema = z11.object({
5423
+ inputs: inputZodSchema ?? z11.record(z11.string(), z11.unknown()).optional(),
5424
+ context: z11.record(z11.string(), z11.unknown()).optional(),
5425
+ env: z11.record(z11.string(), z11.string()).optional(),
5426
+ invocation: z11.record(z11.string(), z11.unknown()).optional(),
5427
+ estimate: z11.boolean().optional()
5282
5428
  }).passthrough();
5283
5429
  mcpServer.registerTool(
5284
5430
  toolName,
@@ -5987,7 +6133,7 @@ async function executeWithRetries(operation, maxRetries) {
5987
6133
  operation.resolved.queueKey,
5988
6134
  rateLimitCtx
5989
6135
  );
5990
- if (operation.resolved.name === "petbooqz_api" && isInsidePetbooqzCalendarBookingMutex()) {
6136
+ if (shouldSkipNestedAcquire(operation.resolved.name)) {
5991
6137
  return operation.fn();
5992
6138
  }
5993
6139
  if (preAcquired) {
@@ -6091,86 +6237,86 @@ async function queuedFetchResponse(queueInput, url, init) {
6091
6237
  }
6092
6238
 
6093
6239
  // 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())
6240
+ import { z as z12 } from "zod/v4";
6241
+ var CRMDataSchema = z12.object({
6242
+ model: z12.string(),
6243
+ instanceId: z12.string(),
6244
+ data: z12.record(z12.string(), z12.unknown())
6099
6245
  });
6100
- var SenderContextSchema2 = z11.object({
6246
+ var SenderContextSchema2 = z12.object({
6101
6247
  kind: ParticipantKindSchema,
6102
- displayName: z11.string().optional(),
6248
+ displayName: z12.string().optional(),
6103
6249
  crm: CRMDataSchema.optional()
6104
6250
  });
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()
6251
+ var ThreadContextItemSchema2 = z12.object({
6252
+ handle: z12.string(),
6253
+ model: z12.string(),
6254
+ instanceId: z12.string(),
6255
+ data: z12.record(z12.string(), z12.unknown()).optional()
6110
6256
  });
6111
- var ParticipantContextSchema = z11.object({
6112
- id: z11.string(),
6257
+ var ParticipantContextSchema = z12.object({
6258
+ id: z12.string(),
6113
6259
  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()
6260
+ displayName: z12.string().optional(),
6261
+ contactId: z12.string().optional(),
6262
+ memberId: z12.string().optional(),
6263
+ agentId: z12.string().optional(),
6264
+ workflowId: z12.string().optional()
6119
6265
  });
6120
- var TriggerContextSchema = z11.object({
6266
+ var TriggerContextSchema = z12.object({
6121
6267
  // The event that triggered this
6122
- event: z11.object({
6268
+ event: z12.object({
6123
6269
  type: EventTypeSchema,
6124
- payload: z11.record(z11.string(), z11.unknown()),
6270
+ payload: z12.record(z12.string(), z12.unknown()),
6125
6271
  participant: ParticipantContextSchema.optional()
6126
6272
  }),
6127
6273
  // Thread information
6128
- thread: z11.object({
6129
- id: z11.string(),
6130
- title: z11.string().optional(),
6131
- status: z11.string().optional(),
6274
+ thread: z12.object({
6275
+ id: z12.string(),
6276
+ title: z12.string().optional(),
6277
+ status: z12.string().optional(),
6132
6278
  sender: SenderContextSchema2.optional(),
6133
- context: z11.record(z11.string(), CRMDataSchema).optional(),
6134
- participants: z11.array(ParticipantContextSchema).optional()
6279
+ context: z12.record(z12.string(), CRMDataSchema).optional(),
6280
+ participants: z12.array(ParticipantContextSchema).optional()
6135
6281
  }),
6136
6282
  // Workplace info
6137
- workplace: z11.object({
6138
- id: z11.string(),
6139
- name: z11.string().optional(),
6140
- settings: z11.record(z11.string(), z11.unknown()).optional()
6283
+ workplace: z12.object({
6284
+ id: z12.string(),
6285
+ name: z12.string().optional(),
6286
+ settings: z12.record(z12.string(), z12.unknown()).optional()
6141
6287
  })
6142
6288
  });
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(),
6289
+ var InputMappingSchema = z12.record(z12.string(), z12.string());
6290
+ var EventConditionsSchema = z12.record(z12.string(), z12.string());
6291
+ var TriggerConfigSchema = z12.object({
6292
+ id: z12.string(),
6293
+ workflowId: z12.string(),
6294
+ workflowVersionId: z12.string().optional(),
6295
+ workplaceId: z12.string(),
6296
+ handle: z12.string(),
6151
6297
  // Input mappings: how to resolve workflow inputs from thread context
6152
6298
  inputMappings: InputMappingSchema.optional(),
6153
6299
  // Event conditions: additional workplace-specific conditions
6154
6300
  eventConditions: EventConditionsSchema.optional(),
6155
6301
  // Workplace-specific config overrides
6156
- config: z11.record(z11.string(), z11.unknown()).optional(),
6302
+ config: z12.record(z12.string(), z12.unknown()).optional(),
6157
6303
  // Trigger type and status
6158
- type: z11.string().optional(),
6159
- isEnabled: z11.boolean().optional()
6304
+ type: z12.string().optional(),
6305
+ isEnabled: z12.boolean().optional()
6160
6306
  });
6161
- var ResolvedTriggerSchema = z11.object({
6307
+ var ResolvedTriggerSchema = z12.object({
6162
6308
  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()
6309
+ workflow: z12.object({
6310
+ id: z12.string(),
6311
+ handle: z12.string(),
6312
+ name: z12.string().optional(),
6313
+ inputs: z12.record(z12.string(), z12.unknown()).optional(),
6314
+ events: z12.object({
6315
+ subscribes: z12.array(EventTypeSchema).optional(),
6316
+ condition: z12.string().optional()
6171
6317
  }).optional()
6172
6318
  }),
6173
- inputs: z11.record(z11.string(), z11.unknown()),
6319
+ inputs: z12.record(z12.string(), z12.unknown()),
6174
6320
  context: TriggerContextSchema
6175
6321
  });
6176
6322
  var TriggerResolutionError = class extends Error {
@@ -6181,13 +6327,13 @@ var TriggerResolutionError = class extends Error {
6181
6327
  this.name = "TriggerResolutionError";
6182
6328
  }
6183
6329
  };
6184
- var WorkflowInputDefinitionSchema = z11.object({
6185
- type: z11.string(),
6186
- required: z11.boolean().optional(),
6187
- description: z11.string().optional(),
6188
- default: z11.unknown().optional()
6330
+ var WorkflowInputDefinitionSchema = z12.object({
6331
+ type: z12.string(),
6332
+ required: z12.boolean().optional(),
6333
+ description: z12.string().optional(),
6334
+ default: z12.unknown().optional()
6189
6335
  });
6190
- var WorkflowInputSchemaSchema = z11.record(z11.string(), WorkflowInputDefinitionSchema);
6336
+ var WorkflowInputSchemaSchema = z12.record(z12.string(), WorkflowInputDefinitionSchema);
6191
6337
 
6192
6338
  // src/triggers/resolver.ts
6193
6339
  function evaluateTemplate(template, context) {
@@ -6269,67 +6415,67 @@ function matchesTrigger(trigger, eventType, context) {
6269
6415
  }
6270
6416
 
6271
6417
  // src/workflows/types.ts
6272
- import { z as z12 } from "zod/v4";
6418
+ import { z as z13 } from "zod/v4";
6273
6419
  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({
6420
+ var WorkflowInputSchema = z13.object({
6421
+ type: z13.string(),
6422
+ required: z13.boolean().optional().default(false),
6423
+ description: z13.string().optional(),
6424
+ default: z13.unknown().optional()
6425
+ });
6426
+ var WorkflowStepInputSchema = z13.union([z13.string(), z13.number(), z13.boolean(), z13.record(z13.string(), z13.unknown())]);
6427
+ var WorkflowStepSchema = z13.object({
6282
6428
  // Service and command
6283
- service: z12.string(),
6284
- cmd: z12.string(),
6429
+ service: z13.string(),
6430
+ cmd: z13.string(),
6285
6431
  // Dependencies
6286
- needs: z12.array(z12.string()).optional(),
6432
+ needs: z13.array(z13.string()).optional(),
6287
6433
  // Inputs (Liquid templates supported)
6288
- inputs: z12.record(z12.string(), WorkflowStepInputSchema).optional(),
6434
+ inputs: z13.record(z13.string(), WorkflowStepInputSchema).optional(),
6289
6435
  // Conditional execution
6290
- condition: z12.string().optional(),
6436
+ condition: z13.string().optional(),
6291
6437
  // Retry configuration
6292
- retry: z12.object({
6293
- attempts: z12.number().optional(),
6294
- backoff: z12.enum(["linear", "exponential"]).optional()
6438
+ retry: z13.object({
6439
+ attempts: z13.number().optional(),
6440
+ backoff: z13.enum(["linear", "exponential"]).optional()
6295
6441
  }).optional(),
6296
6442
  // 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()
6443
+ timeout: z13.string().optional()
6444
+ });
6445
+ var WorkflowRuntimeSchema = z13.object({
6446
+ durable: z13.boolean().optional().default(true),
6447
+ timeout: z13.string().optional(),
6448
+ retry: z13.object({
6449
+ attempts: z13.number().optional(),
6450
+ backoff: z13.enum(["linear", "exponential"]).optional()
6305
6451
  }).optional()
6306
6452
  });
6307
- var WorkflowYAMLSchema = z12.object({
6453
+ var WorkflowYAMLSchema = z13.object({
6308
6454
  // Schema version
6309
- $schema: z12.string().optional(),
6455
+ $schema: z13.string().optional(),
6310
6456
  // Identity
6311
- handle: z12.string(),
6312
- name: z12.string(),
6313
- version: z12.string().optional(),
6314
- description: z12.string().optional(),
6457
+ handle: z13.string(),
6458
+ name: z13.string(),
6459
+ version: z13.string().optional(),
6460
+ description: z13.string().optional(),
6315
6461
  // Inputs this workflow needs (portable, declared in YAML)
6316
- inputs: z12.record(z12.string(), WorkflowInputSchema).optional(),
6462
+ inputs: z13.record(z13.string(), WorkflowInputSchema).optional(),
6317
6463
  // Event subscriptions and conditions
6318
6464
  events: EventsConfigSchema.optional(),
6319
6465
  // Deterministic steps
6320
- steps: z12.record(z12.string(), WorkflowStepSchema),
6466
+ steps: z13.record(z13.string(), WorkflowStepSchema),
6321
6467
  // Runtime configuration
6322
6468
  runtime: WorkflowRuntimeSchema.optional()
6323
6469
  });
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(),
6470
+ var WorkflowMetadataSchema = z13.object({
6471
+ handle: z13.string(),
6472
+ name: z13.string(),
6473
+ version: z13.string().optional(),
6474
+ description: z13.string().optional(),
6475
+ inputs: z13.record(z13.string(), WorkflowInputDefinitionSchema).optional(),
6330
6476
  events: EventsConfigSchema.optional()
6331
6477
  });
6332
- var WorkflowExecutionStatusSchema = z12.enum([
6478
+ var WorkflowExecutionStatusSchema = z13.enum([
6333
6479
  "PENDING",
6334
6480
  "RUNNING",
6335
6481
  "COMPLETED",
@@ -6337,14 +6483,14 @@ var WorkflowExecutionStatusSchema = z12.enum([
6337
6483
  "CANCELLED",
6338
6484
  "WAITING"
6339
6485
  ]);
6340
- var WorkflowExecutionResultSchema = z12.object({
6486
+ var WorkflowExecutionResultSchema = z13.object({
6341
6487
  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()
6488
+ outputs: z13.record(z13.string(), z13.unknown()).optional(),
6489
+ error: z13.string().optional(),
6490
+ startedAt: z13.string().datetime().optional(),
6491
+ completedAt: z13.string().datetime().optional(),
6492
+ cancelledAt: z13.string().datetime().optional(),
6493
+ cancelReason: z13.string().optional()
6348
6494
  });
6349
6495
  function defineWorkflowYAML(workflow) {
6350
6496
  return WorkflowYAMLSchema.parse(workflow);
@@ -6422,8 +6568,8 @@ function getAssociationByModel(context, model) {
6422
6568
  }
6423
6569
 
6424
6570
  // src/memory/types.ts
6425
- import { z as z13 } from "zod/v4";
6426
- var MemoryEntryTypeSchema = z13.enum([
6571
+ import { z as z14 } from "zod/v4";
6572
+ var MemoryEntryTypeSchema = z14.enum([
6427
6573
  "WORKING",
6428
6574
  // Current conversation context
6429
6575
  "OBSERVATION",
@@ -6433,80 +6579,80 @@ var MemoryEntryTypeSchema = z13.enum([
6433
6579
  "SEMANTIC"
6434
6580
  // Semantic memory for retrieval
6435
6581
  ]);
6436
- var MemoryEntrySchema = z13.object({
6437
- id: z13.string(),
6582
+ var MemoryEntrySchema = z14.object({
6583
+ id: z14.string(),
6438
6584
  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({
6585
+ key: z14.string(),
6586
+ value: z14.unknown(),
6587
+ metadata: z14.record(z14.string(), z14.unknown()).optional(),
6588
+ expiresAt: z14.string().datetime().optional(),
6589
+ createdAt: z14.string().datetime(),
6590
+ updatedAt: z14.string().datetime()
6591
+ });
6592
+ var WorkingMemoryConfigSchema2 = z14.object({
6593
+ strategy: z14.enum(["full", "rolling_summary", "sliding_window"]).default("rolling_summary"),
6594
+ maxTokens: z14.number().default(8e3),
6595
+ summarizeAt: z14.number().optional(),
6596
+ ttl: z14.string().optional()
6597
+ });
6598
+ var SemanticMemoryConfigSchema2 = z14.object({
6599
+ enabled: z14.boolean().default(false),
6600
+ topK: z14.number().default(5),
6601
+ scope: z14.enum(["thread", "instance", "workspace"]).default("thread"),
6602
+ minScore: z14.number().default(0.7)
6603
+ });
6604
+ var ExternalMemoryConfigSchema2 = z14.object({
6605
+ namespace: z14.string(),
6606
+ ttl: z14.string().optional()
6607
+ });
6608
+ var MemoryConfigSchema = z14.object({
6463
6609
  working: WorkingMemoryConfigSchema2.optional(),
6464
6610
  semantic: SemanticMemoryConfigSchema2.optional(),
6465
6611
  external: ExternalMemoryConfigSchema2.optional(),
6466
- persistent: z13.object({
6467
- namespace: z13.string()
6612
+ persistent: z14.object({
6613
+ namespace: z14.string()
6468
6614
  }).optional()
6469
6615
  });
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()
6616
+ var MemoryScopeSchema = z14.object({
6617
+ threadId: z14.string().optional(),
6618
+ participantId: z14.string().optional(),
6619
+ agentId: z14.string().optional(),
6620
+ workplaceId: z14.string().optional(),
6621
+ namespace: z14.string().optional()
6622
+ });
6623
+ var MemoryQueryOptionsSchema = z14.object({
6624
+ types: z14.array(MemoryEntryTypeSchema).optional(),
6625
+ keys: z14.array(z14.string()).optional(),
6626
+ limit: z14.number().default(100),
6627
+ includeExpired: z14.boolean().default(false)
6628
+ });
6629
+ var ConversationSummarySchema = z14.object({
6630
+ summary: z14.string(),
6631
+ keyPoints: z14.array(z14.string()),
6632
+ entities: z14.array(z14.object({
6633
+ name: z14.string(),
6634
+ type: z14.string(),
6635
+ relevance: z14.number()
6490
6636
  })),
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()
6637
+ lastMessageId: z14.string().optional(),
6638
+ messageCount: z14.number(),
6639
+ tokenCount: z14.number(),
6640
+ createdAt: z14.string().datetime()
6641
+ });
6642
+ var AgentObservationSchema = z14.object({
6643
+ observation: z14.string(),
6644
+ confidence: z14.number().min(0).max(1),
6645
+ source: z14.enum(["inference", "explicit", "tool_result"]),
6646
+ context: z14.record(z14.string(), z14.unknown()).optional(),
6647
+ createdAt: z14.string().datetime()
6648
+ });
6649
+ var ExternalDataCacheSchema = z14.object({
6650
+ source: z14.string(),
6651
+ endpoint: z14.string().optional(),
6652
+ data: z14.unknown(),
6653
+ fetchedAt: z14.string().datetime(),
6654
+ expiresAt: z14.string().datetime().optional(),
6655
+ metadata: z14.record(z14.string(), z14.unknown()).optional()
6510
6656
  });
6511
6657
 
6512
6658
  // src/memory/service.ts
@@ -7097,16 +7243,16 @@ function estimateTokens(agent, skills) {
7097
7243
  }
7098
7244
 
7099
7245
  // 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)
7246
+ import { z as z15 } from "zod/v4";
7247
+ var TimeStampSchema = z15.union([
7248
+ z15.number().describe("Hour of day (0-23)"),
7249
+ z15.object({
7250
+ hour: z15.number(),
7251
+ minute: z15.number().optional().default(0),
7252
+ second: z15.number().optional().default(0)
7107
7253
  })
7108
7254
  ]);
7109
- var DayOfWeekSchema = z14.enum([
7255
+ var DayOfWeekSchema = z15.enum([
7110
7256
  "monday",
7111
7257
  "tuesday",
7112
7258
  "wednesday",
@@ -7115,13 +7261,13 @@ var DayOfWeekSchema = z14.enum([
7115
7261
  "saturday",
7116
7262
  "sunday"
7117
7263
  ]);
7118
- var TimeWindowSlotSchema = z14.object({
7264
+ var TimeWindowSlotSchema = z15.object({
7119
7265
  startTime: TimeStampSchema,
7120
7266
  endTime: TimeStampSchema,
7121
- days: z14.array(DayOfWeekSchema),
7122
- timezone: z14.string().optional()
7267
+ days: z15.array(DayOfWeekSchema),
7268
+ timezone: z15.string().optional()
7123
7269
  });
7124
- var WaitUnitSchema = z14.enum([
7270
+ var WaitUnitSchema = z15.enum([
7125
7271
  "second",
7126
7272
  "seconds",
7127
7273
  "minute",
@@ -7137,17 +7283,17 @@ var WaitUnitSchema = z14.enum([
7137
7283
  "year",
7138
7284
  "years"
7139
7285
  ]);
7140
- var WaitInputRelativeSchema = z14.object({
7141
- mode: z14.literal("relative"),
7142
- amount: z14.number(),
7286
+ var WaitInputRelativeSchema = z15.object({
7287
+ mode: z15.literal("relative"),
7288
+ amount: z15.number(),
7143
7289
  unit: WaitUnitSchema,
7144
- windows: z14.array(TimeWindowSlotSchema).optional()
7290
+ windows: z15.array(TimeWindowSlotSchema).optional()
7145
7291
  });
7146
- var WaitInputAbsoluteSchema = z14.object({
7147
- mode: z14.literal("absolute"),
7148
- scheduleAt: z14.union([z14.string(), z14.number()])
7292
+ var WaitInputAbsoluteSchema = z15.object({
7293
+ mode: z15.literal("absolute"),
7294
+ scheduleAt: z15.union([z15.string(), z15.number()])
7149
7295
  });
7150
- var WaitInputSchema = z14.union([
7296
+ var WaitInputSchema = z15.union([
7151
7297
  WaitInputRelativeSchema,
7152
7298
  WaitInputAbsoluteSchema
7153
7299
  ]);
@@ -7457,8 +7603,62 @@ function isTimeInPolicy(date, policy) {
7457
7603
  return false;
7458
7604
  }
7459
7605
 
7606
+ // src/tools/sms/gsm7.ts
7607
+ var GSM7_BASIC = `@\xA3$\xA5\xE8\xE9\xF9\xEC\xF2\xC7
7608
+ \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`;
7609
+ var GSM7_EXTENDED = "^{}\\[~]|\u20AC";
7610
+ var GSM7_BASIC_SET = new Set(GSM7_BASIC.split(""));
7611
+ var GSM7_EXTENDED_SET = new Set(GSM7_EXTENDED.split(""));
7612
+ function toGsm7(value) {
7613
+ if (value === null || value === void 0) {
7614
+ return "";
7615
+ }
7616
+ const str = String(value);
7617
+ let result = "";
7618
+ for (const char of str) {
7619
+ if (GSM7_BASIC_SET.has(char) || GSM7_EXTENDED_SET.has(char)) {
7620
+ result += char;
7621
+ }
7622
+ }
7623
+ return result;
7624
+ }
7625
+ function isGsm7Character(char) {
7626
+ return GSM7_BASIC_SET.has(char) || GSM7_EXTENDED_SET.has(char);
7627
+ }
7628
+ function countGsm7Septets(text) {
7629
+ let septets = 0;
7630
+ for (const char of text) {
7631
+ septets += GSM7_EXTENDED_SET.has(char) ? 2 : 1;
7632
+ }
7633
+ return septets;
7634
+ }
7635
+ function estimateSmsSegments(text) {
7636
+ const normalized = text ?? "";
7637
+ const characters = [...normalized].length;
7638
+ if (characters === 0) {
7639
+ return { encoding: "GSM-7", characters: 0, septets: 0, segments: 0 };
7640
+ }
7641
+ const isGsm7 = [...normalized].every(isGsm7Character);
7642
+ if (isGsm7) {
7643
+ const septets = countGsm7Septets(normalized);
7644
+ const segments2 = septets <= 160 ? 1 : Math.ceil(septets / 153);
7645
+ return {
7646
+ encoding: "GSM-7",
7647
+ characters,
7648
+ septets,
7649
+ segments: segments2
7650
+ };
7651
+ }
7652
+ const segments = characters <= 70 ? 1 : Math.ceil(characters / 67);
7653
+ return {
7654
+ encoding: "UCS-2",
7655
+ characters,
7656
+ segments
7657
+ };
7658
+ }
7659
+
7460
7660
  // src/index.ts
7461
- var src_default = { z: z15 };
7661
+ var src_default = { z: z16 };
7462
7662
  export {
7463
7663
  AgentContextSchema,
7464
7664
  AgentDefinitionSchema,
@@ -7514,6 +7714,7 @@ export {
7514
7714
  EnvSchemaSchema,
7515
7715
  EnvVariableDefinitionSchema,
7516
7716
  EnvVisibilitySchema,
7717
+ EstimationSchema,
7517
7718
  EventConditionsSchema,
7518
7719
  EventSubscriptionSchema,
7519
7720
  EventTypeSchema,
@@ -7555,6 +7756,9 @@ export {
7555
7756
  MemoryQueryOptionsSchema,
7556
7757
  MemoryScopeSchema,
7557
7758
  MemoryService,
7759
+ MessageBulkRecipientSchema,
7760
+ MessageBulkSendInputSchema,
7761
+ MessageBulkSendOutputSchema,
7558
7762
  MessageEventPayloadSchema,
7559
7763
  MessageSendAttachmentSchema,
7560
7764
  MessageSendChannelSchema,
@@ -7573,6 +7777,7 @@ export {
7573
7777
  ModelDependencySchema,
7574
7778
  ModelFieldDefinitionSchema,
7575
7779
  ModelMapperBlockDefinitionSchema,
7780
+ MoneyMinorRangeSchema,
7576
7781
  NavigationBreadcrumbSchema,
7577
7782
  NavigationConfigSchema,
7578
7783
  NavigationItemSchema,
@@ -7676,15 +7881,18 @@ export {
7676
7881
  communicationChannel,
7677
7882
  compileAgent,
7678
7883
  compileWorkflow,
7884
+ computeSkewedExpectedMinorUnits,
7679
7885
  configure,
7680
7886
  createAuthError,
7681
7887
  createConflictError,
7682
7888
  createContextLogger,
7683
7889
  createErrorResponse,
7890
+ createEstimation,
7684
7891
  createExternalError,
7685
7892
  createInMemoryService,
7686
7893
  createInstanceClient,
7687
7894
  createListResponse,
7895
+ createMoneyMinorRange,
7688
7896
  createNotFoundError,
7689
7897
  createPermissionError,
7690
7898
  createQueueHandle,
@@ -7710,11 +7918,14 @@ export {
7710
7918
  defineSkill,
7711
7919
  defineWorkflow,
7712
7920
  defineWorkflowYAML,
7921
+ estimateSmsSegments,
7713
7922
  evaluateCondition,
7714
7923
  evaluateTemplate,
7715
7924
  event,
7716
7925
  file,
7717
7926
  formatContextForPrompt,
7927
+ formatMoneyMinorEstimate,
7928
+ formatMoneyMinorRange,
7718
7929
  formatSkillInstructions,
7719
7930
  getAllEnvKeys,
7720
7931
  getAssociationByModel,
@@ -7740,6 +7951,7 @@ export {
7740
7951
  isWorkflowDependency,
7741
7952
  matchesTrigger,
7742
7953
  parseCRMSchema,
7954
+ parseEstimationFromBilling,
7743
7955
  queuedFetch,
7744
7956
  queuedFetchResponse,
7745
7957
  registerQueueConfig,
@@ -7753,11 +7965,12 @@ export {
7753
7965
  safeParseCRMSchema,
7754
7966
  safeParseConfig,
7755
7967
  server,
7968
+ toGsm7,
7756
7969
  token,
7757
7970
  validateCRMSchema,
7758
7971
  validateSkillYAML,
7759
7972
  validateWorkflowYAML,
7760
7973
  webhook,
7761
7974
  workplace,
7762
- z15 as z
7975
+ z16 as z
7763
7976
  };