index.ts 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /**
  2. * Cron orchestration subsystem — moved from daemon/src/cron in
  3. * Phase 1.5 of the agent-core extraction.
  4. *
  5. * Hosts must call `configureCronHost(...)` once at startup to wire
  6. * concrete `CronStorePort`, `SessionLifecyclePort`, `AgentSpawnerPort`,
  7. * and the optional `ChannelDeliveryPort` / `MessageQueuePort` before
  8. * `CronRegistry.start()` runs. Cross-cutting helpers (`logger`,
  9. * `nowMs`, etc.) flow through `configureCronHost`.
  10. */
  11. export {
  12. CronRegistry,
  13. type CronRegistryOptions,
  14. type CronRegistryStartOptions,
  15. type CronSchedulerPort,
  16. type CronJobPort,
  17. type CronMutationSource,
  18. type CronTriggerSource,
  19. type CronDeliveryTarget,
  20. type CronMutationMetricsContext,
  21. type CronTriggerMetricsContext,
  22. } from './registry.js';
  23. export { CronExecutor, type ExecuteResult } from './executor.js';
  24. export { cleanupRetiredCronTasks, type RetiredCronFileStore } from './retired-cleanup.js';
  25. export { BusyQueue, TTL_MS, type QueuedEntry } from './busy-queue.js';
  26. export { getCurrentTime, parseTime, timeToMinutes, isWithinActiveHours } from './active-hours.js';
  27. // Schemas + types (re-exported from daemon/store/types for back-compat)
  28. export {
  29. ActiveHoursSchema,
  30. SessionConfigSchema,
  31. StoredSessionConfigSchema,
  32. CronConfigSchema,
  33. CronFrontmatterSchema,
  34. DeliveryConfigSchema,
  35. normalizeSessionConfig,
  36. resolveReportToRoot,
  37. type CronConfig,
  38. type CronFrontmatter,
  39. type CronConfigUpdate,
  40. type SessionConfig,
  41. type ActiveHoursConfig,
  42. type DeliveryConfig,
  43. type CronExecutionStatus,
  44. type CronTaskState,
  45. type CronTaskResponse,
  46. } from './types.js';
  47. // Host port + registry surface (consumed by daemon Container.initRuntime)
  48. export {
  49. configureCronHost,
  50. getMetricsReporter,
  51. resetCronHostForTesting,
  52. type CronHostUtils,
  53. type MetricsReporter,
  54. } from './host-utils.js';
  55. export {
  56. CRON_MESSAGE_LANE,
  57. CronSessionType,
  58. Role,
  59. type CronStorePort,
  60. type CronSessionRecord,
  61. type CronLoadResult,
  62. type SessionLifecyclePort,
  63. type AgentSpawnerPort,
  64. type ChannelDeliveryPort,
  65. type CronChannelBinding,
  66. type CronEventBusPort,
  67. type CronSessionBridgePort,
  68. type CronAgentResponseHandler,
  69. type CronSendMessageRequest,
  70. type CronChannelRunner,
  71. type MessageQueuePort,
  72. type CronSessionInfo,
  73. type CronSessionStatus,
  74. type AgentMessage,
  75. type MessageOrigin,
  76. type MessageSource,
  77. } from './host-ports.js';
  78. export { IM_AUTO_DELIVERY_PROMPT_NOTE } from './report-delivery.js';