文件最后提交记录最后更新时间
♻️ refactor(builtin-tool): move sub-agent dispatch from `lobe-gtd` to `lobe-agent` (#14715) * ♻️ refactor(builtin-tool): move sub-agent dispatch from lobe-gtd to lobe-agent Move the `execTask` / `execTasks` capability out of `packages/builtin-tool-gtd/` and into `packages/builtin-tool-lobe-agent/`, renaming the public APIs to `callSubAgent` / `callSubAgents`. The "subtask" naming inside GTD overlapped with the new lobe-task tool's task model and conflated planning with sub-agent dispatch. - API names: `execTask` → `callSubAgent`, `execTasks` → `callSubAgents` - TS types: `ExecTaskParams` → `CallSubAgentParams`, etc.; introduce `SubAgentTask` to replace `ExecTaskItem` - Client UI (Inspector / Render / Streaming) ported under `packages/builtin-tool-lobe-agent/src/client/` - Central registries (`packages/builtin-tools/src/{inspectors,renders,streamings}.ts`) updated to register lobe-agent - GTD `meta.description` and system role no longer mention async tasks; they point to lobe-agent for sub-agent dispatch - `isSubTask` filtering in `agentConfigResolver` now excludes `lobe-agent` (new owner of sub-agent dispatch) instead of `lobe-gtd` - i18n: new `builtins.lobe-agent.apiName.callSubAgent*` and `workflow.toolDisplayName.callSubAgent*` keys in default/zh-CN/en-US Kept the executor's emitted `state.type` values (`execTask` / `execTasks` / `execClientTask` / `execClientTasks`) unchanged so the agent-runtime instruction layer (`exec_task` / `exec_tasks` / `exec_client_task*`) and all downstream tests / heterogeneous executors (`builtin-tool-agent-management`, server `agentManagement` runtime) continue to work without modification. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ♻️ refactor(chat): rename isSubTask flag to isSubAgent After moving sub-agent dispatch from lobe-gtd to lobe-agent, the flag name no longer matches what it controls. Rename `isSubTask` → `isSubAgent` across the chat / agent runtime layer and update related comments and test labels. - `agentConfigResolver` context field + filter helper - `streamingExecutor.internal_createAgentState` + `executeClientAgent` signatures and call sites - `createAgentExecutors` (exec_task / exec_client_task handlers) and `GroupOrchestrationExecutors` (batch_exec_async_tasks) - `chatService.createAssistantMessageStream` `resolvedAgentConfig` docs - Test descriptions and assertions in `agentConfigResolver.test.ts` and `streamingExecutor.test.ts` No behavior change — the flag's filter target (`lobe-agent` identifier) is unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ♻️ refactor(agent-runtime): rename exec_task wire identifiers to exec_sub_agent Bring the agent-runtime "wire" naming in line with the lobe-agent callSubAgent / callSubAgents API rename. Three layers are renamed in lockstep to keep the bridge between tool executors and the runtime consistent: 1. Tool-emitted state.type discriminators - 'execTask' → 'execSubAgent' - 'execTasks' → 'execSubAgents' - 'execClientTask' → 'execClientSubAgent' - 'execClientTasks' → 'execClientSubAgents' 2. AgentInstruction.type and matching TS interfaces - 'exec_task' / 'exec_tasks' / 'exec_client_task' / 'exec_client_tasks' → 'exec_sub_agent' / 'exec_sub_agents' / 'exec_client_sub_agent' / 'exec_client_sub_agents' - AgentInstructionExecTask → AgentInstructionExecSubAgent (and the three siblings) - ExecTaskItem → SubAgentTask 3. AgentRuntimeContext.phase + matching payload types - 'task_result' → 'sub_agent_result' - 'tasks_batch_result' → 'sub_agents_batch_result' - TaskResultPayload → SubAgentResultPayload - TasksBatchResultPayload → SubAgentsBatchResultPayload Also renames the operation-type discriminator 'execClientTask' / 'execClientTasks' to 'execClientSubAgent' / 'execClientSubAgents' and updates its locale string in default / zh-CN / en-US. Tests / fixtures / mocks updated in lockstep: - packages/agent-runtime/src/agents/{GeneralChatAgent.ts,__tests__/...} - packages/builtin-tool-{lobe-agent,agent-management}/src/... - src/server/services/toolExecution/serverRuntimes/agentManagement.ts - packages/agent-mock/src/cases/builtins/todo-write-stress.ts (helper renamed to callSubAgent) - src/store/chat/agents/createAgentExecutors.ts + exec-task / exec-tasks tests + fixtures/mockInstructions.ts (createExecSubAgent[s]Instruction) - src/store/chat/slices/aiChat/actions/streamingExecutor.ts (phase check) - packages/conversation-flow/src/__tests__/fixtures/**/*.json (8 fixtures retargeted from lobe-gtd/execTask[s] to lobe-agent/callSubAgent[s] with the new state.type wire values) No behavior change — the agent runtime, executors and tests all go through the same code paths; only the strings on the wire change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ♻️ refactor(builtin-tool): absorb GTD tool (plan + todo) into lobe-agent Delete `packages/builtin-tool-gtd/` and fold its full surface — plan, todo, ExecutionRuntime, all client UI (Inspector / Render / Streaming / Intervention / SortableTodoList) and the system role — into `packages/builtin-tool-lobe-agent/`. Single `lobe-agent` identifier now owns: plan + todo management, sub-agent dispatch, and visual media analysis. Also restructures the lobe-agent package so the executor lives under `./client/` alongside the UI it ships with, and drops the dedicated `./executor` export — consumers go through `./client` for everything client-side. Package-level changes: - DELETE `packages/builtin-tool-gtd/` entirely. - `packages/builtin-tool-lobe-agent/` - Move `src/executor/` → `src/client/executor/`. Drop `./executor` from `package.json` exports; expose `lobeAgentExecutor` via `./client` only. - Rename `GTDExecutionRuntime` → `PlanExecutionRuntime` and place under `src/client/executor/PlanRuntime/`. Re-export from package root so the server runtime can consume it without pulling in client UI deps. - Extend `LobeAgentExecutor` with `createPlan` / `updatePlan` / `createTodos` / `updateTodos` / `clearTodos`, all delegated to the shared runtime. - Add Plan + Todo API entries to the manifest (with their original descriptions, humanIntervention, renderDisplayControl). - Move all GTD client UI verbatim: `Inspector/{ClearTodos,CreatePlan,CreateTodos,UpdatePlan,UpdateTodos}`, `Render/{CreatePlan,TodoList}`, `Streaming/CreatePlan`, `Intervention/{AddTodo,ClearTodos,CreatePlan}`, `components/SortableTodoList`. Register them in `LobeAgentInspectors / Renders / Streamings`, add new `LobeAgentInterventions`. - Merge GTD system role into lobe-agent's (`<plan_and_todos>` plus the existing `<sub_agents>` and `<run_in_client>` sections). - `package.json`: pick up `@lobechat/prompts` dep and `@lobehub/editor` + `antd` + `lucide-react` peer-deps inherited from GTD. Central registries (`packages/builtin-tools/src/*`) and consumers: - Remove every `GTDManifest / Inspectors / Renders / Streamings / Interventions` import + registration; existing `LobeAgent*` registrations now cover them. - Replace `[GTDManifest.identifier]: GTDInterventions` with `[LobeAgentManifest.identifier]: LobeAgentInterventions`. - Drop `@lobechat/builtin-tool-gtd` workspace dep from `packages/builtin-tools/package.json`, `packages/builtin-agents/package.json` and root `package.json`. - Remove `gtdExecutor` from `src/store/tool/slices/builtin/executors/index.ts`; switch `lobeAgentExecutor` import to `/client`. - Replace `serverRuntimes/gtd.ts` with a service factory `serverRuntimes/lobeAgentPlan.ts` (`createServerPlanRuntimeService`). `serverRuntimes/lobeAgent.ts` instantiates `PlanExecutionRuntime` with that service so the registry exposes one runtime per `lobe-agent` identifier covering both visual analysis and plan/todo. - `services/chat/mecha/contextEngineering.ts`: gate plan/todo injection on `LobeAgentIdentifier` instead of `GTDIdentifier`. - `agentConfigResolver.test.ts`: switch fixture plugin IDs to `LobeAgentIdentifier`. - `packages/const/src/recommendedSkill.ts`: drop the standalone `lobe-gtd` recommendation — `lobe-agent` already covers it via `defaultToolIds`. i18n migration (default + zh-CN + en-US; other locales regenerate on `pnpm i18n`): - `builtins.lobe-gtd.*` → `builtins.lobe-agent.*` in `plugin.ts/json`. - `lobe-gtd.*` (tool namespace) → `lobe-agent.*` in `tool.ts/json`. - Remove `tools.builtins.lobe-gtd.{description,readme,title}` from `setting.ts/json` (lobe-agent has its own meta now). - Update all client component `t(...)` keys to the new namespace. Mocks / fixtures / tests: - `packages/agent-mock/src/cases/builtins/todo-write-stress.ts`: all `identifier: 'lobe-gtd'` → `'lobe-agent'`; helper comments updated. - `packages/types/src/stepContext.ts`: comment refers to `builtin-tool-lobe-agent` (the only consumer of `StepContextTodoItem`). - `packages/model-runtime/src/core/streams/google/google-ai.test.ts`: function-call names from `lobe-gtd____createPlan` etc. → `lobe-agent____*`. - `src/store/chat/slices/message/selectors/dbMessage.test.ts`: same. - `src/features/DevPanel/RenderGallery/fixtures/lobe-gtd.ts` deleted; its plan/todo fixtures are folded into `fixtures/lobe-agent.ts` alongside the existing `callSubAgent[s]` ones. - Replace `console.log` → `console.info` in moved client components to satisfy lobe-agent's stricter ESLint rules (GTD package allowed `console.log`; lobe-agent inherits the repo-wide `no-console` rule). No behavior change for end users: `lobe-agent` now owns all the APIs, identifiers, and UI that previously lived in `lobe-gtd`, but as a single consolidated package under a single tool identifier. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ♻️ refactor(context-engine): drop residual GTD naming, rename to PlanInjector / TodoInjector Follow-up to 9ca5c9d (which absorbed the GTD tool package into lobe-agent). That commit moved the package surface but left the GTD vocabulary embedded in context-engine providers, types, metadata fields, XML tags, and a pile of comments. This change finishes the sweep so the only remaining GTD references are user-facing docs and the legitimate Productivity & GTD Coach methodology suggestion. context-engine - `GTDPlanInjector` → `PlanInjector`; types `GTDPlan`/`GTDPlanInjectorConfig` → `Plan`/`PlanInjectorConfig`; metadata `gtdPlanId`/`gtdPlanInjected` → `planId`/`planInjected`; XML tag `<gtd_plan>` → `<plan>`; debug channel `provider:GTDPlanInjector` → `provider:PlanInjector`. - `GTDTodoInjector` → `TodoInjector`; types `GTDTodoItem`/`GTDTodoList`/ `GTDTodoStatus`/`GTDTodoInjectorConfig` → `TodoItem`/`TodoList`/ `TodoStatus`/`TodoInjectorConfig`; metadata `gtdTodo*` → `todo*`; XML tag `<gtd_todos>` → `<todos>`, wrapper `gtd_todo_context` → `todo_context`; debug channel renamed similarly. - `MessagesEngineParams.gtd?: GTDConfig` → `planTodo?: PlanTodoConfig`; internal vars `isGTDPlanEnabled`/`isGTDTodoEnabled` → `isPlanEnabled`/`isTodoEnabled`. Re-exports updated in `providers/index.ts` and `engine/messages/{index,types}.ts`. prompts - `packages/prompts/src/prompts/gtd/` → `planTodo/` (only export was `formatTodoStateSummary`, which kept its name). Updated `prompts/index.ts` re-export. src/services - `contextEngineering.ts`: `GTDConfig` import → `PlanTodoConfig`; `isGTDEnabled`/`gtdConfig` → `isPlanTodoEnabled`/`planTodoConfig`; payload field `gtd` → `planTodo`; log message wording. Tests - `dbMessage.test.ts`: helper `createGTDToolMessage` → `createLobeAgentToolMessage`; `gtdMessage` → `lobeAgentMessage`; all `it` descriptions reworded to "lobe-agent" instead of "GTD". - `agentConfigResolver.test.ts`: test descriptions reworded. Comments / docs (no behavior change) - agent-runtime (`instruction.ts`, `runtime.ts`, `generalAgent.ts`, `messageSelectors.ts`), `types/{stepContext,tool/builtin}.ts`, `builtin-agents/group-supervisor`, `builtin-tool-claude-code/types.ts`, `builtin-tool-lobe-agent/Render/TodoList`, `createAgentExecutors.ts:1426`, `AssistantGroup/{constants,Fallback.test}`, `agent-mock/todo-write-stress`, `.agents/skills/builtin-tool/references/architecture.md`. Intentionally left alone - `docs/usage/agent/gtd.{mdx,zh-CN.mdx}` and other docs — user-facing product brand "GTD Tools". - `src/locales/default/suggestQuestions.ts` "Productivity & GTD Coach" — references the methodology, not the tool. - `ToolSystemRoleProvider.test.ts` `'gtd-tool'` fixture — generic test identifier, unrelated. - Translated locale files still carrying `lobe-gtd.*` keys — regenerated by `pnpm i18n` from the updated default namespace. Verified: `bun run type-check` passes; touched test files (dbMessage, agentConfigResolver) and full context-engine + prompts test suites pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 🐛 fix(builtin-tool-lobe-agent): reset TodoList auto-save status to idle `performSave` (the debounced auto-save path) was leaving `saveStatus` stuck on 'saved' forever — `saveNow` had the 1.5s setTimeout-to-idle but the auto-save twin didn't, so the inline indicator never eased back to idle after a settle. Add the same idle-reset to performSave so both paths behave the same. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>11 天前
📝 docs(skills): frontmatter cleanup + argument-hint (#14683) * 🔨 chore: control skill triggering via frontmatter flags - Rename debug skill to debug-package (avoid confusion with debugging workflows) - Add disable-model-invocation to add-* skills so they are manual-only - Add user-invocable: false to reference/architecture skills so they auto-load only when relevant * 🔨 chore: rename skill reference dirs to plural references Align with the skill-creator convention (scripts/, references/, assets/). * 📝 docs(skills): split oversized SKILL.md files and refine triggers - upstash-workflow: 1126L → 189L, extract implementation / best-practices / examples references - data-fetching: 854L → 613L, move parent-keyed-map walkthrough to references - store-data-structures: 625L → 314L, extract types and reducer references - upstash-workflow/cloud.md, version-release/release-notes-style.md: add TOCs - linear: rewrite ALL-CAPS MUSTs into prose explaining why; mark user-invocable: false - version-release: mark disable-model-invocation: true (manual /version-release only) - debug-package: expand description with concrete trigger phrases and tokens * 📝 docs(skills): regularize microcopy structure Move language-specific guidelines into references/zh.md and references/en.md so SKILL.md can point to them via the standard progressive-disclosure pattern. Previously the two files sat next to SKILL.md but were not referenced anywhere, making them invisible to Claude Code loading. * 📝 docs(skills): move builtin-tool refs into references subdir Aligns builtin-tool with the references/ layout used elsewhere (microcopy, store-data-structures). 3 md files move, SKILL.md links updated. * 📝 docs(skills): broaden trigger descriptions for core skills Adds concrete API names, file paths and natural-language phrases so auto-triggering catches more relevant prompts. Touches zustand, drizzle, i18n, react, typescript, modal, hotkey. * 📝 docs(skills): add argument-hint to user-only skills12 天前
✨ feat(follow-up): extend follow-up chip suggestions to general chat (#15101) * ✨ feat(follow-up): add foundation types for chat follow-up chips - FollowUpExtractInput.threadId for portal thread isolation - UserSystemAgentConfig.followUpAction (global enable + model) - LobeAgentChatConfig.enableFollowUpChips (per-agent opt-in) - ConversationHooks.onAssistantTurnSettled first-class member - Remove dead onGenerationStart/Complete/Cancelled hooks - DEFAULT_SYSTEM_AGENT_CONFIG.followUpAction off by default - DEFAULT_AGENT_CHAT_CONFIG.enableFollowUpChips false default * ♻️ refactor(follow-up): key follow-up store by conversation for concurrency - Convert useFollowUpActionStore from single-slot to slots map - conversationKey = messageMapKey(agentId, topicId, threadId?) for parity with chat store - contextSelectors.conversationKey exposes the key from ConversationProvider - FollowUpChips and ChatItem consume conversationKey - Onboarding hook adopts the new keyed API - Pass threadId through to extract (server filter lands in T3) * 🐛 fix(follow-up): address T2 code review feedback - Restore design-intent comments for 20s timeout and race guard - Remove dead pendingMessageId field from FollowUpActionSlot - Remove unused slotFor selector - Trim chipsFor / FollowUpActionSlot JSDoc to design intent only - Gate useOnboardingFollowUp against missing onboardingAgentId - removeSlot uses destructure; slotStatus uses ?? for falsy safety * ✨ feat(follow-up): filter extract by threadId for portal thread isolation - FollowUpActionService.extract honours optional threadId - threadId provided → eq(messages.threadId, threadId) - threadId absent → isNull(messages.threadId) so main topic never surfaces thread replies - Tests cover both branches * ✨ feat(conversation): emit onAssistantTurnSettled hook from provider - AssistantTurnSettledWatcher fires hooks.onAssistantTurnSettled(messageId, { reason }) once per turn - Reason derived from the most recent terminal Operation for the message id - Reason mapping: cancelled → stopped, type=regenerate → regenerated, type=continue → continued, else → completed - Settlement gated on idle + no pending tool intervention (mirrors Onboarding's logic) - Tests cover all four reason branches + intervention gating + no double-fire + fallback log - Onboarding bespoke prop untouched (migrates in T6) * 🐛 fix(conversation): scope settlement reason to turn-level operations - TURN_LEVEL_TYPES filter excludes child sub-ops (callLLM, executeToolCall, etc.) before sorting by endTime - Prevents successful regenerate/continue being misreported as 'completed' when a child finishes after the parent - Tests cover parent/child ordering for all reason branches * ✨ feat(follow-up): add useChatFollowUp hook and wire chat mount sites - New mergeConversationHooks composes multiple hooks with boolean short-circuit - useChatFollowUp computes effective enable (global × per-agent × valid model) - Registers onBeforeSendMessage/Continue/Regenerate to clear slot and onAssistantTurnSettled to extract - Mount sites: agent route ConversationArea, FloatingChatPanel, Portal Thread Chat (last in chain per §4.6) - Skips on reason='stopped'; skips when effective is false - Group chat intentionally not mounted * ♻️ refactor(onboarding): migrate settlement to ConversationHooks first-class - Drop bespoke onAssistantTurnSettled prop and duplicate useEffect from AgentOnboardingConversation - useOnboardingFollowUp returns ConversationHooks { onBeforeSendMessage, onAssistantTurnSettled } - Split settlement work: context-sync + builtin refresh runs first, chip extract runs after - Phase snapshot captured at memoize time preserves original prevPhase semantics - Settlement detection now lives solely in AssistantTurnSettledWatcher * ✨ feat(settings): add Follow-up suggestions controls (global + per-agent) - Global System Agent page: new Follow-up Suggestions panel (model picker + enable toggle) - Per-agent chat controls: enableFollowUpChips toggle with hint when global not configured - i18n keys: setting.systemAgent.followUpAction.*, setting.settingChat.enableFollowUpChips.* - Hint surfaces when user toggles per-agent ON but global is disabled/unmodeled * 🔧 chore(follow-up): T8 — scoped lint cleanup and comment discipline pass * 🐛 fix(follow-up): align conversationKey selector with callsite + wrap single hook - contextSelectors.conversationKey forwards full context (scope/isNew/groupId/subAgentId) so portal-thread NEW state matches callsite-computed keys - ConversationArea wraps chat-follow-up via mergeConversationHooks for spec §4.6 ordering robustness - Both per final-review Important concerns * ✅ test(settings): update follow-up defaults snapshots * ✨ feat(follow-up): surface model in service-model page + default to mini - Add followUpAction to /service-model OPTIONAL_FEATURE_ITEMS so model/provider and enable Switch render alongside inputCompletion and promptRewrite - Seed DEFAULT_FOLLOW_UP_ACTION_SYSTEM_AGENT_ITEM with DEFAULT_MINI model/provider so out-of-box config has a valid model; users only need to flip enabled - Sync settings selector snapshot1 天前