VELADocsvelab.si ↗

Channels

A channel connects a chat service to Vela. The gateway keeps one shared session per chat, identified by the channel name and channelId (for example lark-oc_456). Different chats have separate history and can run concurrently. Within a chat, everyone sees the same conversation history. Messages queue in order by default; Lark also offers Steer and Stop during a run.

This page covers running Vela in a group chat via vela daemon. To write a Runtime channel adapter, see Channels reference; it covers the ChannelAdapter contract, lifecycle, custom transports, external event subscriptions and SDK host access.

Enabling a chat means trusting everyone in it with that chat’s execution environment and Vela instance. Lark gives every member of an enabled chat full access in the group session and in topics alike: bash, files, memory and extension tools. By default (environment: "local"), session tools run directly on the host with no local OS sandbox; binding a group to a configured Docker environment runs its file and shell tools inside that container while extensions, global memory, and daemon operations remain on the host. There is no per-member boundary. See Security before enabling a group.

Topic tool migration

The shared topic tools now use Runtime’s platform-agnostic names on Lark too: session_start, session_forward, session_list, session_read, session_message, wait_for_input, skip_reply, timers, subscriptions, and send_file. Replace explicit old lark_* or channel_* names in tool selections, permission rules and custom prompts; no compatibility aliases remain. Mandatory tools are still added to a configured Lark group tool list. lark_search_history is unchanged because it reads the Lark service. Existing chat/topic IDs, saved sessions, routines and history keep their identities.

Send a workspace file

Ask in the conversation that should receive the file, for example “Send me out/report.patch as a file.” The sequential send_file tool takes one workspace-relative path. The limit is 30 MB (30,000,000 bytes). Lark posts supported images up to 10 MB inline and larger images as file attachments. An enabled Lark group with an explicit tool list must include send_file to use it. The bot needs im:resource or im:resource:upload and its existing send permission. If Feishu rejects the attachment post, the reply reports its error code and message. If the reply says delivery is uncertain, check the conversation before requesting another send.

Isolation scope

Each group’s workspace directory is a default path, not a security sandbox on its own. In the default local environment, absolute paths, traversal, symlinks, and bash reach host files and credentials; binding a group to a Docker environment confines its file, search, and bash tools to that container, while shared extensions, global memory notes, and daemon operations still execute on the host. Memory/global-write restrictions apply to the memory API, not OS access. Enabled chats remain the instance trust boundary; topics share their group’s workspace and notes, and all groups intentionally read global notes.

Lark

The built-in lark extension uses Lark’s long connection (WebSocket), so no public URL is needed. It is loaded by default in the CLI.

Run vela setup lark in an interactive terminal to configure a group. The wizard validates the app credentials, waits for a human to mention the bot in a group, and asks for confirmation before enabling it. The confirmation shows the chat ID and, when available, the group name. If Vela cannot retrieve the name, you can confirm using the ID alone. Every member of an enabled group has full access to Vela tools. It saves credentials in user-level config.json (mode 0600), sends a connection message, and summarizes the saved settings. Card callbacks and other permissions are checklist items, not verified by setup; use the manual reference below. Listener configuration lives in user-level config.json.

Then start or reload vela daemon (vela daemon start or vela daemon run, see Deploy; if vela daemon is already running, it reloads config.json automatically) and mention the bot again to check a model-backed reply.

Manual setup. To configure it by hand instead of running the wizard:

  1. Create and publish a Lark custom app with bot capability enabled.

  2. In Events & Callbacks, choose long-connection mode, subscribe to the event im.message.receive_v1, and add the callback subscription Card action trigger (card.action.trigger). Use the callback subscription, not the older card request-URL setting; this integration dispatches v2 callbacks over the same long connection.

  3. Grant the API permissions below and add the bot to groups you intend to enable.

  4. Configure the app credentials, owner open_ids and enabled chat_ids in settings:

    {
      "lark": {
        "appId": "cli_xxx",
        "appSecret": "$LARK_APP_SECRET",
        "owners": ["ou_aaa"],
        "chats": ["oc_trusted_group"]
      }
    }

    owners and legacy chats accept string arrays or comma-separated strings. chats also accepts objects with id and optional environment, tools, model, thinkingLevel, topicModel and topicThinkingLevel (see below). LARK_APP_ID, LARK_APP_SECRET and LARK_OWNERS remain environment defaults; settings take precedence. To supply chat ids from an environment variable, set "chats": "$LARK_CHATS" in settings.

    In the owner’s settings, environments.<name> takes a required local Docker image and optional network (on by default, off, or restricted). For restricted HTTPS egress, use a supported local Docker engine on a non-root Linux host with OpenSSL and set "allow": ["github.com", "api.github.com"] in that environment. The list must contain exact DNS hosts and is valid only with restricted. Unlisted destinations and direct connections are denied; if the proxy is unavailable, Vela does not open the network. The owner can configure host credentials for exact HTTPS origins in on or restricted; in restricted mode those origins must all be on the allowlist. A chat’s environment selects that name for its hub and topics. An idle session moves on its next input. If active work delays the move, the group receives one waiting notice naming the destination. Stop cancels the waiting message and lets existing work continue. Removing the binding or choosing local returns to the chat’s local workspace. Files stay in each environment’s workspace. With owner environments configured, the host uses the owner’s dataDir or its default. If this changes the effective data directory, the CLI prints both paths on the operator’s stderr at startup. If the owner has already set dataDir, the notice identifies the active owner path and the ignored project path. If the owner has no pin and wants to keep using the previous store, set dataDir to its absolute path in owner settings and restart. Project settings and chat messages cannot choose an environment.

  5. In an embedded SDK Runtime, call await runtime.ready(), register createLarkChannelAdapter(options) via await runtime.registerChannel(...), and call await runtime.recover() (standalone CLI runs Lark natively under vela daemon).

