Repository navigation
feat: 新对话的默认模式与记住上次选择 / default mode for new conversations (0.5.0) - #1
Conversation
|
Thanks Alexander — the shape of this is right: a settings namespace the host registers, a card that only shows up once that registration exists, and the "decide once per session, an explicit local choice counts as an answer, restored sessions are not armed again" rule. I'll do a full review once it is rebased. Right now GitHub reports Everything else auto-merges (
Two things I would like spelled out in the PR description when you push:
|
Rebased onto main and adapted to the 0.2.1-rc.4 / 0.2.2-alpha.2 host line: - peerDependencies follow the current host line (^0.2.1-rc.4 || ^0.2.2-alpha.2, cordis ~4.0.5 || ~4.0.6-alpha.1, schemastery ^3.18.0 || ~3.18.6-alpha.1); dsh-settings and schemastery stay optional peers - devDependencies pinned to 0.2.2-alpha.2, plus cordis and dsh-scope so the host tests resolve the runtime peer chain - package-lock.json, lib/ and client/ regenerated from source (npm install --legacy-peer-deps; npm run build:client) - IconChevronDownOutline14 replaced by IconChevronDownOutlineRegular, the name the current client primitives export Co-authored-by: DeepSeek <noreply@deepseek.com>
bf3c6b5 to
fab2ac0
Compare
|
Rebase 完成,署名保留(commit package.json(手工合并语义,不是取一边)
package-lock.json: 一处源码改动: 验证(本地全绿): 顺便把你描述里我 review 时问的两点按代码回答,免得你再等一轮:
合入后我会在真实 profile 里装一遍 0.5.0 再发布 npm;有问题欢迎继续在这个 PR 或新 issue 里说。感谢这个 PR——设置卡片和"仅首条真人消息判定一次"的规则都做得很干净。 |
为什么(Why)
每个新对话都以本地模式开始,并且会忘记你在上一个对话里选过的模式——于是习惯用 worktree 的人每开一个新任务都要重新选一次,而且没有任何设置可以改变这一点。
怎么做(How)
task-worktree设置命名空间(defaultMode、rememberLastChoice,两者的默认值都等于现在的行为:本地模式、不记忆);当默认为 worktree 模式时,在空白对话的第一条真人消息上注入创建指引。Button+Menu原语,输入框上方的选择器现在会跟随这个默认值。session-start也不会二次武装。在用户没有动过这张卡片之前,已有安装的行为完全不变:schema 默认值为
defaultMode: local、rememberLastChoice: false,与本次改动之前完全一致。截图(Screenshots)
卡片展开后的样子,当前选中的是默认值(行为保持不变):
默认设为 Worktree模式 时的新对话:选择器已预先武装,分支名输入框也已出现,发送第一条消息就会创建 worktree:
审阅提示(Notes for review)
ui-settings-plugins的PluginCard/fields:该包只导出类型(exports.apply/exports.inject),插件自有的卡片必须自己绘制外壳;所有可交互控件都使用宿主原语,没有新增控件样式。test/host.mjs在假的 cordis 上下文上运行真实的apply()(设置命名空间、武装策略、注入),test/prefs.mjs覆盖浏览器偏好 store。npm test、npm run typecheck与客户端 bundle 漂移检查全部通过。English (original)
Note: the author speaks English — the Chinese above is a translation of this text. Apologies for any inaccuracy or awkward wording; corrections are welcome.
Why
Every new conversation starts in Local mode and forgets the mode picked in the previous one, so anyone working worktree-first has to re-arm the same choice at the start of every task — and there is no setting to say otherwise.
How
task-worktreesettings namespace (defaultMode,rememberLastChoice, both defaulting to today's behaviour: local mode, no remembering) and, when the default says worktree, injects the creation instruction with the first genuine user message of an empty conversation.Button+Menuprimitives; the composer selector above the input now follows that default.session-startbeacon cannot re-arm it.Existing installations are unaffected until the card is touched: the schema default is
defaultMode: local,rememberLastChoice: false, which is exactly the pre-PR behaviour.Screenshots
The card, expanded, with the default (unchanged) selection:
A new conversation with the default set to Worktree mode: the selector is pre-armed and the branch-name field is already there, so the first message creates the worktree:
Notes for review
ui-settings-plugins'sPluginCard/fieldsvalues because that package exports only types (exports.apply/exports.inject) — a plugin-owned card has to draw its own chrome. Everything interactive is a host primitive, so no new control styling is introduced.test/host.mjsmounts the realapply()on a fake cordis context (namespace, arming policy, injection),test/prefs.mjscovers the browser preference store.npm test,npm run typecheckand the client-bundle drift check all pass.