Skip to content

feat: add scheduled tasks panel with cron support - #344

Open
Jason880902 wants to merge 11 commits into
Devin-AXIS:mainfrom
Jason880902:feat/scheduled-tasks
Open

feat: add scheduled tasks panel with cron support#344
Jason880902 wants to merge 11 commits into
Devin-AXIS:mainfrom
Jason880902:feat/scheduled-tasks

Conversation

@Jason880902

Copy link
Copy Markdown

Summary

Adds a Scheduled Tasks panel with cron support — a new sidebar entry that lets users create recurring agent tasks from templates, backed by a cron ticker in the Electron main process.

What changed

  • New scheduled-tasks domain under domains/session/:
    • cron.ts — dependency-free 5-field cron parser/matcher + next-run calculator
    • scheduled-task-templates.ts — 6 built-in templates (daily standup, weekly report, daily news, data report, meeting follow-up, todo scan)
    • scheduled-tasks-panel.tsx — panel UI (task list, template picker, cron editor with live next-run preview, enable toggle, run-now, run log)
  • Electron scheduled-tasks.mjs — JSON persistence + cron ticker + run log, wired as a testable factory (same pattern as ssh-ops.mjs / git-graph.mjs)
  • Sidebar menu entry + i18n keys (scheduled_tasks.title in zh/en)
  • preload.mjs bridge + desktop.ts type declarations + main.mjs IPC wiring

Stacking note

This branch is stacked on top of feat/ssh-ops-panel (PR #341), which adds the SSH ops / Git graph / LAN preview panels that the scheduled-tasks panel's mainWorkspaceView wiring depends on. Please review/merge #341 first — after that, this PR's diff will shrink to just the scheduled-tasks files.

Verification

  • pnpm --filter @ipollowork/app typecheck — passed (0 errors)
  • node --check on scheduled-tasks.mjs / preload.mjs / main.mjs — passed
  • Runtime cron + persistence test (create/list/runNow/setEnabled/remove/logs/preview) — 15/15 passed
  • nextRunAfter worst-case (never-matching cron 0 0 31 2 *) — 206ms (was 1870ms before fix)

Jovan-zjy added 7 commits August 16, 2026 11:11
Extend the in-session terminal bridge to spawn commands directly
(e.g. ssh user@host), parse ~/.ssh/config for a host list, and add a
sidebar entry ('运维') that opens a multi-session SSH ops panel with
quick-connect input and xterm rendering.
Add a sidebar entry ('Git') that opens a swimlane git graph panel. The
Electron main process gains an ipollowork:git:graph IPC that builds a
commit DAG from rev-list --parents plus ref -> commit mapping from
for-each-ref; the renderer draws an SVG lane layout with branch badges,
commit selection, and a detail pane.
Add a default-off LAN read-only preview server so phones and tablets on
the local network can view the workbench via a pairing flow. The main
process gains a lan-preview-server with 6-digit single-use pair codes,
challenge-based anti-CSRF, in-memory session tokens, per-IP fail lockout
and rate limiting, and a hard 403 on /api/execute (read-only). A new
settings tab (Remote Preview) toggles the server, shows the LAN address
and pair code with countdown, and lists paired devices.
SSH ops + Git graph + LAN preview remediation pass:
- Git graph: detect and surface truncation (rev-list total-count probe,
  truncated banner, dashed stub edges for parents outside the window);
  fix lane layout so sibling branches fork to distinct lanes instead of
  collapsing onto the parent lane.
- LAN preview: raise pair-code entropy (8-char uppercase alphabet,
  ~39.6 bits) and add a global fail lockout with exponential backoff on
  top of per-IP limits.
- Module layout: move ops-panel/git-panel out of domains/session/terminal
  into domain-owned dirs with pure-logic modules (graph-layout.ts,
  ops-utils.ts) instead of dodging the single-file-directory audit rule.
- Main process: extract ssh-ops.mjs and git-graph.mjs factories from
  main.mjs; add preview-core.mjs shared read-only renderer bridge with
  sanitized public summary for LAN/IM channels.
- Tests: node:test suites for ssh config parsing, git DAG building, and
  preview-core redaction; bun:test suites for swimlane layout and SSH
  target normalization.
Add an IM notification section to the Remote Preview settings tab: paste
a DingTalk/Feishu MCP Streamable-HTTP endpoint and push a redacted
workbench summary to the group. The main process gains im-bot.mjs, a
minimal MCP client that discovers a send tool by name (send_message /
sendMessage / send_text / messages_send) and calls it with the sanitized
snapshot from preview-core. No lan-preview session tokens are ever sent.
Includes node:test coverage for tool discovery, argument mapping, and
summary redaction.
… scan

- update() now applies lastRunAt/lastRunStatus so runNow records the run
- nextRunAfter parses once and scans at most 4 years to avoid UI stalls on
  never-matching expressions (e.g. "0 0 31 2 *")
Jovan-zjy added 4 commits August 16, 2026 19:45
…s, async fire with error status

- parseFieldPart now rejects malformed tokens (e.g. 5abc, 1-2x) via strict regex
- create/update reject invalid cron expressions in the main process
- fire() is async, records 'error' status when onFire rejects, drops misleading log text
- 15 node:test cases covering cron parsing/matching/next-run and factory CRUD/tick dedup
- register the suite in the desktop test script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant