Fork
0
代码
介绍
代码
Issues
Pull Requests
流水线
Actions
讨论
Wiki
项目成员
分析
项目设置
Fork
0
canary
lobe-chat
/
packages
/
builtin-tools
下载当前目录
A
Arvin Xu
Revert "fix(github): support both runCommand and run_command in render matching"
d3faa70c
创建于
1 天前
历史提交
文件
最后提交记录
最后更新时间
src
Revert "fix(github): support both runCommand and run_command in render matching" This reverts commit 6770d8f321431be5ea425033a7a51bd145278b4d.
1 天前
package.json
♻️ 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 天前