Repository navigation
feat(skills): let the draft and backtest pages pick the model that runs the work - #508
Merged
Merged
Conversation
…ns the work Drafting a suggestion and backtesting a skill always ran on whatever route the task Agent happened to inherit, so there was no way to try a cheaper or a stronger model for one page, one suggestion, or one skill. Both pages now offer a global pick and an optional per-item override: an override per suggestion on 进化, and one per skill on 评测, each falling back to the page's global pick and then to the task Agent's own route. The picks live in a `preferences.json` beside the ledger — deliberately outside the ledger fingerprint, so changing a pick does not invalidate an open page's revision. The Host carries the pick down to the agent it starts. While doing so it stops forwarding the inherited `reasoningEffort`: a Provider spells its levels in its own words, so passing one Provider's `max` to another that has no such level made the run die with UNSUPPORTED_REASONING_EFFORT. The picked Provider now decides its own effort unless the pick names one. Two related repairs come with it, because the pages could not be used without them. A suggestion whose draft write died with the previous Host stays in `drafting` forever and refuses both a retry and a delete; the store now puts such a suggestion back to `pending` with an explanation, both when the ledger is read and once when the source starts. And a suggestion or a draft can be deleted from its card, which is what the drafting state was blocking. The model selectors also repeat the chosen Provider under the model name, and flip their menu above the button when there is no room below: the menu is clamped into the viewport by measuring the selector before it opens, so a long directory no longer covers the button it belongs to.
The client declaration entry re-exported TaskAgentModelCatalog from src/host/protocol.ts. Following that import puts lib/types/src/host/protocol.d.ts into the client's published declarations, and from there into the standalone typecheck of every plugin that imports dsh-mnemon/client: the SDK's cordis Context augmentation is then declared twice and the two copies are not assignable to each other, so verify:public-entries and the packed-plugin typecheck both fail. Move the four catalogue interfaces into a browser-safe contract module, src/core/contracts/task-agent-model.ts, and have the Host protocol re-export them, so there is still one declaration while the client side never names a Host module.
12 of 28 tasks
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要 / Summary
「进化」页的草案生成与「评测」页的回测,原来只能跑任务 Agent 当前继承的那条路由。现在两页各有一个全局模型选择,并支持单项覆盖(草案按建议、回测按技能),回落顺序是:单项 → 页面全局 → 任务 Agent 自己的路由。选择存在 ledger 旁边的
preferences.json,故意不参与 ledger fingerprint,所以换一次选择不会让已打开页面的 revision 失效。Host 会把这条路由透传到它启动的 agent,并停止把继承来的reasoningEffort转给词表不同的 Provider。The draft page and the backtest page could only run on whatever route the task Agent happened to inherit. Both pages now offer a global model pick plus an optional per-item override (per suggestion for drafts, per skill for backtests), falling back to the task Agent's own route. Picks live in
preferences.jsonbeside the ledger and are deliberately kept out of the ledger fingerprint, so changing a pick does not invalidate an open page's revision. The Host carries the pick through to the agent it starts and stops forwarding an inheritedreasoningEffortto a Provider that spells its levels differently.关联 Issue 或背景 / Related Issue or Context
Closes #473
该 Issue 在提交本 PR 时尚无维护者回复。改动范围严格限定在 Issue 里描述的方案:
draft-preferences/draft-preference通道带slot: draft | run、suggestionId、skillName、model: { provider, model } | null,存储不参与 revision,Host 侧把路由挂到 task agent 并在delegate里优先使用。如果维护者希望拆分或调整范围,我可以按意见重切成更小的 PR。The Issue had no maintainer reply when this PR was opened. The scope follows the plan written in the Issue; I am happy to split or narrow it if maintainers prefer.
涉及区域 / Affected Areas
PR 类型 / PR Type
最新代码确认 / Latest Codebase Confirmation
main分支开发,或在提交前已 rebase 或合并最新main。 / I developed from the latestmain, or rebased or merged the latestmainbefore submitting.同步命令 / Sync command:
git fetch origin && git checkout -B feat/skill-work-model-picks origin/main本分支基于
main的58fae98(撰写当天的最新main);GitHub compare 显示ahead_by: 1, behind_by: 0, files: 24。AI 编码披露 / AI Coding Disclosure
使用的 AI 模型 / AI model used:
deepseek-v4.1-flash使用的编码 Agent 工具 / Coding Agent tool used:
DeepSeek Harness(社区版桌面宿主 DSH NEXT 2.0.19-next,内核 0.2.1-rc.2)仓库规范检查 / Repository Rules
@deepseek-ai/*NPM 契约。 / I did not modify DSH source or point tsconfig at a DSH source checkout, and used only published@deepseek-ai/*NPM contracts.src/host/protocol.ts为准,没有在两侧重复定义 wire DTO。 / The Client and Host boundary still uses browser-safesrc/host/protocol.tsas the source for wire DTOs.lib/文件。 / I did not commit tokens, credentials, private memory, unredacted logs, or generatedlib/files.兼容性与数据安全 / Compatibility and Data Safety
<dataDir>/skills/preferences.json,且它是可选文件。不存在时store.preferences()返回{ version: 1, suggestionModels: {}, skillRunModels: {} },两页的选择器显示「跟随默认」,行为与改动前一致;回滚到旧版本时该文件被忽略,无需迁移。写入复用与 ledger 相同的原子写(同目录临时文件 + rename)并落在同一条内存锁内。preferences()故意不参与fingerprint()(该指纹只覆盖ledger.json与evals.json的大小与 mtime),所以改一次选择不会让已打开页面的revision失效,也不会触发整页重拉。draft-preferences与 mutatedraft-preference/suggestion-delete/draft-delete,全部走既有management通道与既有text()/optionalText()校验:slot只接受draft/run(给建议传slot: run会被拒绝)、provider上限 100、model上限 200、model必须是对象或null。没有新增进程、网络出站或凭据读取,权限面不变。provider+model,并显式剥离继承来的reasoningEffort。改动前把 A 家的max透给词表不同的 B 家会让整轮运行以UNSUPPORTED_REASONING_EFFORT失败;现在目标 Provider 自己决定档位,除非选择里显式给了档位。ledger.json的既有字段语义。唯一的状态机补丁是把「宿主在上次写草案途中退出、停在drafting的建议」放回pending并写lastError——这类建议在改动前既不能重试也不能删除,属于死状态。判据是updatedAt早于本进程启动时刻(PROCESS_STARTED_AT),因此不会误伤真正在写的那一条。preferences.json即回到「全部跟随默认」;代码侧回滚到本 PR 之前,该文件成为孤儿文件,无副作用。本地验证 / Local Validation
执行的命令 / Commands run:
结果摘要 / Result summary:
pnpm run verify:docs— PASS:Documentation verified: 5556 local links, 425 Markdown anchors, bilingual paths and official plugin coverage.pnpm run typecheck(根包)— exit 0pnpm run build— PASS(tsdown+tsc -p tsconfig.types.json+link-bundle-declarations.mjs)pnpm run verify:build— PASS:Verified deterministic output for 57 files.pnpm -r build/pnpm -r typecheck不加--config.ignoreWorkspaceCycles=true会在 Windows 上报ERR_PNPM_TASK_CYCLE(仓库既有的环依赖:source-skills与strategy-default-three-tier等四组),加上该开关后全 workspace build 与 typecheck 均 exit 0。plugins/dsh-mnemon-source-skills的vitest run tests/client.spec.tsx— 26 passed(含本 PR 新增的 4 项选择器用例)。plugins/dsh-mnemon-source-skills的vitest run— 70 passed / 1 failed / 2 skipped。唯一失败是既有的 Windows 路径分隔符用例skill catalog > reads the four roots with DSH rules and marks the skill DSH loads(期望templates/note.md,实际templates\note.md),在未改动的main上同样失败。pnpm run test:root— 有若干失败(侧栏与设置页 CSS 布局不变量、插件元数据、Starter 激活用例、若干 30 s 超时用例)。判据见下。为什么这些失败不是本 PR 引入的(同集对照):
git stash push -u后在同一棵树、同一 Node/pnpm 版本上跑pnpm exec vitest run tests/client-sidebar-css.spec.ts tests/plugin-metadata.spec.ts tests/composable-plugin-bundle.spec.ts得到 9 failed / 17 passed;
git stash pop恢复本 PR 改动后跑同一组,结果同样是 9 failed / 17 passed,失败项逐条相同。失败均为 Windows CRLF 环境差异(例如expected '/*\r\n * ...' to contain '.toggleRow {\n ...')。没能跑的项:
pnpm run verify:plugins在 Windows 上抛ENOENT: spawn pnpm,因为scripts/verify-plugin-artifacts.mjs直接spawn('pnpm', ...),而 Windows 只有pnpm.cmdshim、没有可 spawn 的pnpm.exe;git diff --stat scripts/为空,脚本未被本 PR 修改,这是环境限制。同理pnpm run verify:package未纳入本次实跑。用户可见变更证据 / Local Feature Evidence
证据 / Evidence:
运行环境:本 PR 的编译产物已装入桌面宿主并重启加载;界面为中文。
DeepSeek-V4.1-Flash - x0.11与CodeBuddy (腾讯);右「所选草案模型」显示跟随默认,两列与下方列表、详情卡片左缘对齐。截图已裁掉左侧会话与工作区侧栏,只保留技能管理面板,不含凭据、私有记忆或敏感路径。