Enablement and replies

  • chats lists the chat_ids that may use the bot. Every member of a listed chat has full access. A listed DM also works.
  • owners contains people’s open_ids. Their direct chats are always enabled, including when chats is empty. Being an owner does not enable a group they happen to speak in.
  • Every other group or DM is dropped before content parsing, per-message logging, disk writes, name/history lookup or model work. Restart after changing settings; there is no in-chat /enable command.
  • Empty chats produces one startup notice: only owners’ direct chats are enabled.
  • At the top level of enabled groups, supported human messages queue one evaluation each, with or without @ this bot; untagged messages that arrive while an evaluation is working share the next one (see Untagged top-level discussion and cost). Set readUntagged: false for mention-only top-level intake. Own/other bot events and events without a user sender type are dropped before content handling. In an owned topic, any member can reply without @. Vela resolves its bot open_id at startup; if that fails it logs a warning and ignores group messages until a successful restart. Owner DMs still work.
  • Group answers use im.message.reply on the triggering message id. DMs use im.message.create. Lark controls whether an already-threaded trigger receives a threaded reply.
  • A second top-level @ (or DM message) during an explicit-request run receives a Queue / Steer / Stop card. Queue is the default if nobody clicks. See Run controls. Other chats can still run concurrently.
  • Text and rich-text (post) messages become plain text, with mention markers removed. Image messages and img elements in posts go to the model as images; an image alone triggers a run in an enabled DM. Existing image normalization resizes or drops invalid images with a reason, and non-vision models receive the existing image placeholder. Images share the files’ 20MB limit: the download stops at the limit, an explicit request receives the too-large reply, passive input leaves an operator diagnostic, and the image does not reach the model. An oversized image in history keeps its [image] line instead of failing the context read.
  • Lark keeps the completed download in the chat’s private files/ directory. A local session receives [file: <name>, saved at <absolute path>] and can inspect it with read or bash. Redelivery after restart and forwarding to a topic reuse this file even if the service no longer has the original. The name combines the message ID with a sanitized, byte-limited filename. Lark downloads into a temporary file and renames it when complete. Files above 20MB are stopped and the partial file is removed. Explicit requests report download errors and passive input logs an operator diagnostic. A process interruption can leave a .part file, which is ignored on redelivery. There is no automatic cleanup or native PDF/document input. In a non-local session the model receives a path under ~/.vela/uploads/<sessionId>/ in the selected environment. Vela reuses an existing guest copy and writes a missing copy through a temporary file before publishing its path. A non-local fork or clone copies referenced uploads into its own cache. Within the same environment it preserves edits to the cached file. After a move to another environment it uses the canonical host copy. Older transcripts can contain a file path without a recorded upload source. To include that file in a non-local fork, redeliver the attachment to the parent session and fork at or after the new message.
  • Audio, video, stickers and merged forwards remain unsupported and receive a short reply saying text, images and files are supported, only in an enabled DM or when this bot is mentioned in an enabled group.
  • The last 1000 incoming message IDs suppress live duplicate delivery. Passive messages also reuse saved channel.input IDs when reopening the logical session; an already recorded input is not evaluated again.

Group workspaces, memory and tools

Each enabled group uses <dataDir>/channels/<channelSessionId("lark", chatId)>/ with workspace/, memory/ and the existing files/ attachment directory. The existing encoder keeps chat IDs path-safe; topic roots and physical session generations do not affect this folder. No files are moved or deleted. For local group sessions, relative file, search and bash calls and project instruction discovery use this group’s workspace/. For Docker sessions they use the named environment’s /workspace. A newly allocated workspace is empty. Clone the repository there if the group needs it. Workspace skills and templates come from the selected environment. Session storage and the chat’s canonical downloads stay on the host.

The channel and every topic in a group share its memory. The memory tool and /memory / /dream use that group’s store for changes. Global notes remain at <dataDir>/memory; group sessions may only read or search them with scope: "global". Other global actions fail clearly. Reads retain normal usage timestamp updates. The prompt shows a labeled group index and global index, each capped at 4,000 characters with truncation disclosed; note contents are read on demand. Local SDK/CLI sessions and owner DMs keep global memory. Each group has its own isolated Dream sequence cursor and consolidation logs in vela.db inside that group’s scope. After a reply settles, automatic dream runs at 20 pending turns or when a pending turn is older than 24 hours. It uses only that group’s evidence and never writes global memory. /memory shows the latest dream and pending inbox size; /dream runs the same isolated pass immediately. Set memory.dream to false in config.json to disable automatic runs. See memory for retention and audit details.

For example, "chats": ["oc_example_all", { "id": "oc_example_limited", "tools": ["read", "memory"] }] leaves the first group with the default tools and selects exact registered tool names for the second. Omit tools for the default tools; [] removes optional tools. Group sessions receive session_start, session_forward, session_list, session_read, wait_for_input, skip_reply, timers, subscriptions, and send_file, while DMs keep timers and omit group/topic handoff and background tools (bash refuses run_in_background). History search (lark_search_history) is an optional capability when selected. Without the memory tool, the memory prompt is omitted and its commands report that memory is unavailable. Malformed/duplicate chat entries fail daemon/adapter startup cleanly.

Background commands after a restart.

The directory records each hosted background job’s stable token, display id, command head and session generation before execution. A normal exit enters the existing conversation queue. Its job record is removed only after the result input and its token marker are saved; merely finishing the shell or accepting the queued input is not enough. If the process dies before that point, the result is unknown, even if the command may have completed.

