skedyul 1.2.44 → 1.2.50

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.
Files changed (59) hide show
  1. package/dist/cli/commands/event.d.ts +1 -0
  2. package/dist/cli/commands/workflows.d.ts +1 -0
  3. package/dist/cli/index.js +3928 -9110
  4. package/dist/cli/utils/auth.d.ts +4 -1
  5. package/dist/cli/utils/auth.js +32 -8
  6. package/dist/cli/utils/config.d.ts +23 -0
  7. package/dist/cli/utils/env-sync.d.ts +46 -0
  8. package/dist/cli/utils/mcp-http-client.d.ts +74 -0
  9. package/dist/cli/utils/migration-approval.d.ts +39 -0
  10. package/dist/cli/utils/mock-context.d.ts +19 -9
  11. package/dist/cli/utils/sse.d.ts +33 -0
  12. package/dist/cli/utils.d.ts +5 -1
  13. package/dist/compiler/types.d.ts +11 -9
  14. package/dist/config/app-config.d.ts +3 -1
  15. package/dist/config/schema-loader.d.ts +15 -2
  16. package/dist/config/types/index.d.ts +1 -0
  17. package/dist/config/types/model.d.ts +2 -0
  18. package/dist/config/types/page.d.ts +9 -0
  19. package/dist/config/types/signal.d.ts +20 -0
  20. package/dist/context/index.d.ts +2 -2
  21. package/dist/context/resolver.d.ts +29 -28
  22. package/dist/context/types.d.ts +195 -37
  23. package/dist/core/client.d.ts +211 -233
  24. package/dist/dedicated/server.js +252 -163
  25. package/dist/dockerfile.d.ts +1 -1
  26. package/dist/esm/index.mjs +1207 -7684
  27. package/dist/index.d.ts +11 -6
  28. package/dist/index.js +1253 -7682
  29. package/dist/scheduling/calculateWaitTime.d.ts +16 -0
  30. package/dist/scheduling/index.d.ts +11 -0
  31. package/dist/scheduling/index.js +334 -0
  32. package/dist/scheduling/index.mjs +305 -0
  33. package/dist/scheduling/isTimeInWindow.d.ts +15 -0
  34. package/dist/scheduling/types-workflow.d.ts +54 -0
  35. package/dist/scheduling/types.d.ts +166 -0
  36. package/dist/schemas/agent-schema-v3.d.ts +416 -60
  37. package/dist/schemas/agent-schema-v3.js +262 -74
  38. package/dist/schemas/agent-schema-v3.mjs +248 -72
  39. package/dist/schemas/agent-schema.js +3 -7295
  40. package/dist/schemas/agent-schema.mjs +3 -7323
  41. package/dist/schemas/crm-schema.d.ts +53 -19
  42. package/dist/schemas/index.d.ts +1 -1
  43. package/dist/schemas.d.ts +128 -40
  44. package/dist/server/route-handlers/handlers.d.ts +7 -0
  45. package/dist/server/utils/env.d.ts +9 -0
  46. package/dist/server/utils/index.d.ts +1 -0
  47. package/dist/server/utils/mcp-response.d.ts +11 -0
  48. package/dist/server.js +252 -163
  49. package/dist/serverless/server.mjs +252 -163
  50. package/dist/skills/index.d.ts +1 -1
  51. package/dist/skills/types.d.ts +35 -23
  52. package/dist/skills/types.js +10 -17
  53. package/dist/skills/types.mjs +9 -16
  54. package/dist/types/index.d.ts +3 -3
  55. package/dist/types/server.d.ts +1 -0
  56. package/dist/types/tool-context.d.ts +31 -4
  57. package/dist/types/tool-response.d.ts +2 -0
  58. package/dist/types/tool.d.ts +33 -1
  59. package/package.json +9 -2
@@ -170,14 +170,12 @@ var SkillExampleSchema = z2.object({
170
170
  output: z2.string(),
171
171
  tool_call: z2.string().optional()
172
172
  });
