merlyn/server/models
Marcello Fitton 41495cdabe
feat: Scheduled Jobs (#5322)
* initialize

* expand tool result text limit | add syntax highlighting and json formatting to tool result rendering

* fix onError jsdoc

* lint

* fix unread icon

* route protection

* improve form handling for NewJobModal

* safeJsonParse

* remove unneeded comments

* remove trycatch

* add truncateText helper

* add explicit fallback value tos safeJsonParse

* add shared cron constant and helpers

* reduce frontend indirection

* use isLight to compute syntax highlighting theme

* remove dead code

* remove forJob and make job limit to 50

* create recomputeNextRunAt helper method

* add comment about nextRunAt recomputation

* add job queue and concurrency control to scheduled jobs

* use p-queue

* change default max concurrent value to 1

* add comment explaining internal scheduling system

* add recomputeNextRunAt on boot

* add generated documents to run details

* Modify toolsOverride functionality where no tools selected means no tools are given to the agent

add a select all/deselect all toggle button for easily selecting all
tools in the cerate job form

* create usePolling hook

* add polling to scheduled jobs and scheduled job runs pages

* add cron generation feature in job form

* remove cron generation feature | add cron builder feature | add max active scheduled jobs limit

* set MAX_ACTIVE to null

* replace hour and minute input fields with input with type time

* simplify

* organize components

* move components to bottom of page component

* change Generated Documents to Generated Files

* add i18n to cronstrue

* add i18n

* add type="button" to button elements

* refactor fileSource retrieval logic

* one scheduled job run can have status "running"

* add protection of file retrieveal from scheduled job in multiuser mode

* fix comments

* make job status default to queued

* add queued status

* fix bug with result trace rendering

* store timeout ref and clearTimeout once race settles

* remove unneeded handlerPromise tracking

* move imports to top level

* refactor hardcoded paths to path resolve functions

* implement new job form design

* simplify

* fix button styles

* fix runJob bug

* implement styles for scheduled jobs page

* apply dark mode figma styles

* delete unused translation key

* implement light mode for new new job modal, run history, and run details

* lint

* fix light mode scroll bar in tool call card

* adjust table header contrast

* fix type in subtitle

* kill workers when job is in-flight before deleting job

* add border-none to buttons

* change locale time to iso string

* import BackgroundService module level | instatiate backgroundService singltone once and reuse across handlers

* add p-queue, @breejs/later and cron-validate as core deps

* parse cron expression to a builder state once

* add theme to day buttons in cron builder

* fix stale tools selection caption

* flip popover when popover clips screen height

* make ScheduleJob.trigger() await the run insertion | disable run now button if job is in flight

* regen table

* refactor generated file card

* refactor frontend

* remove logs

* major refactor for tool picking, fix bree/later bug

* combine action endpoints, move contine to method

* fix unoptimized query with include + take + order

* fix dangerous use, refactor job to utils

* add copy content to text response

* improve notification system subscription for browser

* remove unused translations

* prevent gen-file cleanup job from deleting active job file generated references

* rich text copy

* Scheduled Jobs: Translations (#5482)

* add locales for scheduled jobs

* i18n

---------

Co-authored-by: Timothy Carambat <rambat1010@gmail.com>

* add config flag with UI notice

* update README

* telemetry datapoints

* Always use UTC on backend, convert to local in frontend

* fix tz render

* Add job killing

* cleanup thinking text in job notifications and break out reasoning in response text.
Also hide zero metrics since that is useless

* Port generatedFile schema to the normalized workspace chat `outputs` file format so porting to thread is simple and implem between chats <> jobs is 1:1

* what the fuck

* compiled bug

* fixed thinking oddity in complied frontend

* supress multi-toast

* fix duration call

* Revert "fix duration call"

This reverts commit 0491bc71f4223e65ea4046561b15b268fefb8da2.

* revert and reapply fix

---------

Co-authored-by: Timothy Carambat <rambat1010@gmail.com>
2026-04-29 12:05:46 -07:00
..
agentSkillWhitelist.js add ask to run prompt for tool calls (demo) (#5261) 2026-03-24 15:18:17 -07:00
apiKeys.js feat: adds name field to api keys (#5366) 2026-04-10 10:40:14 -07:00
browserExtensionApiKey.js Enforce user suspension check on browser extension API key path 2026-03-13 10:05:05 -07:00
cacheData.js Infinite prompt input and compression implementation (#332) 2023-11-06 13:13:53 -08:00
communityHub.js Publish slash commands to hub (#4019) 2025-06-24 16:19:50 -07:00
documents.js feat: Document Embedding Status Events | Refactor Document Embedding to Job Queue and Forked Process (#5254) 2026-04-06 17:00:15 -07:00
documentSyncQueue.js fix issue with files loading with watching enabled (#3930) 2025-06-01 14:53:48 -05:00
documentSyncRun.js [BETA] Live document sync (#1719) 2024-06-21 13:38:50 -07:00
embedChats.js chore: add ESLint to /server (#5126) 2026-03-05 16:32:45 -08:00
embedConfig.js Automatic mode is now default 2026-03-31 13:11:46 -07:00
eventLogs.js [FEAT] Automated audit logging (#667) 2024-02-06 15:21:40 -08:00
externalCommunicationConnector.js Telegram bot connector (#5190) 2026-03-23 15:10:21 -07:00
invite.js Add ability to add invitee to workspaces automatically (#975) 2024-03-26 16:38:32 -07:00
mobileDevice.js chore: add ESLint to /server (#5126) 2026-03-05 16:32:45 -08:00
passwordRecovery.js Migrate to bcryptjs (#4767) 2025-12-11 15:19:04 -08:00
promptHistory.js fix null entry on new workspace 2025-05-08 08:34:37 -07:00
scheduledJob.js feat: Scheduled Jobs (#5322) 2026-04-29 12:05:46 -07:00
scheduledJobRun.js feat: Scheduled Jobs (#5322) 2026-04-29 12:05:46 -07:00
slashCommandsPresets.js Community hub integration (#2555) 2024-11-26 09:59:43 -08:00
systemPromptVariables.js New Default System Prompt Variables (User ID, Workspace ID, & Workspace Name) (#4414) 2025-09-29 14:32:56 -07:00
systemSettings.js Remove default models to show empty until real models are retreieved (#5524) 2026-04-24 15:13:57 -07:00
telemetry.js feat: Scheduled Jobs (#5322) 2026-04-29 12:05:46 -07:00
temporaryAuthToken.js Add custom JWT TTL (#4234) 2025-08-01 10:39:38 -07:00
user.js chore: add ESLint to /server (#5126) 2026-03-05 16:32:45 -08:00
vectors.js Purge cached docs and remove docs from all workspaces on vectorDB/embedder changes (#2819) 2024-12-16 12:16:20 -08:00
workspace.js feat: Scheduled Jobs (#5322) 2026-04-29 12:05:46 -07:00
workspaceAgentInvocation.js patch agent invocation regression 2024-04-27 12:39:45 -07:00
workspaceChats.js Enable chatId reporting during agent sessions (#5407) 2026-04-13 13:24:09 -07:00
workspaceParsedFiles.js Fix potential IDOR vulnerability in workspace parsed files endpoints 2026-03-13 15:22:07 -07:00
workspacesSuggestedMessages.js [FEAT] create custom prompt suggestions per workspace (#664) 2024-02-06 11:24:33 -08:00
workspaceThread.js Add ability to search workspace and threads (#4120) 2025-07-10 16:42:10 -07:00
workspaceUsers.js Add new workspace user management endpoint (#2842) 2024-12-16 11:50:34 -08:00