At startup, only conversations with interrupted work or outstanding jobs are opened. After any interrupted turn, each lost job becomes an ordinary queued input: Background command bg-3 ended with a restart; its result is unknown. plus the command head. The agent replies in that conversation without a new human message. A saved marker reconciles a crash between input persistence and clearing the directory, so another startup does not append that notice again. background_stop and normal session close clear jobs; an interrupted run (Stop) leaves a job running and still delivers its result. A queued result in front of a !restart is answered by the session being replaced, and the fresh session never sees it. Service shutdown preserves outstanding jobs for the startup notice. Hostless CLI/SDK sessions keep their existing unknown-id behavior rather than gaining startup scanning.

This resumes notification, not an operating-system process. SIGKILL can leave an external command’s effects or child process uncertain. The directory and transcript are separate files, and remote reply delivery is separate again: one durable input does not promise unlimited exactly-once external delivery. Startup notices are messages, not changes to the cached system prompt.

A chat entry can also set model (provider/id) and thinkingLevel for its group session, plus topicModel and topicThinkingLevel for the group’s topics. A topic uses its own value when set, otherwise the group’s; a group without them uses the user’s model / thinkingLevel. DMs use the user defaults. Unknown thinking levels fail loading. A model name that does not resolve fails when its session opens, with the chat id in the error.

Current chat configuration is applied from the logical directory record before opening/resuming a session, including idle reopen, process recovery, topic handoff and the fresh physical ID created by !restart. A configured model or thinking level is applied again whenever the session opens, so a changed chat entry takes effect on resume. A mid-session /model or /thinking change survives a resume only for a value the chat entry does not configure. Restart retains the workspace, group notes and attachments. The per-group boolean readUntagged defaults to true.

Untagged top-level discussion and cost

"chats": ["oc_example", { "id": "oc_quiet", "readUntagged": false }] enables passive intake in the first group and retains mention-only top-level behavior in the second. The bot must have the approved/published im:message.group_msg permission and be a member of each group; changing this setting cannot grant platform access. Owned-topic replies keep their existing behavior in either mode.

Each supported human top-level message joins the group session’s queue. Passive inputs that queue while an evaluation is working are read together in the next evaluation, in arrival order and with their own sender and send time; there is no timer or debounce window, so input that arrives while no evaluation is working starts its own. One evaluation merges at most 400 KB of prepared text (the message text with its sender and time prefix). A larger flood keeps the newest inputs that fit and drops the rest with an operator log; the group gets one short notice per session, posted as a standalone message instead of a reply to a message in the flood, and later drops stay quiet. The limit keeps a merged prompt below the safe input size — without it, a rejected oversized turn stayed in the session history and every later @ in that group failed with the same error. A top-level group turn the context guard rejects before its first model request — for example when the session’s stored history is already too large — is dropped as a whole: the channel keeps the earlier conversation and the next message runs normally, while the failed input is not retried. Topics and DMs keep their existing failure behavior. Silent passive failures stay operator-only; an explicit @ receives the failure reply. An explicit @ always runs separately and never joins a passive evaluation. Passive input gets no reaction on receipt, progress/control card or separate content log: each input in the evaluation gets OnIt only once it starts writing an answer, the newest input’s reaction becomes DONE after delivery or CrossMark on failure or Stop, and the other inputs’ reactions are removed. A silent evaluation, an empty answer or a topic handoff removes every reaction and leaves nothing behind. Text/post, images and files use the existing normalization and attachment store. Unsupported passive message types are ignored; preparation and model failures go to operator diagnostics. Command-looking text, including /commands, is attributed discussion and does not execute a command. Passive evaluations use their stored conversation rather than repeatedly fetching recent group history.

The channel prompt normally asks the model to call skip_reply and end the run. That mandatory channel control covers the whole evaluation and suppresses its final text and reply event, even when several inputs were read; the tool call in session JSONL is the only durable silent decision. A reply goes to the newest input the evaluation read, the message it answers. Useful short answers can be sent once; task work can be handed off through the existing topic controls. An explicit @ still receives normal acknowledgement feedback. If it arrives during a passive evaluation, it queues as its own run, without a Steer control that could merge it into a silent decision. Controls for existing explicit-request runs stay unchanged. A model may make multiple requests for tools, retries or compaction during one evaluation; “one evaluation” is not a one-request spending limit.

Normalized attributed input and model/tool responses live in the existing session JSONL. channel.input records the service message ID, passive flag and receipt timestamp; the directory adds the passive flag to the existing pending ID and active run metadata. There is no second ID registry or persisted silent-disposition field. Attachments stay under the group’s files/, and usage stays in the existing ledger. On restart, active/queued passive work is dropped with an operator log, without a late unsolicited reply, resend notice or model call. Every input an evaluation read has its own channel.input marker, so all of its IDs remain recognized. New events wait behind the startup recovery snapshot; @ and topic recovery stay unchanged.

Silence still costs model calls. Use actual recorded input/output/cache tokens and the configured rates, including control-tool continuation, tool loops and compaction. For illustration only, 1,000 requests/day × (8,000 input tokens × $3/million + 50 output tokens × $15/million) = $24.75/day, before extra requests, tools or compaction and without cache discounts. These are hypothetical rates, not a current provider quote or measured spend. Compared with 100 mention-triggered requests under the same assumptions, that is about 10×; growing context can cost more. There is no spend cap. The existing topic !status includes group-wide recorded usage, with unknown prices disclosed.

Scheduled wake-ups (M4)

The channel runtime persists routines in $VELA_DIR/vela.db (timers table) and delivers one-off or daily/selected-weekday wake-ups to their original logical session, including after !restart. lark.timezone selects one IANA deployment timezone, defaulting to the process timezone; invalid configuration rejects channel startup. Recurring schedules retain local wall time: a DST gap shifts forward by its length and a repeated time uses its first occurrence. Changing the deployment timezone changes recurring local-time schedules, while one-off UTC instants stay fixed.

