@tiledesk/tiledesk-server 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/.circleci/config.yml +1 -1
  2. package/CHANGELOG.md +37 -0
  3. package/Dockerfile +3 -2
  4. package/Dockerfile-en +3 -2
  5. package/Dockerfile-jobs +3 -2
  6. package/Dockerfile-profiler +3 -2
  7. package/README.md +15 -0
  8. package/app.js +14 -1
  9. package/bin/quota-reset +68 -0
  10. package/bin/quota-restore +86 -0
  11. package/channels/chat21/chat21Handler.js +50 -34
  12. package/channels/chat21/chat21JoinTracker.js +43 -0
  13. package/config/database.js +5 -5
  14. package/config/native_mcp/native_mcp_servers.json +1 -0
  15. package/controllers/chatbot.controller.js +80 -27
  16. package/controllers/intents.controller.js +42 -0
  17. package/docs/superpowers/plans/2026-09-15-webhook-chatbot-hitl-chat21-ionic.md +468 -0
  18. package/docs/superpowers/plans/2026-09-15-webhook-chatbot-hitl-design-studio.md +1349 -0
  19. package/docs/superpowers/plans/2026-09-15-webhook-chatbot-hitl-server.md +1694 -0
  20. package/docs/superpowers/plans/2026-09-15-webhook-chatbot-hitl-tybot.md +789 -0
  21. package/docs/superpowers/plans/2026-09-29-hitl-known-limits-server.md +83 -0
  22. package/docs/superpowers/plans/2026-09-29-hitl-known-limits-tybot.md +76 -0
  23. package/docs/superpowers/plans/2026-09-29-hitl-participant-removal-chat21-ionic.md +97 -0
  24. package/docs/superpowers/plans/2026-09-29-hitl-participant-removal-design-studio.md +72 -0
  25. package/docs/superpowers/plans/2026-09-29-hitl-participant-removal-server.md +223 -0
  26. package/docs/superpowers/plans/2026-09-29-hitl-participant-removal-tybot.md +121 -0
  27. package/docs/superpowers/plans/2026-09-29-hitl-pre-branch-ports.md +65 -0
  28. package/docs/superpowers/plans/2026-09-30-flow-start-points-design-studio.md +88 -0
  29. package/docs/superpowers/plans/2026-09-30-flow-start-points-server.md +103 -0
  30. package/docs/superpowers/plans/2026-09-30-flow-start-points-tybot.md +43 -0
  31. package/docs/superpowers/plans/2026-10-01-scheduled-start-point-design-studio.md +80 -0
  32. package/docs/superpowers/plans/2026-10-01-scheduled-start-point-runtime.md +39 -0
  33. package/docs/superpowers/plans/2026-10-01-scheduled-start-point-server.md +106 -0
  34. package/docs/superpowers/specs/2026-09-15-webhook-chatbot-hitl-design.md +715 -0
  35. package/docs/superpowers/specs/2026-09-30-flow-start-points-design.md +156 -0
  36. package/docs/superpowers/specs/2026-10-01-scheduled-start-point-design.md +303 -0
  37. package/docs/superpowers/todo/2026-09-14-webhook-chatbot-shared-code-fixes.md +191 -0
  38. package/event/botEvent.js +12 -1
  39. package/event/emailEvent.js +3 -0
  40. package/event/messageEvent.js +44 -0
  41. package/jobs.js +10 -0
  42. package/jobsManager.js +19 -0
  43. package/middleware/errorHandler.js +6 -2
  44. package/models/agentPrompt.js +104 -0
  45. package/models/analyticResult.js +1 -1
  46. package/models/channelConstants.js +3 -2
  47. package/models/quotaUsage.js +71 -0
  48. package/models/request.js +6 -0
  49. package/models/requestSnapshot.js +12 -0
  50. package/models/routerLogger.js +1 -1
  51. package/models/webhook.js +44 -0
  52. package/package.json +7 -5
  53. package/pubmodules/emailNotification/requestNotification.js +14 -22
  54. package/pubmodules/events/test/eventRoute.js +7 -6
  55. package/pubmodules/rules/conciergeBot.js +9 -4
  56. package/routes/agentPrompts.js +132 -0
  57. package/routes/auth.js +1 -12
  58. package/routes/campaigns.js +0 -13
  59. package/routes/dataTable.js +0 -3
  60. package/routes/faq_kb.js +12 -1
  61. package/routes/messagesRoot.js +0 -1
  62. package/routes/quotes.js +38 -1
  63. package/routes/request.js +81 -5
  64. package/routes/users.js +0 -1
  65. package/routes/webhook.js +160 -8
  66. package/routes/webhooks.js +276 -6
  67. package/routes/widgetLoader.js +6 -3
  68. package/services/QuoteManager.js +77 -16
  69. package/services/aiService.js +1 -1
  70. package/services/chatbotService.js +55 -1
  71. package/services/departmentService.js +60 -43
  72. package/services/dolphinSchedulerClient.js +116 -0
  73. package/services/emailService.js +6 -1
  74. package/services/hitlParticipantListener.js +260 -0
  75. package/services/participantInviteService.js +302 -0
  76. package/services/participantRemoveService.js +79 -0
  77. package/services/quotaSnapshotService.js +1167 -0
  78. package/services/requestService.js +102 -144
  79. package/services/scheduledStart/dolphinBackend.js +246 -0
  80. package/services/scheduledStart/schedulerBackend.js +101 -0
  81. package/services/scheduledStart/schedulerServiceClient.js +41 -0
  82. package/services/scheduledStartPublishListener.js +186 -0
  83. package/services/scheduledStartRules.js +173 -0
  84. package/services/scheduledStartService.js +130 -0
  85. package/services/startPointCleanupListener.js +30 -0
  86. package/services/startPointService.js +158 -0
  87. package/services/testWsService.js +1 -4
  88. package/services/updateRequestSnapshotQueued.js +8 -9
  89. package/services/webhookConversationService.js +185 -0
  90. package/services/webhookSettingsValidator.js +61 -0
  91. package/template/email/checkpointReachedEmail.html +5 -0
  92. package/test/agentPromptsRoute.test.js +154 -0
  93. package/test/agentTokensQuota.js +237 -0
  94. package/test/botEventHitlFallback.js +19 -0
  95. package/test/chat21HandlerJoinWiring.js +59 -0
  96. package/test/dataTablesRoute.test.js +10 -2
  97. package/test/dateUtils.test.js +0 -3
  98. package/test/departmentService.js +8 -12
  99. package/test/{fileRoute.js → deprecated/_deprecated_fileRoute} +2 -2
  100. package/test/{kbsettingsRoute.js → deprecated/_deprecated_kbsettingsRoute} +3 -3
  101. package/test/faqRoute.js +6 -1
  102. package/test/faqkbRoute.js +14 -10
  103. package/test/faqkbV3Route.js +1 -1
  104. package/test/filepRoute.js +4 -50
  105. package/test/hitlParticipantListener.js +446 -0
  106. package/test/hitlQueueWiring.js +191 -0
  107. package/test/hitlWaitingReset.js +124 -0
  108. package/test/inviteParticipantsRoute.js +492 -0
  109. package/test/kbRoute.js +1 -1
  110. package/test/messageRoute.js +33 -21
  111. package/test/nativemcp.test.js +7 -1
  112. package/test/openaiRoute.js +2 -8
  113. package/test/publishFailLoud.test.js +414 -0
  114. package/test/quotaSnapshots.js +1044 -0
  115. package/test/removeParticipantsRoute.js +186 -0
  116. package/test/requestService.js +24 -16
  117. package/test/requestServiceRemoveParticipant.js +144 -0
  118. package/test/requestVisibility.test.js +186 -0
  119. package/test/scheduledStartFacade.js +184 -0
  120. package/test/scheduledStartHandover.js +95 -0
  121. package/test/scheduledStartPublish.js +320 -0
  122. package/test/scheduledStartRoute.js +163 -0
  123. package/test/scheduledStartRules.js +177 -0
  124. package/test/scheduledStartRun.js +299 -0
  125. package/test/scheduledStartSchedulerBackend.js +116 -0
  126. package/test/scheduledStartService.js +290 -0
  127. package/test/startPointsCleanup.js +69 -0
  128. package/test/startPointsRegression.js +169 -0
  129. package/test/startPointsRoute.js +158 -0
  130. package/test/webhookConversationRoute.js +347 -0
  131. package/test/webhookConversationService.js +261 -0
  132. package/test/webhookConversationTestUtils.js +55 -0
  133. package/utils/aiUtils.js +95 -1
  134. package/utils/intentFieldNames.js +192 -0
  135. package/utils/quotaCliUtil.js +43 -0
  136. package/utils/requestVisibility.js +355 -0
  137. package/websocket/webSocketServer.js +36 -31
  138. /package/test/{imageRoute.js → deprecated/_deprecated_imageRoute} +0 -0