173
- var SkillEvaluationMetricSchema = z2.object({
174
- metric: z2.string(),
175
- description: z2.string().optional(),
176
- threshold: z2.number().optional()
173
+ var CRMModelFieldRequirementsSchema = z2.object({
174
+ required: z2.array(z2.string()).optional(),
175
+ recommended: z2.array(z2.string()).optional()
177
176
  });
178
177
  var CRMContextSchema = z2.object({
179
- models: z2.record(z2.string(), z2.array(z2.string()))
180
- // { modelHandle: [fieldHandles] }
178
+ models: z2.record(z2.string(), CRMModelFieldRequirementsSchema)
181
179
  });
182
180
  var SkillYAMLSchema = z2.object({
183
181
  // Schema version
@@ -194,11 +192,7 @@ var SkillYAMLSchema = z2.object({
194
192
  // CRM context - specifies which models/fields to include in schema
195
193
  crmContext: CRMContextSchema.optional(),
196
194
  // Few-shot examples
197
- examples: z2.array(SkillExampleSchema).optional(),
198
- // Evaluation criteria
199
- evaluation: z2.array(SkillEvaluationMetricSchema).optional(),
200
- // Tags for discovery
201
- tags: z2.array(z2.string()).optional()
195
+ examples: z2.array(SkillExampleSchema).optional()
202
196
  });
203
197
  var SkillYAMLV2Schema = z2.object({
204
198
  $schema: z2.literal(SKILL_SCHEMA_VERSION_V2).optional(),
@@ -209,9 +203,7 @@ var SkillYAMLV2Schema = z2.object({
209
203
  instructions: z2.string(),
210
204
  tools: z2.array(SkillToolDefinitionSchema).optional(),
211
205
  crmContext: CRMContextSchema.optional(),
212
- examples: z2.array(SkillExampleSchema).optional(),
213
- evaluation: z2.array(SkillEvaluationMetricSchema).optional(),
214
- tags: z2.array(z2.string()).optional()
206
+ examples: z2.array(SkillExampleSchema).optional()
215
207
  });
216
208
  var SkillVersionWeightSchema = z2.object({
217
209
  version: z2.number(),
@@ -224,6 +216,8 @@ var SkillRefSchema = z2.union([
224
216
  skill: z2.string(),
225
217
  description: z2.string().optional(),
226
218
  // For AI SDK Agent Skills discovery
219
+ /** Auto-inject this skill's instructions and tools on every agent turn */
220
+ alwaysLoad: z2.boolean().optional(),
227
221
  // Version selection (pick one):
228
222
  version: z2.number().optional(),
229
223
  // Pin to specific version number
@@ -245,7 +239,6 @@ var SkillMetadataSchema = z2.object({
245
239
  s3Key: z2.string().optional(),
246
240
  appVersionId: z2.string().optional(),
247
241
  workplaceId: z2.string().optional(),
248
- tags: z2.array(z2.string()).optional(),
249
242
  createdAt: z2.string().datetime().optional(),
250
243
  updatedAt: z2.string().datetime().optional()
251
244
  });
@@ -293,52 +286,61 @@ var ThreadInfoSchema = z3.object({
293
286
  status: z3.string().optional(),
294
287
  kind: z3.string().optional()
295
288
  });
296
- var AgentContextSchema = z3.object({
297
- // Who sent the message
298
- sender: SenderContextSchema,
299
- // Thread contexts (linked CRM instances)
300
- contexts: z3.array(ThreadContextItemSchema).optional(),
301
- // Thread info
302
- thread: ThreadInfoSchema,
303
- // Workplace info
304
- workplace: z3.object({
305
- id: z3.string(),
306
- name: z3.string().optional()
307
- }).optional()
308
- });
309
- var MockSubscriptionSchema = z3.object({
289
+ var SubscriptionSchema = z3.object({
310
290
  identifierValue: z3.string(),
311
291
  channelHandle: z3.string().optional()
312
292
  });
313
- var MockAssociationSchema = z3.object({
293
+ var AssociationSchema = z3.object({
314
294
  id: z3.string().optional(),
315
295
  data: z3.record(z3.string(), z3.unknown())
316
296
  });
317
- var MockContactSchema = z3.object({
297
+ var ContactSchema = z3.object({
318
298
  id: z3.string().optional(),
319
299
  name: z3.string().optional(),
320
- subscription: MockSubscriptionSchema.optional(),
321
- associations: z3.record(z3.string(), MockAssociationSchema).optional()
300
+ subscription: SubscriptionSchema.optional(),
301
+ associations: z3.record(z3.string(), AssociationSchema).optional()
322
302
  });
323
- var MockSenderContextSchema = z3.object({
303
+ var AgentSenderContextSchema = z3.object({
324
304
  kind: z3.enum(["contact", "member"]),
325
305
  displayName: z3.string().optional(),
326
306
  role: z3.string().optional(),
327
307
  permissions: z3.array(z3.string()).optional(),
328
- contact: MockContactSchema.optional()
308
+ contact: ContactSchema.optional()
329
309
  });
330
- var MockThreadContextSchema = z3.object({
310
+ var AgentThreadContextSchema = z3.object({
331
311
  handle: z3.string(),
332
312
  model: z3.string(),
333
313
  data: z3.record(z3.string(), z3.unknown())
334
314
  });
335
- var MockContextSchema = z3.object({
336
- sender: MockSenderContextSchema,
337
- contexts: z3.array(MockThreadContextSchema).optional()
315
+ var AgentContextSchema = z3.object({
316
+ sender: AgentSenderContextSchema,
317
+ contexts: z3.array(AgentThreadContextSchema).optional()
318
+ });
319
+ var ContextIssueSeveritySchema = z3.enum(["ERROR", "WARNING"]);
320
+ var ContextIssueTypeSchema = z3.enum([
321
+ "MISSING_ROUTING_PARTICIPANT",
322
+ "MISSING_ASSOCIATION",
323
+ "MISSING_REQUIRED_FIELD",
324
+ "MISSING_RECOMMENDED_FIELD"
325
+ ]);
326
+ var ContextIssueSchema = z3.object({
327
+ type: ContextIssueTypeSchema,
328
+ severity: ContextIssueSeveritySchema,
329
+ model: z3.string().optional(),
330
+ field: z3.string().optional(),
331
+ message: z3.string(),
332
+ suggestion: z3.string().optional()
333
+ });
334
+ var ContextValidationResultSchema = z3.object({
335
+ valid: z3.boolean(),
336
+ degraded: z3.boolean(),
337
+ issues: z3.array(ContextIssueSchema)
338
338
  });
339
339
  var SandboxConfigSchema = z3.object({
340
340
  enabled: z3.boolean().optional(),
341
- mockContext: MockContextSchema.optional()
341
+ /** @deprecated Use 'context' instead of 'mockContext' */
342
+ mockContext: AgentContextSchema.optional(),
343
+ context: AgentContextSchema.optional()
342
344
  });
343
345
 
344
346
  // src/schemas/agent-schema-v3.ts
@@ -376,13 +378,14 @@ var ToolRefV3Schema = z4.union([
376
378
  overrides: z4.record(z4.string(), z4.unknown()).optional()
377
379
  })
378
380
  ]);
379
- var BootstrapToolRefSchema = z4.union([
381
+ var AgentToolRefSchema = z4.union([
380
382
  z4.string(),
381
383
  z4.object({
382
384
  tool: z4.string(),
383
385
  description: z4.string().optional()
384
386
  })
385
387
  ]);
388
+ var BootstrapToolRefSchema = AgentToolRefSchema;
386
389
  var WorkingMemoryConfigSchema = z4.object({
387
390
  strategy: z4.enum(["full", "rolling_summary", "sliding_window"]).optional(),
388
391
  maxTokens: z4.number().optional(),
@@ -405,29 +408,182 @@ var MemoryConfigV3Schema = z4.object({
405
408
  external: ExternalMemoryConfigSchema.optional(),
406
409
  semantic: SemanticMemoryConfigSchema.optional()
407
410
  });
408
- var ResponsePolicySchema = z4.object({
409
- requiresApproval: z4.boolean().optional(),
410
- requiresApprovalIf: z4.array(z4.string()).optional()
411
+ var RequiresApprovalPolicySchema = z4.object({
412
+ requiresApproval: z4.boolean().optional()
411
413
  });
412
414
  var PoliciesConfigV3Schema = z4.object({
413
- response: ResponsePolicySchema.optional(),
414
- rules: z4.array(z4.string()).optional()
415
+ messages: z4.object({
416
+ send: RequiresApprovalPolicySchema.optional(),
417
+ schedule: RequiresApprovalPolicySchema.optional()
418
+ }).optional(),
419
+ tools: z4.object({
420
+ externalRequiresApproval: z4.boolean().optional(),
421
+ systemRequiresApproval: z4.boolean().optional()
422
+ }).optional()
415
423
  });
416
424
  var RuntimeConfigV3Schema = z4.object({
425
+ /** LLM model identifier for reasoning (e.g., "google/gemini-3.1-flash-lite") */
417
426
  model: z4.string().optional(),
418
- timeout: z4.string().optional(),
419
- timezone: z4.string().optional(),
420
- retry: z4.object({
421
- attempts: z4.number().optional(),
422
- backoff: z4.enum(["linear", "exponential"]).optional()
427
+ /** LLM model for persona transformation (e.g., "openai/gpt-5-nano") */
428
+ personaModel: z4.string().optional()
429
+ });
430
+ var TimeWindowTimeStampSchema = z4.union([
431
+ z4.number().describe("Hour of day (0-23)"),
432
+ z4.object({
433
+ hour: z4.number(),
434
+ minute: z4.number().optional().default(0)
435
+ })
436
+ ]);
437
+ var TimeWindowDayOfWeekSchema = z4.enum([
438
+ "monday",
439
+ "tuesday",
440
+ "wednesday",
441
+ "thursday",
442
+ "friday",
443
+ "saturday",
444
+ "sunday"
445
+ ]);
446
+ var TimeWindowSlotAgentSchema = z4.object({
447
+ startTime: TimeWindowTimeStampSchema,
448
+ endTime: TimeWindowTimeStampSchema,
449
+ days: z4.array(TimeWindowDayOfWeekSchema)
450
+ });
451
+ var ResponseModeSchema = z4.enum([
452
+ "immediate",
453
+ "ack_and_schedule",
454
+ "schedule_only"
455
+ ]);
456
+ var TimeWindowBehaviorSchema = z4.object({
457
+ /** How to handle responses in this window */
458
+ responseMode: ResponseModeSchema,
459
+ /** Prompt injection for this time context */
460
+ prompt: z4.string().optional().describe("Prompt injection for this time context"),
461
+ /** Window to schedule responses for (when responseMode is ack_and_schedule or schedule_only) */
462
+ scheduleFor: z4.string().optional().describe("Window name to schedule responses for")
463
+ });
464
+ var TimeWindowPolicySchema = z4.object({
465
+ /** IANA timezone for the window (e.g., "Australia/Sydney") */
466
+ timezone: z4.string().describe('IANA timezone, e.g., "Australia/Sydney"'),
467
+ /** Time slots when this window is active */
468
+ windows: z4.array(TimeWindowSlotAgentSchema),
469
+ /** Behavior for this window (optional - defaults to immediate response) */
470
+ behavior: TimeWindowBehaviorSchema.optional()
471
+ });
472
+ var TimeWindowPoliciesSchema = z4.record(z4.string(), TimeWindowPolicySchema);
473
+ var TimeWindowDefaultSchema = TimeWindowBehaviorSchema.describe(
474
+ "Fallback behavior when no time window matches"
475
+ );
476
+ var ResponsesBehaviorConfigSchema = z4.object({
477
+ /**
478
+ * Maximum immediate messages per agent run (acks, progress updates).
479
+ * @default 1
480
+ */
481
+ maxImmediate: z4.number().optional(),
482
+ /**
483
+ * Maximum scheduled messages per agent run (follow-ups via sendAt).
484
+ * @default 2
485
+ */
486
+ maxScheduled: z4.number().optional(),
487
+ /**
488
+ * Maximum intermediate messages per agent run.
489
+ * Intermediate = progress updates, acknowledgments before task completion.
490
+ * The final message slot is always reserved separately.
491
+ * @deprecated Use maxImmediate instead
492
+ * @default 2
493
+ */
494
+ maxIntermediate: z4.number().optional(),
495
+ /**
496
+ * Whether a final message is required before the run completes.
497
+ * If true and no final message is sent, the run fails.
498
+ * @default true
499
+ */
500
+ requireFinal: z4.boolean().optional(),
501
+ /**
502
+ * Whether the agent can schedule messages for future delivery.
503
+ * Scheduled messages typically require approval.
504
+ * @default false
505
+ */
506
+ allowSchedule: z4.boolean().optional(),
507
+ /**
508
+ * Message splitting configuration.
509
+ * Controls whether and how the agent splits responses into multiple messages.
510
+ */
511
+ messageSplitting: z4.object({
512
+ /**
513
+ * Whether to allow natural message splitting.
514
+ * When true, the agent may split responses into multiple messages
515
+ * when it improves conversational flow.
516
+ */
517
+ enabled: z4.boolean(),
518
+ /**
519
+ * Custom prompt to override the default message splitting guidance.
520
+ * If not provided, uses sensible defaults for when to split vs. keep together.
521
+ */
522
+ prompt: z4.string().optional()
423
523
  }).optional()
424
524
  });
525
+ var SchedulingDelaySchema = z4.object({
526
+ /** Time unit amount */
527
+ amount: z4.number(),
528
+ /** Time unit (e.g., "week", "weeks", "day", "days", "month", "months") */
529
+ unit: z4.string(),
530
+ /** Optional time window to constrain the delay */
531
+ timeWindow: z4.string().optional()
532
+ });
533
+ var SchedulingPatternSchema = z4.object({
534
+ /** Trigger name for this pattern */
535
+ trigger: z4.string(),
536
+ /** Human-readable description of when this pattern applies */
537
+ description: z4.string().optional(),
538
+ /** Example user phrases that match this pattern */
539
+ examples: z4.array(z4.string()).optional(),
540
+ /** Default delay for this pattern */
541
+ defaultDelay: SchedulingDelaySchema.optional()
542
+ });
543
+ var SchedulingBehaviorConfigSchema = z4.object({
544
+ /**
545
+ * Patterns that trigger scheduling suggestions.
546
+ * The agent uses these to know when to add sendAt to messages.
547
+ */
548
+ patterns: z4.array(SchedulingPatternSchema).optional(),
549
+ /**
550
+ * Default settings for scheduled messages.
551
+ */
552
+ defaults: z4.object({
553
+ /** Cancel scheduled message if user replies before send time (default: true) */
554
+ cancelOnActivity: z4.boolean().optional(),
555
+ /** Whether scheduled messages require approval (default: true) */
556
+ requiresApproval: z4.boolean().optional(),
557
+ /** Default time window policy to constrain all scheduled messages */
558
+ timeWindow: z4.string().optional().describe("Time window policy name for scheduled messages")
559
+ }).optional()
560
+ });
561
+ var BehaviorConfigV3Schema = z4.object({
562
+ /**
563
+ * Response behavior - controls message sending via tool calls.
564
+ * When configured, agents must explicitly call system:message:send
565
+ * instead of producing implicit final output.
566
+ */
567
+ responses: ResponsesBehaviorConfigSchema.optional(),
568
+ /**
569
+ * Scheduling behavior - controls when the agent schedules follow-up messages.
570
+ * Patterns define triggers like "user indicates they'll return later".
571
+ */
572
+ scheduling: SchedulingBehaviorConfigSchema.optional()
573
+ });
425
574
  var PromptsConfigV3Schema = z4.object({
575
+ /** Main system prompt with workflow instructions */
576
+ system: z4.string().optional(),
577
+ /** Injected during second pass when skills were loaded but tools not used */
426
578
  recovery: z4.string().optional(),
579
+ /** Injected during follow-up passes when context needs updating */
427
580
  followUp: z4.string().optional(),
428
- skillDiscoveryWorkflow: z4.string().optional()
581
+ /** Thread list title generation (system + user template with {{var}} placeholders) */
582
+ titleEnrichment: z4.object({
583
+ system: z4.string().optional(),
584
+ user: z4.string().optional()
585
+ }).optional()
429
586
  });
430
- var AgentConfigV3Schema = z4.record(z4.string(), z4.unknown());
431
587
  var AgentYAMLV3Schema = z4.object({
432
588
  $schema: z4.string().optional(),
433
589
  handle: z4.string(),
@@ -438,28 +594,36 @@ var AgentYAMLV3Schema = z4.object({
438
594
  persona: PersonaV3Schema.optional(),
439
595
  // Skills - What the agent knows how to do (skills own their tools)
440
596
  skills: z4.array(SkillRefSchema).optional(),
441
- // Bootstrap tools - Always-available system tools before any skill loads
442
- // Examples: system:skill:load, system:message:send
443
- bootstrapTools: z4.array(BootstrapToolRefSchema).optional(),
444
- // Tools - DEPRECATED: Use skills to own tools instead
445
- // Kept for backward compatibility during migration
446
- // @deprecated Will be removed in a future version
447
- tools: z4.array(ToolRefV3Schema).optional(),
448
- // Events - When the agent activates
597
+ // Tools - Always-available tools before any skill loads
598
+ // Examples: system:settings:business_information:get
599
+ tools: z4.array(AgentToolRefSchema).optional(),
600
+ /**
601
+ * Events - When the agent activates
602
+ * @deprecated Not yet implemented - this is a planned feature for event-driven agents.
603
+ * Fields are accepted but not used at runtime.
604
+ */
449
605
  events: EventsConfigSchema.optional(),
450
- // Memory - How the agent remembers
606
+ /**
607
+ * Memory - How the agent remembers
608
+ * @deprecated Not yet implemented - this is a planned feature.
609
+ * Fields are accepted but not used at runtime.
610
+ */
451
611
  memory: MemoryConfigV3Schema.optional(),
452
- // Policies - Constraints and approvals
612
+ // Policies - Business rules for the agent
453
613
  policies: PoliciesConfigV3Schema.optional(),
454
- // Runtime - Execution configuration
614
+ // Runtime - Execution configuration (model + personaModel)
455
615
  runtime: RuntimeConfigV3Schema.optional(),
456
- // Prompts - Agent-specific prompt injections for runtime phases
457
- // recovery: Injected during second pass when skills were loaded but tools not used
458
- // followUp: Injected during follow-up passes when context needs updating
459
- // skillDiscoveryWorkflow: Custom workflow instructions for skill discovery
616
+ // Prompts - Agent-specific prompt injections
460
617
  prompts: PromptsConfigV3Schema.optional(),
461
- // Config - Business-specific settings
462
- config: AgentConfigV3Schema.optional(),
618
+ // Behavior - Agent runtime behavior configuration
619
+ // responses: Controls message sending via explicit tool calls
620
+ behavior: BehaviorConfigV3Schema.optional(),
621
+ // Time Windows - Named time window policies for scheduling constraints
622
+ // Windows must be mutually exclusive (non-overlapping)
623
+ // Each window can define its own behavior (response mode, prompt, etc.)
624
+ timeWindows: TimeWindowPoliciesSchema.optional(),
625
+ // Time Window Default - Fallback behavior when no window matches
626
+ timeWindowDefault: TimeWindowDefaultSchema.optional(),
463
627
  // Sandbox - Testing configuration
464
628
  sandbox: SandboxConfigSchema.optional()
465
629
  });
@@ -475,8 +639,9 @@ function validateAgentYAMLV3(agent) {
475
639
  }
476
640
  export {
477
641
  AGENT_SCHEMA_VERSION_V3,
478
- AgentConfigV3Schema,
642
+ AgentToolRefSchema,
479
643
  AgentYAMLV3Schema,
644
+ BehaviorConfigV3Schema,
480
645
  BootstrapToolRefSchema,
481
646
  ExternalMemoryConfigSchema,
482
647
  MemoryConfigV3Schema,
@@ -485,9 +650,20 @@ export {
485
650
  PersonaVoiceV3Schema,
486
651
  PoliciesConfigV3Schema,
487
652
  PromptsConfigV3Schema,
488
- ResponsePolicySchema,
653
+ ResponseModeSchema,
654
+ ResponsesBehaviorConfigSchema,
489
655
  RuntimeConfigV3Schema,
656
+ SchedulingBehaviorConfigSchema,
657
+ SchedulingDelaySchema,
658
+ SchedulingPatternSchema,
490
659
  SemanticMemoryConfigSchema,
660
+ TimeWindowBehaviorSchema,
661
+ TimeWindowDayOfWeekSchema,
662
+ TimeWindowDefaultSchema,
663
+ TimeWindowPoliciesSchema,
664
+ TimeWindowPolicySchema,
665
+ TimeWindowSlotAgentSchema,
666
+ TimeWindowTimeStampSchema,
491
667
  ToolApprovalConfigSchema,
492
668
  ToolRefV3Schema,
493
669
  ToolSandboxConfigSchema,