Ask Vela in a topic, at group top level or in an owner DM to create a reminder. The mandatory timers tool remains available even with a group’s tools: []. Its create action accepts a message and either { "at": "2026-11-02T09:00" } (a future deployment-local date/time, no offset) or { "time": "09:00", "days": ["mon", "tue", "wed", "thu", "fri"] } (omit days for daily). Local one-offs use the same DST rules as recurring times and are saved as UTC instants. The tool returns the saved schedule, timezone, logical target, creator and next local run for the model’s confirmation; for a DST gap this shows the shifted time. Invalid dates, past one-offs, invalid/empty weekday sets and more than 20 routines in a chat are rejected.

The edit action takes an id from list plus a new message and/or schedule, and rewrites that routine in place: the id, creator, creation time, channel/chat and logical target stay, and the returned entry carries the new schedule and next local run. Validation is the same as create; the 20-per-chat cap is a creation limit and does not apply. An id outside the calling chat, including another chat’s or channel’s id, returns edited: false, and the model must tell the user instead of claiming a change. Because the same record is rewritten, !timers, list, nextRun and a restart all show the new values under the same id.

Send exactly !timers at group top level, in an owned topic or in a DM, with or without an @. It lists all active timers in that chat: id, schedule, deployment timezone, logical target, creator and next local run. It makes no model call or user transcript entry and neither stops nor steers current work. This exact command also works when readUntagged: false; other unmentioned top-level discussion stays ignored. An unmentioned command in an unowned topic remains ignored without writes. Ask Vela to edit or cancel an id (timers actions edit and cancel); any member of the enabled chat can change or cancel another creator’s reminder, while an edit keeps the original creator’s attribution. Cancellation is idempotent; both actions are confined to the calling chat. Tool arguments cannot select another chat, creator or target, and ordinary SDK sessions cannot manage channel routines.

Wake-ups queue behind current work and never steer it. Topic runs reply to the topic root; top-level group runs first post one short announcement with the reminder, creator and any late notice, then use that real message as their reply/topic anchor; DMs use their existing send path. Results mention the routine’s creator. Custom Lark transports may keep send(): Promise<void>, but top-level routines require a returned { messageId, createTime } receipt and otherwise skip with an operator diagnostic. Disabled chats retain their routines and log once per startup without running them.

The saved occurrence’s scheduled time is the lastFiredAt watermark. Startup catches up only the latest missed occurrence, once, with a late notice. A failed enqueue/save keeps the watermark unchanged and arms only the next future occurrence; a failed one-off therefore waits until a later startup for another attempt. Cancelling prevents future submissions and does not recall an input already submitted to the gateway.

A schedule edit records a scheduleUpdatedAt watermark next to the new schedule. The next run is the next future occurrence of the new schedule; occurrences at or before the edit belong to the previous schedule and are not delivered late, so a time that already passed today means tomorrow. The lastFiredAt watermark still prevents re-delivering an occurrence that already ran. A message-only edit leaves the schedule and both watermarks unchanged. Both watermarks are persisted, so a restart keeps the edited schedule and does not catch up an occurrence that predates the edit. An edit does not recall an occurrence already submitted to the gateway; when that earlier occurrence confirms, it leaves the edited record alone instead of removing a newly chosen one-off.

Recovery is at least once from the saved input; session markers align the routine watermark after restart. Session persistence, routine-file replacement and remote delivery are not one transaction, so crashes can repeat work or delivery and there is no end-to-end exactly-once guarantee.

Topics

An @ inside a Lark topic opens its own session, identified by channel, chat and root message ID. Different topics run concurrently without sharing transcripts; top-level messages and DMs retain one session per chat. Topics keep separate transcripts while sharing their group workspace and memory. Different groups use different default workspace and memory directories.

A topic is owned when its session exists. After restart or idle eviction, the gateway opens and resumes it through its per-session queue before preparing an untagged input. An unknown untagged topic is ignored without resolving names, reading platform history, downloading attachments or creating an empty session. Existing history is loaded once for the next run; interrupted work does not resume automatically.

An untagged reply during a topic run automatically steers it without a Queue/Steer card. An idle reply starts the next run. Each run posts one shared progress card with Stop inside its topic. Stop aborts only that run, retains its session history and expires the callback; the next message continues the conversation. If the Stop card cannot be sent, Vela reports the cause and does not start the task.

The first @ entering a topic without a saved session reads every page of history using container_id_type: thread and the platform thread_id, in chronological order. The root message ID is used for session identity, not as the history container. Text/post content includes earlier bot answers, excluding the triggering message, messages newer than its timestamp, recalled messages and control cards. Other messages at the same timestamp remain included. Historical file content is not downloaded; at most four historical images are attached. A failed topic-history read is reported instead of running with silently incomplete context. Once the topic is owned, both explicit @ mentions and untagged replies use the existing session context without rereading topic history.