@@ -0,0 +1,106 @@
1
+ # Scheduled start point — tiledesk-server Implementation Plan
2
+
3
+ > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4
+
5
+ **Goal:** A `scheduled` start point whose draft is edited through the start point API, made live in DolphinScheduler at publish, and run through a token-protected endpoint that opens a conversation from the Scheduled box.
6
+
7
+ **Architecture:** Pure rules (`scheduledStartRules.js`: validation, Quartz cron, summary) feed `startPointService` for the draft; `dolphinSchedulerClient.js` + `scheduledStartService.js` own the DolphinScheduler workflow/schedule; a `faqbot.publish` listener syncs draft → live; `POST /webhook/scheduled-start` starts the conversation through a generalized `webhookConversationService.start`.
8
+
9
+ **Tech Stack:** Node/Express, Mongoose, axios, moment-timezone, mocha + chai-http + nock (test MongoDB + Redis).
10
+
11
+ **Spec:** `docs/superpowers/specs/2026-10-01-scheduled-start-point-design.md`
12
+
13
+ ## Global Constraints
14
+
15
+ - Branch `feature/scheduled-start-point` (checked out, created from `feature/webhook-chatbot-hitl`). Never push. Commits end with a blank line + `Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>`.
16
+ - Start point types become exactly `['webhook', 'scheduled']`; `'web'` stays implicit.
17
+ - Scheduled config is the **draft**; production changes only at publish (spec §7). Deleting the chatbot destroys the schedule immediately.
18
+ - **Ruling (storage of live):** the live snapshot is stored on the webhook record as top-level `scheduled_live` (not inside the start point entry), so removing the draft entry (DELETE route or the existing `faq.delete` cleanup `$pull`) keeps the live ids the next publish needs to destroy the schedule. Same fields as spec §4 `live`: `{ enabled, block_id, mapping, schedule, published_bot_id, published_at, workflow_code, schedule_id, error }`. Never accepted from clients.
19
+ - Feature enabled only when `SCHEDULER_BASEURL`, `SCHEDULER_TOKEN`, `SCHEDULER_PROJECT` and `SCHEDULED_START_TOKEN` are all set; otherwise every `scheduled` route answers 503 `"Scheduled starts are not available on this installation"`. No default token.
20
+ - Workflow name `auto-start-<chatbot_id>`; HTTP task `POST {API_URL}/webhook/scheduled-start`, body params `id_project`, `chatbot_id`, header `x-auth-token: ${token}` (workflow global params), timeouts 60000, no retries. Schedule: `timezoneId`, `startTime` now, `endTime` `2099-12-31 23:59:59`, `failureStrategy: CONTINUE`, `warningType: NONE`, `processInstancePriority: MEDIUM`. DolphinScheduler 3.2.2 REST, header `token`, same endpoints as `services/aiReindexService.js` / jobworker `ReindexScheduler.js`.
21
+ - Validation values (400): interval minutes ∈ {5,10,15,20,30}, hours 1..12; `time` `^([01]\d|2[0-3]):[0-5]\d$`; weekly ≥ 1 of `mon..sun`; monthly `day_of_month` 1..28 or `'last'`; IANA timezone; payload flat, keys `^[A-Za-z_][A-Za-z0-9_]*$`, values string|finite number|boolean, ≤ 50 keys, ≤ 8192 bytes serialized.
22
+ - Cron mapping (spec §6): minutes N `0 0/N * * * ? *`; hours N `0 0 0/N * * ? *`; daily `0 MM HH * * ? *`; weekly `0 MM HH ? * MON,WED,FRI *` (weekday order mon..sun); monthly `0 MM HH D * ? *`, last `0 MM HH L * ? *`.
23
+ - Run endpoint statuses: 401 bad/missing token, 503 not configured, 410 + workflow offline when chatbot missing or `trashed`, webhook/start point/`scheduled_live` missing or `scheduled_live.enabled` false; 429 rate limit; 202 `{ success: true, request_id }`.
24
+ - Scheduled conversation: lead id `scheduled_<chatbot_id>`, fullname `scheduled_live.mapping.source_name || chatbot.name || 'Scheduled'`; channel `webhook`; request attributes `{ start_type: 'scheduled', payload, scheduled_at }`; `/start` with `attributes.action = '#' + block_id`; not draft.
25
+ - Invite/Remove human 422 messages become `"Invite human requires a conversation started by a webhook or a schedule"` / `"Remove human requires a conversation started by a webhook or a schedule"`.
26
+ - Tests: `NODE_ENV=test ./node_modules/.bin/mocha <files> --timeout 60000 --exit` with test MongoDB/Redis up (docker `tiledesk-test-mongo`, `tiledesk-test-redis`); stop `td-e2e-rabbitmq` if running. nock all DolphinScheduler traffic; no real scheduler in tests.
27
+
28
+ ## Review Focus
29
+
30
+ 1. Publish of a chatbot without any scheduled start point → no DolphinScheduler call at all (spec §11), and publish answers 200 even when DolphinScheduler is unreachable for a chatbot that has one.
31
+ 2. Box deleted from the draft (faq delete) and then publish → the live schedule is destroyed (needs `scheduled_live` to survive the `$pull`).
32
+ 3. A run firing for a chatbot that was trashed or whose `scheduled_live.enabled` is false → 410 and the workflow taken offline, no conversation.
33
+ 4. Changing only the timezone of a live schedule and publishing → `update` (offline → update → online), not a second workflow.
34
+ 5. Two publishes in a row with no change → second sync is an `update` with the same cron, never `activate` again (no duplicate `auto-start-<id>` definitions).
35
+
36
+ ---
37
+
38
+ ### Task 1: scheduled draft — rules, model, API
39
+
40
+ **Files:**
41
+ - Create: `services/scheduledStartRules.js`
42
+ - Modify: `models/webhook.js` (start point enum, `mapping.payload`, `schedule`; webhook-level `scheduled_live`)
43
+ - Modify: `services/startPointService.js` (TYPES, scheduled validation and storage)
44
+ - Modify: `routes/webhooks.js` (503 gate for `scheduled`, `schedule_summary`/`live_summary` in PUT response, `scheduled_available` in GET)
45
+ - Test: `test/scheduledStartRules.js`, `test/scheduledStartRoute.js`
46
+
47
+ **Interfaces:**
48
+ - Produces `scheduledStartRules.validateSchedule(schedule) → string|null` (error message or null), `validatePayload(payload) → string|null`, `toQuartzCron(schedule) → string`, `summarize(schedule) → string` (e.g. `"Every weekday at 08:30 (Europe/Rome)"`, `"Every 15 minutes (UTC)"`, `"Daily at 09:00 (Europe/Rome)"`, `"Monthly on the last day at 07:00 (UTC)"`; weekday list `mon..fri` reads "Every weekday", otherwise "Every Mon, Wed, Fri"), `isConfigured() → boolean` (the four env vars).
49
+ - `startPointService.upsert(id_project, chatbot, 'scheduled', { block_id, enabled?, mapping?: { source_name?, payload? }, schedule?, confirm? })`: `schedule` required when creating; stored as given after validation; never touches `scheduled_live`.
50
+ - Webhook GET/PUT responses: `scheduled_available: Boolean`; PUT `scheduled` adds `schedule_summary` and, when `scheduled_live` exists, `live_summary`.
51
+
52
+ - [ ] **Step 1: Failing tests.** `scheduledStartRules`: every cron row of Global Constraints (`toQuartzCron({frequency:'weekly',time:'08:30',weekdays:['fri','mon','wed'],timezone:'UTC'}) === '0 30 8 ? * MON,WED,FRI *'`), each 400 case of Global Constraints returns a message naming the field (`every`, `time`, `weekdays`, `day_of_month`, `timezone`, payload key/value/size), `summarize` examples above. Route: PUT scheduled with valid schedule → 200, entry stored, `schedule_summary` set, no `scheduled_live`; PUT without `schedule` on create → 400; payload `{ 'a.b': 1 }` → 400; env unset (delete `process.env.SCHEDULED_START_TOKEN` in the test) → 503 for PUT/DELETE scheduled while PUT webhook still works; GET → `scheduled_available` false/true accordingly; DELETE scheduled → entry gone, `scheduled_live` untouched (seed one directly).
53
+ - [ ] **Step 2: Run** `NODE_ENV=test ./node_modules/.bin/mocha test/scheduledStartRules.js test/scheduledStartRoute.js --timeout 60000 --exit` → fail.
54
+ - [ ] **Step 3: Implement.** Timezone check with `moment.tz.zone(name)`; summary text built from the schedule only (no DolphinScheduler).
55
+ - [ ] **Step 4: Run** the two files plus `test/startPointsRoute.js test/startPointsCleanup.js test/webhookConversationRoute.js` → all pass.
56
+ - [ ] **Step 5: Commit** — `feat(scheduled-start): scheduled start point draft, rules and API`.
57
+
58
+ ### Task 2: DolphinScheduler client and scheduled start lifecycle
59
+
60
+ **Files:**
61
+ - Create: `services/dolphinSchedulerClient.js`, `services/scheduledStartService.js`
62
+ - Test: `test/scheduledStartService.js`
63
+
64
+ **Interfaces:**
65
+ - Consumes `toQuartzCron`, `isConfigured` (Task 1).
66
+ - Produces `dolphinSchedulerClient`: `createWorkflow(name, httpTask) → { code }`, `releaseWorkflow(code, 'ONLINE'|'OFFLINE')`, `deleteWorkflow(code)`, `createSchedule(code, { crontab, timezoneId }) → { id }`, `updateSchedule(id, code, { crontab, timezoneId })`, `scheduleOnline(id)`, `scheduleOffline(id)`, `findWorkflowByName(name) → { code }|null`, `previewSchedule({ crontab, timezoneId }) → string[]`. Errors carry `.status` and the DolphinScheduler message; a response with `success: false` or `code !== 0` is an error.
67
+ - Produces `scheduledStartService`: `activate(chatbot_id, snapshot) → { workflow_code, schedule_id }`, `update(live, snapshot)`, `deactivate(live)`, `destroy(live)`, `nextRuns(live) → string[]` (3 items, `[]` on error). `snapshot = { schedule, ... }`; `live` = the stored `scheduled_live`.
68
+
69
+ - [ ] **Step 1: Failing tests (nock on `SCHEDULER_BASEURL`):** activate issues in order create definition (assert body: name `auto-start-<id>`, HTTP task URL `{API_URL}/webhook/scheduled-start`, global params `id_project`, `chatbot_id`, `token`) → release ONLINE → create schedule (assert `crontab`, `timezoneId`, `endTime` 2099) → schedule online, and returns ids; schedule-creation failure → definition released OFFLINE and deleted, error rethrown with status 502; update with known ids → offline, update, online; update whose schedule id is unknown (DolphinScheduler 404/`code!=0`) → falls back to activate (findWorkflowByName reuses an existing `auto-start-<id>` definition instead of creating a duplicate); deactivate → schedule offline only; destroy → schedule offline → definition offline → delete; destroy with unknown ids → resolves (nothing to remove).
70
+ - [ ] **Step 2: Run** `... test/scheduledStartService.js` → fail.
71
+ - [ ] **Step 3: Implement** (axios, header `token`, params as query like the jobworker; HTTP task JSON shape copied from tiledesk-training-jobworker `utils/shedulerUtils.js#getWorkflowObject`).
72
+ - [ ] **Step 4: Run** → pass; also `nock.isDone()` asserted per test.
73
+ - [ ] **Step 5: Commit** — `feat(scheduled-start): DolphinScheduler client and schedule lifecycle`.
74
+
75
+ ### Task 3: publish sync, retry, chatbot delete
76
+
77
+ **Files:**
78
+ - Create: `services/scheduledStartPublishListener.js`
79
+ - Modify: `app.js` (listen next to `startPointCleanupListener`), `routes/webhooks.js` (`POST /:chatbot_id/start_points/scheduled/sync`; `DELETE /:chatbot_id` destroys first), GET adds `next_runs`
80
+ - Test: `test/scheduledStartPublish.js`
81
+
82
+ **Interfaces:**
83
+ - Consumes Task 2 `scheduledStartService`.
84
+ - Produces `scheduledStartPublishListener.sync(id_project, chatbot_id, published_bot_id) → scheduled_live|null` (used by the listener and the sync route), `listen()` on `botEvent` `faqbot.publish` (payload `{ chatbot, publishedBotId }`) and `faqbot.delete` (deleted faq_kb doc).
85
+
86
+ - [ ] **Step 1: Failing tests** (stub `scheduledStartService` methods by replacing them on the singleton, restore in afterEach): sync table of spec §7 — draft enabled + box in published copy (Faq with same `intent_id` under `published_bot_id`) → `activate` first time, `update` afterwards, `scheduled_live` = snapshot with `published_bot_id`/`published_at`; draft disabled → `deactivate`, `scheduled_live.enabled` false; box missing from published copy → `destroy`, `scheduled_live` unset; draft absent but `scheduled_live` present → `destroy`; no draft and no live → no service call (Review Focus 1); service throws → `scheduled_live.error` set, sync resolves; `PUT /:projectid/faq_kb/:id/publish` with the scheduler stubbed to throw → 200 (Review Focus 1); draft entry removed by `DELETE …/faq/<id>` then sync → destroy called with the old ids (Review Focus 2); two syncs unchanged → second is `update` (Review Focus 5); `faqbot.delete` → destroy; `DELETE /:projectid/webhooks/:chatbot_id` → destroy before delete; sync route returns `scheduled_live` and requires admin; GET returns `next_runs` from `nextRuns`.
87
+ - [ ] **Step 2: Run** `... test/scheduledStartPublish.js` → fail.
88
+ - [ ] **Step 3: Implement.** The listener catches everything (never throws into publish); `published_bot_id` for the sync route = the newest `faq_kb` with `root_id` = chatbot (`/:faq_kbid/published` query).
89
+ - [ ] **Step 4: Run** the file plus `test/startPointsRegression.js test/startPointsCleanup.js` → pass.
90
+ - [ ] **Step 5: Commit** — `feat(scheduled-start): go live at publish, retry and cleanup on chatbot delete`.
91
+
92
+ ### Task 4: the scheduled run and the draft test run
93
+
94
+ **Files:**
95
+ - Modify: `services/webhookConversationService.js` (`start` takes the start point and start type), `routes/webhook.js` (`POST /scheduled-start`), `routes/webhooks.js` (`POST /:chatbot_id/start_points/scheduled/test`), `services/participantInviteService.js:46`, `services/participantRemoveService.js:28`
96
+ - Test: `test/scheduledStartRun.js`; adapt `test/webhookConversationService.js` only if the `start` signature change requires it
97
+
98
+ **Interfaces:**
99
+ - `webhookConversationService.start(webhook, chatbot, payload, options)` gains `options.startPoint` (default: the enabled `webhook` start point, current behaviour), `options.startType` (default `'webhook'`), `options.leadId`/`options.leadName` overrides and `options.extraAttributes` (merged into request attributes). Existing callers unchanged.
100
+ - `POST /webhook/scheduled-start` (mounted on the existing public `/webhook` router, defined **before** `/:webhook_id`).
101
+
102
+ - [ ] **Step 1: Failing tests:** no header → 401; wrong token → 401; token env unset → 503; trashed chatbot → 410 and `scheduleOffline` called (stub) (Review Focus 3); `scheduled_live.enabled` false → 410 + offline; valid → 202, request has `channel.name === 'webhook'`, `attributes.start_type === 'scheduled'`, `attributes.payload` equals `scheduled_live.mapping.payload` (not the draft), `attributes.scheduled_at` ISO string, lead `scheduled_<chatbot_id>` named from the live source name or the chatbot name, system message `/start` with `attributes.action === '#' + scheduled_live.block_id`, `sourcePage` without `td_draft`; test route (admin) → 202, uses the **draft** mapping and `sourcePage` containing `dev=true&td_draft=true`, works with no `scheduled_live`; Invite human on a scheduled conversation → 200 (channel check), on a widget conversation → 422 with the new message.
103
+ - [ ] **Step 2: Run** `... test/scheduledStartRun.js` → fail.
104
+ - [ ] **Step 3: Implement.** Rate limit: reuse the webhook rate limiter keyed on the webhook id.
105
+ - [ ] **Step 4: Run** the file plus `test/webhookConversationService.js test/webhookConversationRoute.js test/inviteParticipantsRoute.js test/startPointsRegression.js test/webhookRoute.js` → all pass.
106
+ - [ ] **Step 5: Commit** — `feat(scheduled-start): scheduled runs and draft test runs`.