Skip to content

Add ode cron/send/messages/reaction CLIs, retire /api/action#189

Merged
LIU9293 merged 2 commits intomainfrom
feat/cron-send-cli-238719
Apr 18, 2026
Merged

Add ode cron/send/messages/reaction CLIs, retire /api/action#189
LIU9293 merged 2 commits intomainfrom
feat/cron-send-cli-238719

Conversation

@LIU9293
Copy link
Copy Markdown
Contributor

@LIU9293 LIU9293 commented Apr 18, 2026

Summary

  • New ode cron CLI (create/list/show/update/enable/disable/run/delete) mirrors ode task, backed by GET /api/cron-jobs/:id + PATCH /api/cron-jobs/:id and a patchCronJob() helper.
  • New ode send file <path> --channel ... [--thread ...] [--filename ...] [--title ...] [--comment ...] uploads files/images.
  • New ode messages get <threadId> --channel <channelId> [--limit N] [--json] fetches thread replies.
  • New ode reaction add <messageId> --channel ... --emoji thumbsup|eyes|ok_hand adds reactions.
  • Retires the generic /api/action bridge and the short-lived /api/send/file / /api/messages/thread / /api/reactions routes. ode send / ode messages / ode reaction now call the Slack/Discord/Lark SDK helpers directly from the CLI process — no daemon round-trip, no HTTP hop.

CLI now drives Slack/Discord/Lark directly

  • packages/core/cli-handlers/channel-resolver.ts — resolves a <channelId> / <workspaceId>::<channelId> locator to (platform, workspaceId, channelId, credentials) by reading getWorkspaces() from the on-disk Ode config. Works without a running daemon.
  • packages/core/cli-handlers/flags.ts — shared --flag/positional parser used by send / messages / reaction.
  • packages/core/cli-handlers/send.ts, messages.ts, reaction.ts — call uploadSlackFile / getSlackThreadMessages / addSlackReaction (and Discord/Lark counterparts) directly with the resolved credentials.

Platform helpers

  • Slack (packages/ims/slack/api.ts): uploadSlackFile, getSlackThreadMessages, addSlackReaction now take a botToken argument and use raw fetch (conversations.replies, reactions.add, files.*), so they run fine from the CLI process without a Bolt App. postSlackQuestion is unchanged (daemon-only, still uses getApp().client).
  • Discord (packages/ims/discord/api.ts): uploadDiscordFile, getDiscordThreadMessages, addDiscordReaction.
  • Lark (packages/ims/lark/api.ts): uploadLarkFile, getLarkThreadMessages, addLarkReaction.
  • All generic handle*ActionPayload / *ActionRequest / *ApiResponse exports removed.

Removed

  • /api/action, /api/send/file, /api/messages/thread, /api/reactions routes and their registrars.
  • packages/core/web/routes/channel-resolver.ts, attachDiscordBotToken / attachLarkCredentials (only the retired routes used them).
  • getSlackActionApiUrl() / odeSlackApiUrl wiring — the system prompt no longer mentions any HTTP endpoint.

System prompt / docs

  • packages/agents/shared.ts rewrites the ODE CLI section so it describes ode task / ode cron / ode send / ode messages / ode reaction together, with the current channel + thread pre-filled in the examples.
  • AGENTS.md gains Fetching Messages and Reactions sections plus a "Platform APIs" note stating Ode exposes no HTTP bridge for chat actions — agents drive chat platforms only through the ode CLI verbs.

Tests

  • packages/ims/{discord,lark,slack}/api.test.ts cover the new per-platform helpers.
  • packages/agents/test/cli-command.test.ts updated assertions (no upload_file, no /api/action).
  • bun test — 267 pass, 1 skip, 0 fail.

Kai Liu added 2 commits April 18, 2026 15:26
- New `ode cron` CLI mirrors `ode task`: create/list/show/update/enable/disable/run/delete
  backed by new GET /api/cron-jobs/:id and PATCH /api/cron-jobs/:id routes and a
  patchCronJob() helper in the cron-jobs store.
- New `ode send file` CLI uploads files/images to any configured channel; the
  daemon resolves Slack/Discord/Lark from the channelId and dispatches to
  dedicated uploadSlackFile / uploadDiscordFile / uploadLarkFile helpers.
- Removed the per-platform `upload_file` branch from /api/action and from each
  ims adapter; system prompt in packages/agents/shared.ts no longer advertises
  it and now documents ode cron, ode send, plus a dedicated VISUAL TESTING
  section telling agents to drop screenshots back into the current thread.
- AGENTS.md gains matching cron/send sections; discord/lark api tests switched
  to exercise the new upload helpers directly.
Replaces the last remaining uses of the generic /api/action dispatcher
with dedicated Ode CLIs:

- ode messages get <threadId> --channel <channelId>   (fetch thread replies)
- ode reaction add <messageId> --channel ... --emoji  (react to a message)

Both commands auto-resolve Slack / Discord / Lark from the channel's
configured workspace, matching how ode task / ode cron / ode send work.

Server:
- New /api/messages/thread and /api/reactions routes.
- Shared channel-resolver.ts used by send/messages/reactions routes.
- Remove /api/action route and its per-platform handleSlackActionPayload
  / handleDiscordActionPayload / handleLarkActionPayload dispatchers.
- Slack / Discord / Lark api.ts files now expose only the focused helpers
  that back the CLIs (uploadX, getXThreadMessages, addXReaction) plus
  postSlackQuestion for SDK-emitted question events.

Config cleanup:
- Drop getSlackActionApiUrl and odeSlackApiUrl wiring; system prompt no
  longer advertises the raw action endpoint to agents.

System prompt:
- Rework ODE CLI section to describe task / cron / send / messages /
  reaction together, with per-tool flags and current-thread examples.
@LIU9293 LIU9293 changed the title Add ode cron and ode send CLIs, retire upload_file action Add ode cron/send/messages/reaction CLIs, retire /api/action Apr 18, 2026
@LIU9293 LIU9293 merged commit 6569c67 into main Apr 18, 2026
2 checks passed
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