A new topic’s first run receives one hidden channel.topic message before its input (display: false, no turn triggered): Topic context from Vela (not from a person), as this topic starts:, then the topic’s title and root ID with the requester’s name, then the shared group workspace path with up to 30 top-level entries, or (empty) when it has none. Its brief arrives as <name>: <brief>, followed by [<name>'s original message, verbatim] and the triggering text when the message had one.

Channel dispatch

The top-level group session answers short questions directly: answerable from the visible conversation, in one reply, or by running a quick one-step command itself. Its bash tool tells the model that a command which may keep running starts with run_in_background there, so the conversation stays available, and anything longer — investigation, multi-step execution, tool-based work or a longer exchange — becomes a topic. A background command’s exit joins the group’s own queue, so it is answered in the main timeline as a reply to the person’s last message, with the usual anchor, reaction and Stop. In addition to its existing tools, it has the Lark dispatch tools below. Every group session — the top level and each topic — also has two platform-neutral hand-off tools. A topic session can list and read topics and hand work off, but only the group session starts or forwards a topic; a DM has none of these.

  • session_start({ title, brief }) replies under the current message with reply_in_thread: true, posting only the title — one line of at most 40 characters that names the task, with no requirements, method or status — then independently enqueues the brief in its topic session with the sender’s name. If multiple topics are started from the same triggering message (or that message already anchors a topic), each additional topic opens under a fresh top-level group message so every child gets its own thread. It returns the platform receipt without waiting for task completion, so another top-level question can run while the topic works. The brief is the topic session’s whole input: it must include the goal and the facts it needs, with no plan or method in either text. The topic list shows the title as the topic’s task label. The triggering message’s own images are carried over, excluding images from group history. The channel transcript is not copied into the brief, and a successful handoff suppresses the channel’s duplicate final reply.
  • session_forward({ session_id, text }) forwards a request or follow-up message to an observed owned topic in the same group, then explicitly enqueues its content with the original sender’s name. It does not depend on receiving the bot’s forwarded message as an event. A running target is steered; an idle target starts its next run.
  • session_list() reports recorded owned sessions and topics, their kind, name (topic title when set), waitingReason, last activity (updatedAt), and state (idle, running, waiting_human, or stopped) from the SQLite directory (vela.db). The list survives process restarts; topics from before M2 join when they next receive an admitted message. Its result states when directory coverage began and warns that earlier topics may exist: an empty list does not mean there are no tasks. Persistent session ownership remains independent of this directory. When a follow-up refers to earlier work absent from the list, the channel prompt requires a notice that the earlier topic could not be found, at the beginning of the new topic entry, instead of silently duplicating it.
  • session_read({ session_id }) reads the visible messages of another owned topic in the same group, in order, to see what it asked, decided or delivered. It returns the target’s sessionId, name, state, and messages, capped at 20,000 serialized result characters. Notes sent with session_message are not visible messages and are not included. An unknown or unowned sessionId is an error.
  • wait_for_input({ reason }) records a required human decision in the existing topic directory. The model must then ask that question and end its run. Waiting becomes visible after successful answer delivery; live running/queued work takes precedence. It survives process restart without resuming completed work. The next accepted topic message clears waiting, and Stop/Restart clears the reason. Inactivity alone never implies waiting.

Each Lark dispatch tool validates the caller’s active group context; forwarding rejects targets outside that group.

A Stop selected while a create/forward API request is pending cannot enqueue topic work from its eventual receipt. Lark may already have accepted the remote message; Stop does not retract that message.

Platform-neutral hand-off uses session_message between sessions of one project/group:

  • session_message({ target: sessionId, text }) (for a peer topic) sends a note to another owned topic in the same group, for a result it is waiting for or a fact it needs. text is at most 4,000 characters. Nothing is posted in the chat. The note is queued like other input, never steered, and delivered only to a topic session that already exists. Its text begins Message from Vela's topic "<title>" (root_id …) (not from a person):, or Message from Vela's group session (not from a person): from the top level. target must be an owned topic in the same group; an unknown id is an error that points at the topic list, and a topic cannot message itself. It returns { queued: true, target: { task, state } } without waiting for the target’s run.
  • session_message({ target: 'hub', text }) sends a note from a topic to its hub/group session, for work outside the topic or when the requester must be told outside it. text is at most 4,000 characters. Nothing is posted in the chat; the note is queued and never steered, and the group session decides whether to reply in the group, pass it to another topic or only note it. It begins Message from Vela's topic "<title>" (root_id …) (not from a person), about a request from <name>:. Only a child session can message 'hub'.

A note is one hop after a person’s input. At most three notes may follow it (A → B → C → D); the next is refused with Hand-off chain limit reached: tell the requester in your reply instead. A note never answers a person’s pending decision: it leaves waitingReason and the waiting state unchanged. A note still queued when Vela restarts is dropped. A note whose run had started but had not reached the session is dropped with an operator log, and the previous answer is not resent.

Status lines run the other way. A topic run that ends records one line for its group session without a model call: topic "<title>" (root_id …) finished: <answer>, failed: <reason>, was stopped, or is waiting for <name>: <reason>. The answer is clipped to 200 characters on one line. A topic’s note to another topic also records topic "<title>" (root_id …) → topic "<title>" (root_id …): <text>. Top-level, DM and passive runs record none.

The lines are stored in $VELA_DIR/vela.db (inbox_events), at most 20 per group; older lines are dropped. Before the group session’s next run they are delivered cleanly, without triggering a turn on their own. A topic finishing therefore starts no model work: the group session sees the lines on its next run.

Searching older group messages

lark_search_history({ keyword?, start_time?, end_time? }) is available in channel and topic sessions, scoped to their own enabled group via the logical session binding, including after !restart. There is no model-supplied chat ID. Topic briefs remain the only copied channel context; a topic can use this tool to retrieve missing facts. It is denied in DMs and remains subject to the group’s optional tool selection.

The adapter uses client.im.message.list with container_id_type=chat, newest first. Keyword matching is case-insensitive literal matching performed locally on text, posts and attachment descriptions; it does not download attachments, search their contents, or return deleted messages. Omit the keyword for a time-range listing. Times are ISO 8601 with a timezone; the default range is the last seven days. Request boundaries are converted to seconds; returned scannedRange and match createTime values are ISO 8601 UTC timestamps. Matches retain the platform senderType; matchCounts gives exact returned totals for user, app and unknown sender types, not totals for all scanned messages or the whole group.

Each call requests 50 items per page, at most 5 pages / 250 scanned messages, and returns at most 20 matches / 20,000 serialized result characters. Results report requested and scanned ranges, the scanned count, and truncated. The scan stops when any bound is reached; a message that would exceed the character budget is omitted. There is no continuation token: call again with an earlier end_time. This is bounded recall, not exhaustive search; messages sharing a boundary second may overlap or be skipped. In ordinary groups, chat listing includes topic roots, not all thread replies, which the result also discloses. An absent thread reply does not establish indexing delay. Permission/API errors remain tool errors, not empty successful searches.

History search needs the same group history permissions listed below and bot access to the group. Custom LarkTransport implementations must provide searchMessages(chatId, { startTime, endTime, limit, pageToken }), returning { items, pageToken? }; pagination tokens stay inside one tool invocation.

The topic prompt asks the model to respond to the latest message and treat results already given as delivered, without repeating them unless asked. Completion notices are treated as acknowledgments of the delivered result, with a brief reply rather than a restatement of the task, result or constraints. Progress narration stays in the automatic display; the model gives the result when done, or asks one decision question and ends the run when blocked.

The topic list’s task is its original title. Follow-up requests can change what the topic is working on; waitingReason records the current required input. A difference between that reason and the original title alone does not indicate corrupted directory data.

Task feedback

An admitted @ or topic message receives an OnIt reaction before name/history/attachment preparation and model work. Unknown untagged topics are checked for ownership first. The reaction becomes DONE after the result is sent, or CrossMark on failure or Stop (the card explicitly says “Stopped”). A channel-to-topic handoff keeps the original reaction pending until the topic finishes; accepted steers finish with that run. A passive group input follows the same outcomes from the first non-empty assistant text delta instead of admission; silence, an empty answer or a topic handoff removes its marker with nothing added, so a run that writes text before going silent can show OnIt briefly.

The same Stop card is updated in place with the current stage, elapsed time and up to eight top-level tool summaries. A summary uses the first string among command, path, query and pattern, sanitizes it to one line and caps it at 60 characters. Credential-marked input (including token/password fields in the selected text, environment assignments, authentication flags and URL credentials) is omitted. Nested calls do not displace their parent. Thinking, arbitrary argument fields and raw logs are not displayed. Updates are serialized and coalesced at no more than four per second, with a 15-second heartbeat during quiet work. At completion, the gateway unsubscribes, stops the heartbeat and drains in-flight updates before sending one result or decision question that @-mentions the run’s original requester. It then finalizes the same card and reactions with the delivery outcome. Another member’s steer does not replace that requester. Progress updates contain no mentions or separate timeline messages.

A failed live progress update is retried after 1, 2, 4 and 8 seconds, so a transient network error does not freeze the card for the rest of the run; five consecutive failures end the attempts. The final card is written after the answer and the outcome reaction, so a dead card cannot hold DONE back, and it gets its own two retries (1 and 2 seconds). One input gets one report, however many of its writes fail: the first live failure says the task keeps running and its answer is still delivered, and a final write that stays unwritten is reported as the task having ended with only the card affected only when nothing was reported earlier. Neither is a stopped turn: it is logged as Feedback failed and the event carries source: 'feedback', while an admission or preparation failure remains an ordinary task failure. If the task succeeds and its result is delivered, its reaction becomes DONE even when the progress card could not be updated. A failed result send emits channel_error, records an operator log, marks the reaction CrossMark and changes the terminal card to Failed when card updates are available; Vela does not claim delivery or move the result to the main timeline. The first-reaction ≤2-second target and actual notification/rendering behavior require acceptance in a real Lark group; offline tests establish ordering, not platform latency.

For delayed inputs, temporarily enable the existing VELA_DEBUG=1 logging. Accepted Lark inputs log their service message ID, service creation time (milliseconds) and local receipt time (UTC). The gateway logs admission, dequeue, preparation start, acknowledgement completion, preparation completion and prompt submission for that ID. Compare these timestamps with the saved session input and model/tool events to separate delivery, queue, preparation and model latency; prompt submission is not a provider-start timestamp. Logs omit message text, group IDs, sender IDs and credentials. Interactive CLI debug output goes to $VELA_DIR/debug.log; other modes use stderr.

Run controls

For top-level channel sessions and DMs, when a new text, post, image or file message arrives during the chat’s run, Vela sends an interactive Card 2.0 (schema: "2.0") in reply to that message (a normal send for DMs). Its buttons use column_set / column / button and behaviors: [{ type: "callback", value }], matching the subscribed card.action.trigger event. The Lark SDK’s card troubleshooting notes describe the v1-payload mismatch that can prevent clicks from reaching that callback.

  • Queue (default): wait for the current run and reply, then answer the new message separately. Doing nothing has the same behavior; there is no extra waiting period.
  • Steer: prepare the new message with its sender name and group context, then pass it to the current task with streamingBehavior: 'steer'. History excludes the active trigger and messages older than its create_time, since the session already has that context. Other messages at the same millisecond are retained; timestamps alone cannot order them. The current run sends one final reply to its original trigger, covering the original and steered inputs. The steered message does not start its own answer.
  • Stop: abort the current run, discard this card’s queued input and pending SDK inputs belonging to that run, and send Stopped the current run. to this card’s triggering message. Other messages waiting in the gateway’s default queue remain queued.

Any member of an enabled chat may use its controls, matching the shared session. In a DM enabled only through owners, the operator must be one of those owners. A callback must include the matching chat, an operator open_id, a recognized action and the opaque token issued for that card. The first valid choice wins. Repeated clicks and controls from a completed run or a previous process are ignored with an informational toast; they cannot affect a later run. Cards expire when Stop is accepted or the run settles.

The callback reserves the choice and returns its toast immediately; it does not wait for name/history APIs, model work or abort cleanup. If the run finishes during Steer preparation, the message remains in its default queue. A failed card send is logged and also leaves the message queued. Any message from this app, including a control card, bounds the subsequent group-history scan.

Names and group context

Each incoming user message is prefixed with the sender’s display name. In an enabled group, a top-level message also starts with its send time in the local time of the machine running Vela ([10:32] Alice: …), whether it mentions the bot or arrives as passive chatter. Vela uses contact.user.get with user_id_type: open_id; names and fallback results are cached in memory (up to 1000 entries). If the contact API is unavailable, the name is empty, or the user is outside the app’s contact data scope, the open_id is used instead. Restarting clears this cache. Explicit requests with a leading slash are passed through verbatim to preserve extension commands, /skill: and prompt-template expansion; they skip name/context wrapping. Ordinary chat questions keep both.

For a top-level group @, after any earlier queued reply finishes, Vela fetches at most 50 recent chat-history messages. It takes text/post messages and attachment placeholders after this bot’s last reply and before the triggering question, excludes the question itself and recalled messages, and injects them in chronological order into the same user message:

[Chat since last reply]
[10:31] Alice: Let's use blue.
[10:32] Bob: Agreed.

[Question]
[10:33] Alice: What should we do next?

Each line starts with the message’s send time in the local time of the machine running Vela (HH:MM). The history window also supplies at most the four most recent images (including post images). In a group, send an image first, then @ the bot in a text message. Historical files appear only as [file: <name>] and are not downloaded.

With no earlier text, the input is just [10:33] Alice: What should we do next?. If history cannot be fetched, Vela logs the failure and answers the named question alone. It does not claim the missing context was read. The API query is bounded to one page; older messages beyond that page are omitted. Lark’s chat-history endpoint returns thread roots, not all replies inside separate threads.

With appId configured, history stops at any message sent by this application’s app_id, including interactive cards and other message types. That boundary works after process restart without in-memory reply state. Opening a topic for a top-level message, or forwarding that message into a topic, also stops the scan at the trigger. Vela remembers the trigger’s create time for this process only, because the in-topic reply never appears in the group list. Messages from other people after that trigger still appear. Restart drops the remembered trigger and falls back to an own-app message in the list. Messages from a different bot are not this app’s boundary. This also applies to control cards, so the bounded scan may omit earlier discussion; use history search when needed.

Custom createLarkChannelAdapter({ transport }) integrations may omit appId. In that case only, Vela retains successful top-level reply receipts in memory and stops at the reply’s message ID or timestamp. That fallback preserves the current-process boundary, including when the reply is absent from the returned history, but cannot identify older own-app messages after a process restart. Supply appId alongside the custom transport for the restart-safe boundary; no app secret is needed with a custom transport.

Lark permissions

Use application (tenant_access_token) permissions. The bot must be enabled/published, be in the group, and have permission to speak. New permissions and contact data-scope changes must be published/approved in Lark; Vela does not change them.

  • Receive owner DMs: im:message.p2p_msg:readonly; receive group @ events: im:message.group_at_msg:readonly. Receiving untagged human replies in owned topics requires im:message.group_msg (receive event). This also enables default-on top-level passive intake. im:message.group_msg receives human messages; do not request bot-inclusive im:message.group_msg.include_bot:read. The adapter independently checks event sender_type: user and its own bot ID; Lark history uses sender_type: app instead. Custom offline transports must supply the event sender type too.
  • Read group history: im:message.group_msg plus one of im:message or im:message:readonly (legacy im:message.history:readonly also works). Mention-only event permission does not provide this history access.
  • Resolve display names: contact:contact.base:readonly for the contact API and contact:user.base:readonly for name fields. Include the relevant people in the app’s contact data scope. No email/phone access is needed. Existing broader legacy contact permissions may already cover these fields.
  • Send replies, including interactive control cards (msg_type: interactive): im:message:send_as_bot or im:message (legacy im:message:send also works). No CardKit API or additional card-management permission is used. The separate card.action.trigger callback subscription above is required for buttons to work; message reception alone does not deliver clicks.
  • Create topics and forward into topics: im:message:send_as_bot covers both. Forwarding uses receive_id_type: thread_id and the platform thread ID; the root message ID is only the session identity.
  • Add/delete reactions: im:message.reactions:write_only. Use the documented OnIt, DONE and CrossMark values, not an invented EYES value.
  • Update shared cards: the existing im:message:send_as_bot permission qualifies; im:message:update is an alternative, not an additional required grant. Initial and updated cards must both set config.update_multi: true. The API permits 5 updates/second per message, cards up to 30 KB and updates within 14 days. Sending replies also has a group-wide 5 QPS limit shared by bots; API failures remain visible.
  • Download message images and files: im:resource. The bot must be in the same chat as the message.
  • Identify this bot: no additional API permission beyond enabled bot capability and the app’s tenant token.

GitHub webhook setup

Use vela setup github owner/repo --url https://your-tunnel-host to connect repository events to Vela. Pass multiple owner/repo arguments for several repositories. Omit repositories or --url only in an interactive terminal, where setup asks for them; Escape cancels before saving. --url is a public HTTPS origin, without a path, query or fragment. Vela appends /events/github.

  1. Configure at least one trusted channel, such as Lark above, and arrange a tunnel to http://127.0.0.1:8787 (or your configured fixed receiver port from 1 to 65535; setup rejects ephemeral port 0). See tunnel deployment. Setup does not start or provision a tunnel.
  2. Install GitHub CLI 2.57 or newer and run gh auth login --hostname github.com with an account allowed to write repository webhooks. Setup checks only the active account, so an expired inactive account does not block it. Use gh auth switch --hostname github.com to select the account that will manage hooks.
  3. Run the setup command. It merges and lowercases the repository allowlist under webhooks.github in user config.json, saves it with mode 0600, and creates or updates each repository’s matching webhook using gh. It preserves unrelated settings and an existing secret. A new secret is generated and stored directly in these settings, not in auth.json; an existing $VAR reference is preserved and must resolve in the setup environment. Keep settings private. Host webhook settings cannot be overridden by project config.
  4. Restart or reload vela daemon (vela daemon hosts webhooks directly with automatic config.json / SIGHUP reload for Runtime SQLite subscriptions). With GitHub ingress configured, ask Vela in the group to subscribe it to the repository Issue feed once; the key is github:owner/repo#issues. The feed stays silent by default. To wake for any of several labels, set issueLabels to an array. To wake only when both labels are present (for example, Vela’s assigned and approved work), use "issueLabels": { "all": ["to:vela", "status:ready"] }. This filters opens, closes, ordinary Issue comments and meaningful label applications; adding an unrelated label does not trigger a wake. A topic is guided to subscribe to the PR it opens or takes over instead of repeatedly polling; for a PR the topic did not open or take over, ask Vela in that topic to watch it. The PR key is github:owner/repo#pr/1 (GitHub repository matching is case-insensitive), ordinary Issue comments never reach PR topics, and PR comments are not duplicated into the group feed.
  5. Open the repository’s Settings → Webhooks → Recent deliveries and check delivery to your running receiver. Successful setup verifies hook configuration, not public reachability or topic execution.

Rerunning setup with the same payload URL updates the existing hook, including its event list, instead of creating another. A changed URL creates a separate hook; remove obsolete hooks manually. Multiple existing hooks at the same URL require manual resolution. Setup never deletes hooks or subscriptions.

If gh is unavailable or not logged in, local settings are still saved and setup prints manual webhook values, including the secret. Paste that secret only into GitHub’s Secret field and avoid sharing the terminal output. Setup exits 1 until remote configuration succeeds; repository/API failures also exit 1 and retain local settings. A failed request may already have changed GitHub: check the hook or rerun to list it before updating. Non-interactive missing input exits 2, and cancellation exits 0 without changes.

For supported events, signatures, allowlists, subscriptions and delivery limits, see GitHub webhooks.

When an agent run fails, the Task failed: reply keeps the original error text and appends the shared failure-kind hint. This does not change retry policy, passive-message suppression or cancellation replies.

Interrupted-turn recovery

After a restart, an admitted, saved running turn continues on its existing branch. Completed steps are not rewound to the original input. Each missing tool result is reconciled and saved before asking the model again: a journaled final model response is restored once; an unsafe or unidentifiable interrupted call reports that it may have partially run. Native results saved before a post-hook response is finalized remain evidence, but do not justify fabricating success or rerunning the tool.

Only tools whose recorded and current replay policy are both safe may replay, in the same execution location with the same input. Built-in reads, listing and search opt in; bash, writes, edits, outbound messages and extensions default to unsafe. The fifth consecutive interruption ends automatic replay of that logical tool call. This prevents executor-level repeats, not a model issuing a new similar call; the unknown-result message instructs it to verify effects first. Recovery changes conversation history, not the system prompt. An unfinished legacy journal call without any saved assistant anchor cannot be reliably assigned to a branch; recovery stops without changing that evidence or calling the model, rather than guessing its outcome.

An unsaved incoming message still requires resubmission. A final answer already saved before failed delivery uses the existing delivery recovery path, not a new model request. This is not exactly-once external delivery. Lark final-reply deduplication is described below. Outstanding hosted background jobs are discovered at startup as described above.

Shutdown and recovery

On the first SIGTERM, SIGINT or SIGHUP, a graceful channel host stops admission immediately and allows already-running tools to finish and persist their results. It does not start another model request, queued tool or queued user turn while draining. An interrupted channel turn remains recoverable at the next start with the same data directory; completed tool results are retained rather than replayed. Explicit Stop remains cancellation.

The entire shutdown has a 30-second cap, including cleanup hooks and transports. At the cap, the daemon logs the timeout, requests cancellation of active tools and user bash, then exits with code 143. Uncooperative extensions and remote effects cannot be guaranteed to stop; their last durable records are reconciled as interrupted on restart. A second shutdown signal exits immediately. SIGKILL bypasses cleanup and uses the same durable recovery. Vela does not resume operating-system processes or promise exactly-once external effects. Background commands are stopped during ordinary session shutdown. A channel retains outstanding job identities across process shutdown and delivers a queued restart notice on the next startup, without waiting for another person to write.

Runtime dispose() stops registered channels, aborts active runs, drains pending persistence, and closes vela.db.

Lark delivery after a restart

Final model replies, session_start topic titles, forwarded messages and files are written to the durable outbox table in vela.db before calling Lark. Each outbox row carries a stable outboxId and sends deterministic data.uuid idempotency keys on Lark create, reply, topic-start, forward and file-reply requests.

  • Failed delivery attempts retry with exponential backoff up to 5 recorded failures (status = 'failed').
  • On startup, recoverStaleSending() returns any abandoned sending row (whose lease owner is no longer live) back to pending without checking how much time elapsed. Because Lark’s uuid deduplication window is bounded (one hour), an acknowledged send whose receipt was lost before restart is deduplicated within that window, whereas restarting after the provider window expires can send a duplicate.
  • Initial progress card creation, live progress updates, and external-event announcements are outside the outbox and are not retried across restarts. Once a topic progress card is sent, its card reference is persisted in vela.db (kv_meta) so startup recovery or settled outbox delivery can patch the card (and its reaction) to its terminal state after a restart. A fake-provider test checks the runtime protocol, not the live service’s deduplication window.