Merged 7 separate migrations (0095-0101) into one:
- tasks, briefs, task_comments, task_dependencies, task_documents, task_topics tables
- All fields including sort_order, resolved_action/comment, review fields
- Idempotent CREATE TABLE IF NOT EXISTS, DROP/ADD CONSTRAINT, CREATE INDEX IF NOT EXISTS
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
topic auto review workflow
topic handoff workflow
finish run topic and brief workflow
support task tool
improve task schema
update
✨ feat: add onComplete hook to task.run for completion callbacks
When agent execution completes, the hook:
- Updates task heartbeat
- Creates a result Brief (on success) with assistant content summary
- Creates an error Brief (on failure) with error message
- Supports both local (handler) and production (webhook) modes
Uses the new Agent Runtime Hooks system instead of raw stepCallbacks.
LOBE-6160 LOBE-6208
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
✨ feat: add Review system — LLM-as-Judge automated review
Task review uses an independent LLM call to evaluate topic output
quality against configurable criteria with pass/fail thresholds.
- TaskReviewService: structured LLM review via generateObject,
auto-resolves model/provider from user's system agent defaults
- Model: getReviewConfig, updateReviewConfig on TaskModel
- Router: getReview, updateReview, runReview procedures
- CLI: `task review set/view/run` commands
- Auto-creates Brief with review results
LOBE-6165
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
✨ feat: add TaskScheduler, multi-topic execution, and handoff context
- TaskScheduler: interface + Local implementation (setTimeout-based),
following QueueService dual-mode pattern
- Multi-topic execution: `task run --topics N --delay S` runs N topics
in sequence with optional delay between them
- Handoff context: buildTaskPrompt() queries previous topics by
metadata.taskId and injects handoff summaries into the next topic's
prompt (sliding window: latest full, older summaries only)
- Heartbeat auto-update between topics
LOBE-6161
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
✨ feat: add Heartbeat watchdog + heartbeat CLI
Watchdog scans running tasks with expired heartbeats, marks them as
failed, and creates urgent error Briefs. Heartbeat CLI allows manual
heartbeat reporting for testing.
- Model: refactored to use Drizzle operators (isNull, isNotNull, ne)
instead of raw SQL where possible; fixed findStuckTasks to skip
tasks without heartbeat data
- Router: heartbeat (manual report), watchdog (scan + fail + brief)
- Router: updateSchema now includes heartbeatInterval, heartbeatTimeout
- CLI: `task heartbeat <id>`, `task watchdog`, `task edit` with
--heartbeat-timeout, --heartbeat-interval, --description
LOBE-6161
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
♻️ refactor: move CheckpointConfig to @lobechat/types
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
✨ feat: add task run — trigger agent execution for tasks
Task.run creates a topic, triggers AiAgentService.execAgent with task
context, and streams results via SSE. Supports both agentId and slug.
- Service: added taskId to ExecAgentParams, included in topic metadata
- Router: task.run procedure — resolves agent, builds prompt, calls execAgent,
updates topic count and heartbeat
- CLI: `task run <id>` command with SSE streaming, --prompt, --verbose
LOBE-6160
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
✨ feat: add Checkpoint system for task review gates
Checkpoint allows configuring pause points in task execution flow.
Supports beforeIds (pause before subtask starts) and afterIds (pause
after subtask completes) on parent tasks.
- Model: CheckpointConfig type, getCheckpointConfig, updateCheckpointConfig,
shouldPauseBeforeStart, shouldPauseAfterComplete
- Router: getCheckpoint, updateCheckpoint procedures; integrated with
updateStatus for automatic checkpoint triggering
- CLI: `task checkpoint view/set` commands with --before, --after,
--topic-before, --topic-after, --on-agent-request options
- Tests: 3 new checkpoint tests (37 total)
LOBE-6162
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
✨ feat: add dependency unlocking on task completion
When a task completes, automatically check and unlock blocked tasks
whose dependencies are all satisfied (backlog → running). Also notify
when all subtasks of a parent are completed.
- Model: getUnlockedTasks, areAllSubtasksCompleted (Drizzle, no raw SQL)
- Router: updateStatus hook triggers unlocking on completion
- CLI: shows unlocked tasks and parent completion notification
- Tests: 3 new tests (34 total)
LOBE-6164
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
✨ feat: add Brief system — schema, model, router, CLI
Brief is a universal Agent-to-User reporting mechanism, not limited to
Tasks. CronJobs, Agents, and future systems can all produce Briefs.
- Schema: briefs table with polymorphic source (taskId, cronJobId, agentId)
- Model: BriefModel with CRUD, listUnresolved (Daily Brief), markRead, resolve
- Router: TRPC brief router with taskId identifier resolution
- CLI: `lh brief` command (list/view/read/resolve)
- Tests: 11 model tests
- Migration: 0096_add_briefs_table.sql
LOBE-6163
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
✨ feat: add Task system — schema, model, router, CLI
Implement the foundational Task system for managing long-running,
multi-topic agent tasks with subtask trees and dependency chains.
- Schema: tasks, task_dependencies, task_documents tables
- Model: TaskModel with CRUD, tree queries, heartbeat, dependencies, document pinning
- Router: TRPC task router with identifier/id resolution
- CLI: `lh task` command (list/view/create/edit/delete/start/pause/resume/complete/cancel/tree/dep)
- Tests: 31 model tests
- Migration: 0095_add_task_tables.sql
LOBE-6036 LOBE-6054
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Allow Claude Code to push branches and create PRs by upgrading
contents/pull-requests/issues permissions from read to write,
and adding git/gh to allowed tools.
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* ✨ feat: add Agent Runtime Hooks — external lifecycle hook system
Hooks are registered once and automatically adapt to runtime mode:
- Local: handler functions called directly (in-process)
- Production: webhook configs persisted to Redis, delivered via HTTP/QStash
- HookDispatcher: register, dispatch, serialize hooks per operationId
- AgentHook type: id, type (beforeStep/afterStep/onComplete/onError),
handler function, optional webhook config
- Integrated into AgentRuntimeService.createOperation + executeStep
- Hooks persisted in AgentState.metadata._hooks for cross-request survival
- Dispatched at both normal completion and error paths
- Non-fatal: hook errors never affect main execution flow
LOBE-6208
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* ✅ test: add HookDispatcher unit tests (19 tests)
Tests cover:
- register/unregister/hasHooks
- Local mode dispatch: matching types, multiple handlers, error isolation
- Production mode dispatch: webhook delivery, body merging, mode isolation
- Serialization: getSerializedHooks filters webhook-only hooks
- All hook types: beforeStep, afterStep, onComplete, onError
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* ✨ feat: migrate SubAgent to hooks + add afterStep dispatch + finalState
- AgentHookEvent: added finalState field (local-mode only, stripped from webhooks)
- AgentRuntimeService: dispatch afterStep hooks alongside legacy callbacks
- AiAgentService: createThreadHooks() replaces createThreadMetadataCallbacks()
for SubAgent Thread execution — same behavior, using hooks API
- HookDispatcher: strip finalState from webhook payloads (too large)
LOBE-6208
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* 🐛 fix: add Vercel bypass header to QStash hook webhooks
Preserves x-vercel-protection-bypass header when delivering hook
webhooks via QStash, matching existing behavior in
AgentRuntimeService.deliverWebhook and libs/qstash.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* ✨ feat: migrate Eval Run to hooks + add finalState to AgentHookEvent
Eval Run now uses hooks API instead of raw completionWebhook:
- executeTrajectory: hook with local handler + webhook fallback
- executeThreadTrajectory: hook with local handler + webhook fallback
- Local mode now works for eval runs (previously production-only)
Also:
- AgentHookEvent: added finalState field (local-only, stripped from webhooks)
for consumers that need deep state access
LOBE-6208
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* 🐛 fix: dispatch beforeStep hooks + fix completion event payload fields
P1: Add hookDispatcher.dispatch('beforeStep') alongside legacy
onBeforeStep callback. All 4 hook types now dispatch correctly:
beforeStep, afterStep, onComplete, onError.
P2: Fix completion event payload to use actual AgentState fields
(state.cost.total, state.usage.llm.*, state.messages) instead of
non-existent state.session.* properties. Matches the field access
pattern in triggerCompletionWebhook.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* 🐛 fix: update eval test assertions for hooks migration + fix status type
- Test: update executeTrajectory assertion to expect hooks array
instead of completionWebhook object
- Fix: add fallback for event.status (string | undefined) when passing
to recordTrajectoryCompletion/recordThreadCompletion (status: string)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* 🐛 fix: update SubAgent test assertions for hooks migration
Update execGroupSubAgentTask tests to expect hooks array instead of
stepCallbacks object, matching the SubAgent → hooks migration.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fix(chat): strip forkedFromIdentifier before LLM API request
Fork & Chat stores forkedFromIdentifier in agent.params for DB lookup.
Spreading params into the chat payload forwarded it to Responses API,
causing strict providers (e.g. AiHubMix) to reject the request.
Remove the field in getChatCompletion alongside existing non-API keys.
Fixeslobehub/lobehub#13071
Made-with: Cursor
* ♻️ refactor: use incremental diff for snapshot messages to prevent OOM
Replace full messages/messagesAfter duplication per step with baseline + delta approach:
- Step 0 and compression resets store full messagesBaseline
- Other steps store only messagesDelta (new messages added)
- Strip llm_stream events from snapshot (not useful for post-analysis)
- Strip messages from done.finalState (reconstructible from delta chain)
- Strip duplicate toolResults from context.payload
- Reduce context_engine_result event size by removing messages and toolsConfig
- Add reconstructMessages() utility for rebuilding full state from delta chain
- AiAgentService constructor now accepts runtimeOptions for DI
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* ♻️ refactor: add incremental toolset delta for snapshot
- Store operationToolSet as toolsetBaseline in step 0 only (immutable)
- Track activatedStepTools changes via per-step activatedStepToolsDelta
- Strip operationToolSet/toolManifestMap/tools/toolSourceMap from done.finalState
- Add reconstructToolsetBaseline() and reconstructActivatedStepTools() utilities
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* 🐛 fix: correct snapshot delta recording and restore context-engine output
- P1: messagesDelta now always stores only appended messages (afterMessages.slice),
fixing duplication when isBaseline was true (step 0 / compression reset)
- P2: Restore context_engine_result.output (processedMessages) — needed by
inspect CLI for --env, --system-role, and -m commands
- Add P1 regression test for message deduplication
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* ✨ feat(chat-input): add category-based mention menu with keyboard navigation
Replace flat mention list with a structured category menu (Agents, Members, Topics).
Supports home/category/search views, Fuse.js fuzzy search, floating-ui positioning,
and full keyboard navigation.
* 🔧 chore: update @lobehub/editor to version 4.3.0 and refactor type definition in useMentionCategories
Signed-off-by: Innei <tukon479@gmail.com>
* ✨ feat(MentionMenu): enhance icon rendering logic in MenuItem component
Updated the MenuItem component to improve how icons are rendered. Now, it checks if the icon is a valid React element or a function, ensuring better flexibility in icon usage. This change enhances the overall user experience in the mention menu.
Signed-off-by: Innei <tukon479@gmail.com>
* 🔧 chore: update @lobehub/editor to version 4.3.1 in package.json
Signed-off-by: Innei <tukon479@gmail.com>
---------
Signed-off-by: Innei <tukon479@gmail.com>
* ✨ feat(version): display actual desktop app version with canary suffix
Add support for fetching and displaying the desktop application's actual version number in the About section. When running on desktop, the version now displays the desktop app's version (including canary suffix if applicable), falling back to the web version if unavailable.
- Add getAppVersion IPC method in SystemController
- Create versionDisplay utility module with comprehensive tests
- Integrate desktop version fetching in Version component
* ♻️ refactor(desktop): inject about version at build time