@songtonyli/dsh-cli 0.1.22 → 0.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +1 -1
  2. package/bin/dsh.mjs +1 -1
  3. package/node_modules/@deepseek-ai/dsh-base/cordis.patch.yml +11 -0
  4. package/node_modules/@deepseek-ai/dsh-base/package.json +1 -0
  5. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
  6. package/node_modules/@deepseek-ai/dsh-client-ui-slots/package.json +2 -2
  7. package/node_modules/@deepseek-ai/dsh-compaction-basic/README.i18n.yaml +2 -2
  8. package/node_modules/@deepseek-ai/dsh-compaction-basic/README.md +32 -3
  9. package/node_modules/@deepseek-ai/dsh-compaction-basic/README.zh.md +32 -3
  10. package/node_modules/@deepseek-ai/dsh-compaction-basic/lib/index.js +153 -3
  11. package/node_modules/@deepseek-ai/dsh-goal-round-driver/README.i18n.yaml +2 -2
  12. package/node_modules/@deepseek-ai/dsh-goal-round-driver/README.md +17 -2
  13. package/node_modules/@deepseek-ai/dsh-goal-round-driver/README.zh.md +17 -2
  14. package/node_modules/@deepseek-ai/dsh-goal-round-driver/lib/index.js +153 -2
  15. package/node_modules/@deepseek-ai/dsh-llm-cursor/README.i18n.yaml +2 -2
  16. package/node_modules/@deepseek-ai/dsh-llm-cursor/README.md +1 -1
  17. package/node_modules/@deepseek-ai/dsh-llm-cursor/README.zh.md +1 -1
  18. package/node_modules/@deepseek-ai/dsh-llm-cursor/lib/index.js +48 -24
  19. package/node_modules/@deepseek-ai/dsh-no-progress-reminder/README.i18n.yaml +6 -0
  20. package/node_modules/@deepseek-ai/dsh-no-progress-reminder/README.md +164 -0
  21. package/node_modules/@deepseek-ai/dsh-no-progress-reminder/README.zh.md +164 -0
  22. package/node_modules/@deepseek-ai/dsh-no-progress-reminder/lib/index.js +1516 -0
  23. package/node_modules/@deepseek-ai/dsh-no-progress-reminder/package.json +50 -0
  24. package/node_modules/@deepseek-ai/dsh-repeat-tool-reminder/README.i18n.yaml +2 -2
  25. package/node_modules/@deepseek-ai/dsh-repeat-tool-reminder/README.md +36 -11
  26. package/node_modules/@deepseek-ai/dsh-repeat-tool-reminder/README.zh.md +36 -11
  27. package/node_modules/@deepseek-ai/dsh-repeat-tool-reminder/lib/index.js +54 -7
  28. package/node_modules/@deepseek-ai/dsh-subagent/README.i18n.yaml +2 -2
  29. package/node_modules/@deepseek-ai/dsh-subagent/README.md +2 -2
  30. package/node_modules/@deepseek-ai/dsh-subagent/README.zh.md +2 -2
  31. package/node_modules/@deepseek-ai/dsh-subagent/lib/index.js +93 -32
  32. package/node_modules/@deepseek-ai/dsh-subagent/lib/types/continuation-messages.js +20 -7
  33. package/node_modules/@deepseek-ai/dsh-subagent/lib/types/diagnostic.js +39 -0
  34. package/node_modules/@deepseek-ai/dsh-subagent/lib/types/lifecycle.js +36 -4
  35. package/node_modules/@deepseek-ai/dsh-subagent/lib/types/out-of-process.js +1 -22
  36. package/node_modules/@deepseek-ai/dsh-tool-skill/README.i18n.yaml +2 -2
  37. package/node_modules/@deepseek-ai/dsh-tool-skill/README.md +21 -4
  38. package/node_modules/@deepseek-ai/dsh-tool-skill/README.zh.md +21 -4
  39. package/node_modules/@deepseek-ai/dsh-tool-skill/lib/index.js +194 -16
  40. package/node_modules/@deepseek-ai/dsh-tool-todo/README.i18n.yaml +2 -2
  41. package/node_modules/@deepseek-ai/dsh-tool-todo/README.md +3 -3
  42. package/node_modules/@deepseek-ai/dsh-tool-todo/README.zh.md +3 -3
  43. package/node_modules/@deepseek-ai/dsh-tool-todo/lib/index.js +32 -6
  44. package/node_modules/@deepseek-ai/dsh-tool-todo/lib/types/index.js +31 -5
  45. package/node_modules/@deepseek-ai/dsh-tui-app/README.i18n.yaml +2 -2
  46. package/node_modules/@deepseek-ai/dsh-tui-app/README.md +21 -8
  47. package/node_modules/@deepseek-ai/dsh-tui-app/README.zh.md +21 -8
  48. package/node_modules/@deepseek-ai/dsh-tui-app/lib/index.js +265 -20
  49. package/node_modules/@types/node/README.md +2 -2
  50. package/node_modules/@types/node/package.json +2 -17
  51. package/package.json +4 -2
@@ -25,6 +25,138 @@ function SessionSeq(value) {
25
25
  return brandNumber(value);
26
26
  }
27
27
  //#endregion
28
+ //#region lib/types/unknown-skill.js
29
+ /**
30
+ * Model-facing unknown-skill diagnostics: closest catalog names, a capped
31
+ * name list, and the closed-catalog rule.
32
+ *
33
+ * @module @deepseek-ai/dsh-tool-skill/unknown-skill
34
+ */
35
+ /** Consecutive unknown loads on one live agent that close `skill` for the rest of the turn. */
36
+ const UNKNOWN_SKILL_STREAK_LIMIT = 3;
37
+ /** Maximum Levenshtein distance that still qualifies a catalog name as close. */
38
+ const MAX_CLOSE_SKILL_DISTANCE = 4;
39
+ /** Maximum closest catalog names included in an unknown-skill error. */
40
+ const MAX_CLOSE_SKILL_SUGGESTIONS = 3;
41
+ /** Maximum model-invocable names listed in an unknown-skill error. */
42
+ const MAX_LISTED_CATALOG_NAMES = 40;
43
+ /**
44
+ * Refusal after {@link UNKNOWN_SKILL_STREAK_LIMIT} consecutive unknown skill
45
+ * loads on the same live agent in the same turn.
46
+ */
47
+ const CLOSED_SKILL_CATALOG_THIS_TURN = "The skill catalog is closed this turn. The next action must be a task tool (read/edit/write/bash), not another skill load.";
48
+ /**
49
+ * First line of every unknown-skill error. Existing `toContain` assertions
50
+ * match this exact sentence.
51
+ * @param name - the requested skill name.
52
+ * @returns the historical unknown-skill sentence.
53
+ */
54
+ function unknownSkillLine(name) {
55
+ return `skill "${name}" is unknown or no longer available`;
56
+ }
57
+ /**
58
+ * Closed-catalog instruction appended to every unknown-skill error.
59
+ */
60
+ const CLOSED_SKILL_CATALOG_LINE = "The skill catalog is closed: use only listed names. Do not invent names.";
61
+ /**
62
+ * Levenshtein edit distance between two strings (insert, delete, substitute).
63
+ * @param left - first string.
64
+ * @param right - second string.
65
+ * @returns the non-negative edit distance.
66
+ */
67
+ function levenshteinDistance(left, right) {
68
+ if (left === right) return 0;
69
+ if (left.length === 0) return right.length;
70
+ if (right.length === 0) return left.length;
71
+ return levenshteinRows(left, right);
72
+ }
73
+ /**
74
+ * Whether `needle` is an ordered subsequence of `haystack`.
75
+ * @param needle - characters that must appear in order.
76
+ * @param haystack - string that may contain those characters.
77
+ * @returns whether every needle character appears in order in haystack.
78
+ */
79
+ function isSubsequenceOf(needle, haystack) {
80
+ let index = 0;
81
+ for (const character of haystack) {
82
+ if (character === needle[index]) index += 1;
83
+ if (index === needle.length) return true;
84
+ }
85
+ return index === needle.length;
86
+ }
87
+ /**
88
+ * Rank model-invocable catalog names nearest to a requested name.
89
+ * A candidate qualifies when its Levenshtein distance is at most
90
+ * {@link MAX_CLOSE_SKILL_DISTANCE} or it is a prefix or subsequence of the
91
+ * other string. The requested name itself is omitted.
92
+ * @param name - the requested skill name.
93
+ * @param catalogNames - model-invocable names in catalog order.
94
+ * @returns at most {@link MAX_CLOSE_SKILL_SUGGESTIONS} names, nearest first,
95
+ * then code-point order.
96
+ */
97
+ function rankClosestCatalogNames(name, catalogNames) {
98
+ return catalogNames.filter((candidate) => candidate !== name).map((candidate) => ({
99
+ candidate,
100
+ distance: levenshteinDistance(name, candidate)
101
+ })).filter((entry) => qualifiesCloseName(name, entry.candidate, entry.distance)).sort((left, right) => left.distance - right.distance || compareCatalogNames(left.candidate, right.candidate)).slice(0, 3).map((entry) => entry.candidate);
102
+ }
103
+ /**
104
+ * Build the model-facing unknown-skill error. The first line is
105
+ * {@link unknownSkillLine}; later lines add closest names or a no-match
106
+ * notice, the catalog list or an empty-catalog notice, and
107
+ * {@link CLOSED_SKILL_CATALOG_LINE}.
108
+ * @param name - the requested skill name.
109
+ * @param catalogNames - model-invocable names in catalog order.
110
+ * @returns the multiline error message without the tools `Error: ` wrapper.
111
+ */
112
+ function formatUnknownSkillError(name, catalogNames) {
113
+ return [
114
+ unknownSkillLine(name),
115
+ closestNamesLine(name, catalogNames),
116
+ catalogNames.length === 0 ? "The skill catalog is empty." : listedNamesLine(catalogNames),
117
+ CLOSED_SKILL_CATALOG_LINE
118
+ ].join("\n");
119
+ }
120
+ function qualifiesCloseName(name, candidate, distance) {
121
+ return distance <= 4 || candidate.startsWith(name) || name.startsWith(candidate) || isSubsequenceOf(name, candidate) || isSubsequenceOf(candidate, name);
122
+ }
123
+ function closestNamesLine(name, catalogNames) {
124
+ const closest = rankClosestCatalogNames(name, catalogNames);
125
+ return closest.length === 0 ? "No close catalog name matches." : `Closest catalog names: ${quoteNames(closest)}`;
126
+ }
127
+ function listedNamesLine(catalogNames) {
128
+ const shown = catalogNames.slice(0, 40);
129
+ const extra = catalogNames.length - shown.length;
130
+ const listed = `Valid skill names: ${quoteNames(shown)}`;
131
+ return extra === 0 ? listed : `${listed} (+${String(extra)} more)`;
132
+ }
133
+ function quoteNames(names) {
134
+ return names.map((name) => `\`${name}\``).join(", ");
135
+ }
136
+ /**
137
+ * Code-point order for catalog names, matching the skill registry sort.
138
+ * @param left - first name.
139
+ * @param right - second name.
140
+ * @returns negative when `left` precedes `right`, zero when equal, positive otherwise.
141
+ */
142
+ function compareCatalogNames(left, right) {
143
+ if (left < right) return -1;
144
+ if (left > right) return 1;
145
+ return 0;
146
+ }
147
+ function levenshteinRows(left, right) {
148
+ let previous = Array.from({ length: right.length + 1 }, (_, index) => index);
149
+ for (let i = 0; i < left.length; i += 1) {
150
+ const current = [i + 1];
151
+ for (let j = 0; j < right.length; j += 1) {
152
+ const substitution = left[i] === right[j] ? 0 : 1;
153
+ current.push(Math.min((current[j] ?? 0) + 1, (previous[j + 1] ?? 0) + 1, (previous[j] ?? 0) + substitution));
154
+ }
155
+ previous = current;
156
+ }
157
+ return previous[right.length] ?? 0;
158
+ }
159
+ //#endregion
28
160
  //#region lib/types/index.js
29
161
  /**
30
162
  * Durable session skill catalog and model-facing `skill` loader tool.
@@ -45,8 +177,13 @@ function catalogSourceEntries(skills, descriptionMaxLength) {
45
177
  description: catalogDescription(skill.description, descriptionMaxLength)
46
178
  }));
47
179
  }
180
+ /** Default routed providers that receive the per-turn unknown-skill hard-stop. */
181
+ const DEFAULT_CLOSED_CATALOG_PROVIDERS = ["cursor"];
48
182
  /** Validate and default the model-facing skill catalog configuration. */
49
- const Config = z.object({ catalogDescriptionMaxLength: z.number().default(DEFAULT_CATALOG_DESCRIPTION_MAX_LENGTH) });
183
+ const Config = z.object({
184
+ catalogDescriptionMaxLength: z.number().default(DEFAULT_CATALOG_DESCRIPTION_MAX_LENGTH),
185
+ closedCatalogProviders: z.array(z.string()).default(DEFAULT_CLOSED_CATALOG_PROVIDERS)
186
+ });
50
187
  /**
51
188
  * Register the model-facing skill loader and its visibility-matched
52
189
  * durable session catalog. The catalog is emitted only when the calling agent
@@ -56,6 +193,13 @@ const Config = z.object({ catalogDescriptionMaxLength: z.number().default(DEFAUL
56
193
  function apply(ctx, config = {}) {
57
194
  const catalogDescriptionMaxLength = config.catalogDescriptionMaxLength ?? DEFAULT_CATALOG_DESCRIPTION_MAX_LENGTH;
58
195
  assertPositiveInteger("catalogDescriptionMaxLength", catalogDescriptionMaxLength, 3);
196
+ const closedCatalogProviders = validateProviderList("closedCatalogProviders", config.closedCatalogProviders ?? DEFAULT_CLOSED_CATALOG_PROVIDERS);
197
+ const unknownStreaks = /* @__PURE__ */ new WeakMap();
198
+ ctx.on("session/event", (session, event) => {
199
+ if (event.type !== "turn/start") return;
200
+ const streak = unknownStreaks.get(session);
201
+ if (streak !== void 0) streak.consecutiveUnknown = 0;
202
+ });
59
203
  const skillTool = defineTool({
60
204
  name: "skill",
61
205
  description: "Load the full instructions for an available skill. Call this with the exact skill name from the session skill catalog before acting on a task that names or clearly matches that skill.",
@@ -136,24 +280,14 @@ function apply(ctx, config = {}) {
136
280
  }]
137
281
  },
138
282
  async execute(args, exec) {
283
+ const streak = streakFor(exec.agent, unknownStreaks, closedCatalogProviders);
284
+ if (streak !== void 0 && streak.consecutiveUnknown >= 3) throw new Error(CLOSED_SKILL_CATALOG_THIS_TURN);
139
285
  if (!isSkillName(args.name)) throw new Error(`invalid skill name "${args.name}"`);
140
- const lookup = {
286
+ return await loadModelInvocableSkill(ctx, args.name, {
141
287
  cwd: exec.agent?.session.header.cwd,
142
288
  signal: exec.signal,
143
289
  scope: exec.agent
144
- };
145
- const summary = (await ctx.skills.list(lookup)).find((skill) => skill.name === args.name);
146
- if (!summary) throw new Error(`skill "${args.name}" is unknown or no longer available`);
147
- if (!isModelInvocable(summary)) throw new Error(`skill "${args.name}" is not available for model invocation`);
148
- const skill = await ctx.skills.get(args.name, lookup);
149
- if (!skill) throw new Error(`skill "${args.name}" is unknown or no longer available`);
150
- if (!isModelInvocable(skill)) throw new Error(`skill "${args.name}" is not available for model invocation`);
151
- return {
152
- name: skill.name,
153
- provider: skill.provider,
154
- ...skill.resourceBase !== void 0 ? { resourceBase: { ...skill.resourceBase } } : {},
155
- content: skill.content
156
- };
290
+ }, streak);
157
291
  },
158
292
  presentCall(args) {
159
293
  return {
@@ -235,6 +369,50 @@ function apply(ctx, config = {}) {
235
369
  };
236
370
  });
237
371
  }
372
+ function streakFor(agent, streaks, providers) {
373
+ if (agent === void 0 || !isClosedCatalogRoute(agent, providers)) return void 0;
374
+ const existing = streaks.get(agent.session);
375
+ if (existing !== void 0) return existing;
376
+ const created = { consecutiveUnknown: 0 };
377
+ streaks.set(agent.session, created);
378
+ return created;
379
+ }
380
+ /** Whether this agent's current or selected provider is in the hard-stop list. */
381
+ function isClosedCatalogRoute(agent, providers) {
382
+ const provider = agent.session.requestHeader?.()?.config.provider ?? agent.options?.provider;
383
+ return provider !== void 0 && providers.includes(provider);
384
+ }
385
+ function validateProviderList(field, values) {
386
+ for (const value of values) if (value.length === 0) throw new Error(`tool-skill: ${field} entries must be non-empty`);
387
+ return [...values];
388
+ }
389
+ function throwUnknownSkill(name, catalogNames, streak) {
390
+ if (streak !== void 0) streak.consecutiveUnknown += 1;
391
+ throw new Error(formatUnknownSkillError(name, catalogNames));
392
+ }
393
+ function assertModelInvocable(name, skill) {
394
+ if (!isModelInvocable(skill)) throw new Error(`skill "${name}" is not available for model invocation`);
395
+ }
396
+ function loadedSkill(skill) {
397
+ return {
398
+ name: skill.name,
399
+ provider: skill.provider,
400
+ ...skill.resourceBase !== void 0 ? { resourceBase: { ...skill.resourceBase } } : {},
401
+ content: skill.content
402
+ };
403
+ }
404
+ async function loadModelInvocableSkill(ctx, name, lookup, streak) {
405
+ const summaries = await ctx.skills.list(lookup);
406
+ const catalogNames = summaries.filter(isModelInvocable).map((skill) => skill.name);
407
+ const summary = summaries.find((skill) => skill.name === name);
408
+ if (summary === void 0) throwUnknownSkill(name, catalogNames, streak);
409
+ assertModelInvocable(name, summary);
410
+ const skill = await ctx.skills.get(name, lookup);
411
+ if (skill === void 0) throwUnknownSkill(name, catalogNames, streak);
412
+ assertModelInvocable(name, skill);
413
+ if (streak !== void 0) streak.consecutiveUnknown = 0;
414
+ return loadedSkill(skill);
415
+ }
238
416
  function renderCatalogMessage(entries) {
239
417
  return createUserMessage({
240
418
  content: [{
@@ -393,4 +571,4 @@ function invokedSkillNames(messages) {
393
571
  return names;
394
572
  }
395
573
  //#endregion
396
- export { Config, apply, inject, name };
574
+ export { CLOSED_SKILL_CATALOG_LINE, CLOSED_SKILL_CATALOG_THIS_TURN, Config, MAX_CLOSE_SKILL_DISTANCE, MAX_CLOSE_SKILL_SUGGESTIONS, MAX_LISTED_CATALOG_NAMES, UNKNOWN_SKILL_STREAK_LIMIT, apply, compareCatalogNames, formatUnknownSkillError, inject, isSubsequenceOf, levenshteinDistance, name, rankClosestCatalogNames, unknownSkillLine };
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # pnpm run verify-translation-pairing --write packages/todo/tool-todo/README.md
5
- README.md: 0547688d833f10ae9504496d703ed7532e397e3e
6
- README.zh.md: 1bf055cb769455802620a7d7c77dc80851456ffe
5
+ README.md: 55fd51cdc51f6144e138c760f66b632ffdf8c813
6
+ README.zh.md: d59c887156414405bea4687c937035c699ac7e83
@@ -49,7 +49,7 @@ The generated [configuration catalog](../../../docs/config-catalog.md#deepseek-a
49
49
 
50
50
  ### What each call does
51
51
 
52
- The agent sends the ENTIRE list on every update; the new list replaces the previous one, so there are no partial updates or per-item edits. Each item is a short task description plus a status of `pending`, `in_progress`, or `completed`. A successful update returns the new counts — `Updated todo list: <pending> pending, <inProgress> in progress, <completed> completed.` — and the UI shows the new plan. Updates fail visibly when a task description is empty or duplicated, when an item carries fields beyond the description and status, or — when parallel work is disabled — when more than one task is marked in progress.
52
+ The agent sends the ENTIRE list on every update; the new list replaces the previous one, so there are no partial updates or per-item edits. Each item is a short task description plus a status of `pending`, `in_progress`, or `completed`. A successful update that changes the list returns `Updated todo list: <pending> pending, <inProgress> in progress, <completed> completed.` and the UI shows the new plan; rewriting the same canonical list returns `todo list unchanged` without appending another snapshot. Updates fail visibly when a task description is empty or duplicated, when an item carries fields beyond the description and status, or — when parallel work is disabled — when more than one task is marked in progress.
53
53
 
54
54
  ### Single owner
55
55
 
@@ -99,7 +99,7 @@ The invariant companion registers on `ctx.invariants`, validates existing and ne
99
99
 
100
100
  ### Call mechanics
101
101
 
102
- Each call validates the submitted list against the schema, rejects incoherent input, and on success appends the full snapshot as a `todo/write` session event and returns the new counts; the current list is always the most recent `todo/write` in the log (last-write-wins on replay). See [src/index.ts](src/index.ts) for the exact validation and append steps.
102
+ Each call validates the submitted list against the schema and rejects incoherent input. A list that differs from the latest `todo/write` snapshot appends a new snapshot and returns the updated counts; a canonical match — trimmed unique content plus status, same order — returns success without appending. The current list is always the most recent `todo/write` in the log (last-write-wins on replay). See [src/index.ts](src/index.ts) for the exact validation and append steps.
103
103
 
104
104
  </details>
105
105
 
@@ -140,7 +140,7 @@ Prefix-stable while the definition and visibility are unchanged. Plugin lifecycl
140
140
 
141
141
  #### What the model sees
142
142
 
143
- Each assistant tool call retains the entire replacement list in its arguments. Success returns exactly `Updated todo list: <pending> pending, <inProgress> in progress, <completed> completed.` Stable failures are ``Error: invalid todo: `content` must be a non-empty string``, `Error: invalid todos: duplicate content "<content>"`, `Error: todo_write requires an owning agent session`, and — only where the deployment set `allowParallelInProgress: false` — `Error: invalid todos: at most one task may be in_progress (got <n>)`. The full `todo/write` session event is UI and replay state, not a second model message.
143
+ Each assistant tool call retains the entire replacement list in its arguments. Success returns exactly `Updated todo list: <pending> pending, <inProgress> in progress, <completed> completed.` when the list changed, and exactly `todo list unchanged` when the canonical list already matches the latest snapshot. Stable failures are ``Error: invalid todo: `content` must be a non-empty string``, `Error: invalid todos: duplicate content "<content>"`, `Error: todo_write requires an owning agent session`, and — only where the deployment set `allowParallelInProgress: false` — `Error: invalid todos: at most one task may be in_progress (got <n>)`. The full `todo/write` session event is UI and replay state, not a second model message.
144
144
 
145
145
  #### Token effect
146
146
 
@@ -49,7 +49,7 @@ kind: "package-reference"
49
49
 
50
50
  ### 每次调用做什么
51
51
 
52
- agent 每次更新都发送完整列表;新列表替换旧列表,因此没有部分更新或逐项编辑。每个条目是一句简短的任务描述,外加 `pending`、`in_progress` 或 `completed` 状态。成功的更新会返回新的计数——`Updated todo list: <pending> pending, <inProgress> in progress, <completed> completed.`——UI 随即展示新计划。任务描述为空或重复、条目带有描述与状态之外的字段、或(禁用并行时)多个任务被标记为进行中,这些情况下更新都会明确失败。
52
+ agent 每次更新都发送完整列表;新列表替换旧列表,因此没有部分更新或逐项编辑。每个条目是一句简短的任务描述,外加 `pending`、`in_progress` 或 `completed` 状态。改变列表的成功更新会返回 `Updated todo list: <pending> pending, <inProgress> in progress, <completed> completed.`,UI 随即展示新计划;重写同一份规范列表则返回 `todo list unchanged`,且不再追加快照。任务描述为空或重复、条目带有描述与状态之外的字段、或(禁用并行时)多个任务被标记为进行中,这些情况下更新都会明确失败。
53
53
 
54
54
  ### 单一所有者
55
55
 
@@ -99,7 +99,7 @@ agent 每次更新都发送完整列表;新列表替换旧列表,因此没
99
99
 
100
100
  ### 调用机制
101
101
 
102
- 每次调用都会先校验提交的列表是否符合 schema,拒绝不一致的输入,成功后把完整快照作为 `todo/write` 会话事件追加并返回新的计数;当前列表始终是日志中最近一次 `todo/write`(回放时后写覆盖先写)。确切的校验与追加步骤见 [src/index.ts](src/index.ts)。
102
+ 每次调用都会先校验提交的列表是否符合 schema,并拒绝不一致的输入。与最近一次 `todo/write` 快照不同的列表会追加新快照并返回更新后的计数;规范匹配——去空白后的唯一 content 加 status、顺序相同——则成功返回且不追加。当前列表始终是日志中最近一次 `todo/write`(回放时后写覆盖先写)。确切的校验与追加步骤见 [src/index.ts](src/index.ts)。
103
103
 
104
104
  </details>
105
105
 
@@ -140,7 +140,7 @@ agent 每次更新都发送完整列表;新列表替换旧列表,因此没
140
140
 
141
141
  #### 模型看到什么
142
142
 
143
- 每次 assistant 工具调用都会在参数中保留整个替换列表。成功时原样返回 `Updated todo list: <pending> pending, <inProgress> in progress, <completed> completed.`。稳定失败文本为 ``Error: invalid todo: `content` must be a non-empty string``、`Error: invalid todos: duplicate content "<content>"`、`Error: todo_write requires an owning agent session`,以及——仅在部署设置 `allowParallelInProgress: false` 时——`Error: invalid todos: at most one task may be in_progress (got <n>)`。完整的 `todo/write` 会话事件是 UI 与回放状态,而非第二条模型消息。
143
+ 每次 assistant 工具调用都会在参数中保留整个替换列表。成功时,列表已变化则原样返回 `Updated todo list: <pending> pending, <inProgress> in progress, <completed> completed.`,规范列表已与最近快照相同则原样返回 `todo list unchanged`。稳定失败文本为 ``Error: invalid todo: `content` must be a non-empty string``、`Error: invalid todos: duplicate content "<content>"`、`Error: todo_write requires an owning agent session`,以及——仅在部署设置 `allowParallelInProgress: false` 时——`Error: invalid todos: at most one task may be in_progress (got <n>)`。完整的 `todo/write` 会话事件是 UI 与回放状态,而非第二条模型消息。
144
144
 
145
145
  #### Token 影响
146
146
 
@@ -3,9 +3,10 @@ import { z as z$1 } from "zod";
3
3
  import { defineTool } from "@deepseek-ai/dsh-tools";
4
4
  //#region lib/types/index.js
5
5
  /**
6
- * Model-facing whole-list replacement. Each call appends a `todo/write` snapshot to the calling
7
- * agent's session; replay is last-write-wins, and UIs render from session events. A non-agent
8
- * caller has no owning list and is rejected. Named exports preserve loader injection metadata.
6
+ * Model-facing whole-list replacement. A changing write appends a `todo/write` snapshot to the
7
+ * calling agent's session; an identical canonical list succeeds without appending. Replay is
8
+ * last-write-wins, and UIs render from session events. A non-agent caller has no owning list and
9
+ * is rejected. Named exports preserve loader injection metadata.
9
10
  * @module @deepseek-ai/dsh-tool-todo
10
11
  */
11
12
  const name = "tool-todo";
@@ -60,6 +61,24 @@ function toTodoList(raw, allowParallel) {
60
61
  if (!allowParallel && active > 1) throw new Error(`invalid todos: at most one task may be in_progress (got ${active})`);
61
62
  return todos;
62
63
  }
64
+ /**
65
+ * Compare two canonical lists: trimmed unique content plus status, same order.
66
+ * @param left - one canonical list.
67
+ * @param right - the other canonical list.
68
+ * @returns whether every item matches at the same index.
69
+ */
70
+ function sameTodoList(left, right) {
71
+ return JSON.stringify(left) === JSON.stringify(right);
72
+ }
73
+ /**
74
+ * Read the latest whole-list snapshot from the owning session log. The standing-plan
75
+ * projection is not this source: `turn/start` clears it while the durable write remains.
76
+ * @param session - the calling agent's session.
77
+ * @returns the latest `todo/write` list, or `undefined` before the first write.
78
+ */
79
+ function latestWrittenTodos(session) {
80
+ return session.snapshotEvents().findLast((event) => event.type === "todo/write")?.data.todos;
81
+ }
63
82
  /** Wire payload schema of the `todos` projection (whole list or pre-first-write null). */
64
83
  const todosProjectionSchema = z$1.union([z$1.array(z$1.object({
65
84
  content: z$1.string(),
@@ -159,18 +178,24 @@ function apply(ctx, config) {
159
178
  required: true
160
179
  }
161
180
  }
181
+ },
182
+ unchanged: {
183
+ type: "boolean",
184
+ required: true
162
185
  }
163
186
  }
164
187
  },
165
188
  render: (_args, value) => [{
166
189
  type: "text",
167
- text: `Updated todo list: ${value.counts.pending} pending, ${value.counts.inProgress} in progress, ${value.counts.completed} completed.`
190
+ text: value.unchanged ? "todo list unchanged" : `Updated todo list: ${value.counts.pending} pending, ${value.counts.inProgress} in progress, ${value.counts.completed} completed.`
168
191
  }]
169
192
  },
170
193
  execute(args, exec) {
171
194
  const todos = toTodoList(args.todos, allowParallel);
172
195
  if (!exec.agent) throw new Error("todo_write requires an owning agent session");
173
- exec.agent.session.append("todo/write", { todos });
196
+ const previous = latestWrittenTodos(exec.agent.session);
197
+ const unchanged = previous !== void 0 && sameTodoList(previous, todos);
198
+ if (!unchanged) exec.agent.session.append("todo/write", { todos });
174
199
  const count = (status) => todos.filter((t) => t.status === status).length;
175
200
  return Promise.resolve({
176
201
  todos: todos.map((todo) => ({
@@ -181,7 +206,8 @@ function apply(ctx, config) {
181
206
  pending: count("pending"),
182
207
  inProgress: count("in_progress"),
183
208
  completed: count("completed")
184
- }
209
+ },
210
+ unchanged
185
211
  });
186
212
  },
187
213
  presentCall: (args) => ({
@@ -1,7 +1,8 @@
1
1
  /**
2
- * Model-facing whole-list replacement. Each call appends a `todo/write` snapshot to the calling
3
- * agent's session; replay is last-write-wins, and UIs render from session events. A non-agent
4
- * caller has no owning list and is rejected. Named exports preserve loader injection metadata.
2
+ * Model-facing whole-list replacement. A changing write appends a `todo/write` snapshot to the
3
+ * calling agent's session; an identical canonical list succeeds without appending. Replay is
4
+ * last-write-wins, and UIs render from session events. A non-agent caller has no owning list and
5
+ * is rejected. Named exports preserve loader injection metadata.
5
6
  * @module @deepseek-ai/dsh-tool-todo
6
7
  */
7
8
  import z from '@deepseek-ai/schemastery';
@@ -74,6 +75,24 @@ function toTodoList(raw, allowParallel) {
74
75
  }
75
76
  return todos;
76
77
  }
78
+ /**
79
+ * Compare two canonical lists: trimmed unique content plus status, same order.
80
+ * @param left - one canonical list.
81
+ * @param right - the other canonical list.
82
+ * @returns whether every item matches at the same index.
83
+ */
84
+ function sameTodoList(left, right) {
85
+ return JSON.stringify(left) === JSON.stringify(right);
86
+ }
87
+ /**
88
+ * Read the latest whole-list snapshot from the owning session log. The standing-plan
89
+ * projection is not this source: `turn/start` clears it while the durable write remains.
90
+ * @param session - the calling agent's session.
91
+ * @returns the latest `todo/write` list, or `undefined` before the first write.
92
+ */
93
+ function latestWrittenTodos(session) {
94
+ return session.snapshotEvents().findLast(event => event.type === 'todo/write')?.data.todos;
95
+ }
77
96
  /** Wire payload schema of the `todos` projection (whole list or pre-first-write null). */
78
97
  const todosProjectionSchema = zod.union([
79
98
  zod.array(zod.object({
@@ -158,11 +177,14 @@ export function apply(ctx, config) {
158
177
  completed: { type: 'integer', required: true },
159
178
  },
160
179
  },
180
+ unchanged: { type: 'boolean', required: true },
161
181
  },
162
182
  },
163
183
  render: (_args, value) => [{
164
184
  type: 'text',
165
- text: `Updated todo list: ${value.counts.pending} pending, ${value.counts.inProgress} in progress, ${value.counts.completed} completed.`,
185
+ text: value.unchanged
186
+ ? 'todo list unchanged'
187
+ : `Updated todo list: ${value.counts.pending} pending, ${value.counts.inProgress} in progress, ${value.counts.completed} completed.`,
166
188
  }],
167
189
  },
168
190
  execute(args, exec) {
@@ -172,7 +194,10 @@ export function apply(ctx, config) {
172
194
  // session) has nowhere to write it. Reject rather than silently no-op.
173
195
  throw new Error('todo_write requires an owning agent session');
174
196
  }
175
- exec.agent.session.append('todo/write', { todos });
197
+ const previous = latestWrittenTodos(exec.agent.session);
198
+ const unchanged = previous !== undefined && sameTodoList(previous, todos);
199
+ if (!unchanged)
200
+ exec.agent.session.append('todo/write', { todos });
176
201
  const count = (status) => todos.filter(t => t.status === status).length;
177
202
  return Promise.resolve({
178
203
  todos: todos.map(todo => ({ content: todo.content, status: todo.status })),
@@ -181,6 +206,7 @@ export function apply(ctx, config) {
181
206
  inProgress: count('in_progress'),
182
207
  completed: count('completed'),
183
208
  },
209
+ unchanged,
184
210
  });
185
211
  },
186
212
  presentCall: args => ({ card: 'generic', title: 'Update todo list', kind: 'other', rawInput: args.todos }),
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # pnpm run verify-translation-pairing --write packages/bundle/tui-app/README.md
5
- README.md: b96a38f5e0d042e701f0e994aa508474316fddda
6
- README.zh.md: 537d1b8aae4006b2050a9aa29810d53cdb5af9e4
5
+ README.md: 11567568640439cc4ecb48ce7aa37c31615e58c1
6
+ README.zh.md: 85d202e1ca040030921db665b0b5bc44b8ce83ed
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
9
9
 
10
10
  ## Summary
11
11
 
12
- `dsh-tui-app` is the terminal surface of dsh: `dsh tui` starts a multi-turn session in your terminal, with no browser and no server. Replies stream, tool calls become foldable cards, approvals and `ask_user_question` questions appear above the input, `@` completes paths and sessions, and `/`-commands share the Web registry. Arrow keys walk the conversation through a docked inspector; `Ctrl+G` reads it full screen, turns side by side. Persisted sessions reopen through `/resume`, `/sessions`, or startup `--resume`; `/new` and `/fork` create them, and `/export` writes ZIPs. It runs `dsh web`'s model, tools, and safety defaults, one session at a time.
12
+ `dsh-tui-app` is the terminal surface of dsh: `dsh tui` starts a multi-turn session in your terminal, with no browser and no server. Replies stream, tool calls become foldable cards, approvals and `ask_user_question` questions appear above the input, `@` completes paths and sessions, and `/`-commands share the Web registry. Arrow keys walk the conversation through a docked inspector; `Ctrl+G` reads it full screen, turns side by side. Persisted sessions reopen through `/resume`, `/sessions`, or startup `--resume`; `/new`, `/clear`, and `/fork` create them, and `/export` writes ZIPs. It runs `dsh web`'s model, tools, and safety defaults, one session at a time.
13
13
 
14
14
  ## Table of Contents
15
15
 
@@ -36,13 +36,13 @@ dsh tui --resume <session-id> # continue an earlier session
36
36
  dsh tui --no-open # print sign-in URLs without opening a browser
37
37
  ```
38
38
 
39
- On quit the app prints `dsh: session <id> saved; resume with: dsh --profile tui --resume <id>` on stderr for the session bound at that moment. A resumed session redraws its persisted history before accepting input; inside the terminal, `/resume` and `/sessions` open the same picker over every persisted root session and resume the selected previous session, `/new` starts a fresh one, and `/fork` copies the current session up to its last completed turn into a new one, the same cut the browser's fork takes. Switching releases the previous Agent and redraws the transcript of the next.
39
+ On quit the app prints `dsh: session <id> saved; resume with: dsh --profile tui --resume <id>` on stderr for the session bound at that moment. A resumed session redraws its persisted history before accepting input; inside the terminal, `/resume` and `/sessions` open the same picker over every persisted root session and resume the selected previous session, `/new` and `/clear` each start a fresh empty one while the previous session stays on disk for `/resume`, and `/fork` copies the current session up to its last completed turn into a new one, the same cut the browser's fork takes. Switching releases the previous Agent and redraws the transcript of the next.
40
40
 
41
41
  ### The screen
42
42
 
43
- The header names the session by its title once one is generated or set, with the id beside it. The transcript grows in the terminal's own scrollback: your prompts start with `›` (attachments listed under them), assistant reasoning is dim above the Markdown reply, and each tool call is a card with a status glyph, the tool name, the presenter headline, and a body folded to `toolPreviewLines` rows. A nonempty system prompt and each injected context — instructions, catalogs, snapshots, notices, relays, and recalls — draw as a dim `⬡` title over the first `contextPreviewLines` rows of their model-facing text, with each snapshot contribution named above its own rows; an empty system prompt and a compaction replacement are omitted. A tool card and a context block that carry more rows than they draw end on one marker: `… <n> more rows · Space expands` while the conversation's focus holds that block, and `… <n> more rows · Ctrl+O expands` otherwise. Fenced code in a reply, the file rows of a `read` card, and the changed rows of an `edit` or `write` diff card — behind their line numbers and `+` / `-` signs, in the language the file's extension names — are drawn in syntax colours from a theme the terminal's own background picks, light or dark; the grammar of a language loads on the first block that asks for it, so that block draws plain and is repainted in colour a moment later, and a language with no grammar here, a terminal that reports neither 24-bit nor 256 colours, and `codeHighlight: false` each draw every block plain. Streamed reply text fades in and every word keeps its own clock: a word enters near the terminal's background color and brightens to the color it settles in over `streamFadeSteps` ticks of `streamFadeStepMs` each, so a fast stream leaves a longer trail of brightening words rather than a darker one. Streamed reasoning and a tool card float out over the same duration: they appear at a lifted color and recede to the dim italic or palette colors they settle in; a card redrawn from persisted history carries no fade, and text that has settled is never dimmed again.
43
+ The header names the session by its title once one is generated or set, with the id beside it. The transcript grows in the terminal's own scrollback: your prompts start with `›` (attachments listed under them), assistant reasoning is dim above the Markdown reply, and each tool call is a card with a status glyph, the tool name, the presenter headline, and a body folded to `toolPreviewLines` rows. A nonempty system prompt and each injected context — instructions, catalogs, snapshots, notices, relays, and recalls — draw as a dim `⬡` title over the first `contextPreviewLines` rows of their model-facing text, with each snapshot contribution named above its own rows; an empty system prompt and a compaction replacement are omitted. A tool card and a context block that carry more rows than they draw end on one marker: `… <n> more rows · Space expands` while the conversation's focus holds that block, and `… <n> more rows · Ctrl+O expands` otherwise. Fenced code in a reply, the file rows of a `read` card, and the changed rows of an `edit` or `write` diff card — with `+` additions marked green, `-` removals red, and source text behind those signs drawn in the language the file's extension names — use syntax colours from a theme the terminal's own background picks, light or dark; the grammar of a language loads on the first block that asks for it, so that block draws plain and is repainted in colour a moment later, and a language with no grammar here, a terminal that reports neither 24-bit nor 256 colours, and `codeHighlight: false` each draw every block plain. Streamed reply text fades in and every word keeps its own clock: a word enters near the terminal's background color and brightens to the color it settles in over `streamFadeSteps` ticks of `streamFadeStepMs` each, so a fast stream leaves a longer trail of brightening words rather than a darker one. Streamed reasoning and a tool card float out over the same duration: they appear at a lifted color and recede to the dim italic or palette colors they settle in; a card redrawn from persisted history carries no fade, and text that has settled is never dimmed again.
44
44
 
45
- Below the transcript sit a spinner while the agent works, any open prompt, the editor, the subagent panel, and the footer: a status bar that, unfocused, is one line built from both ends inward. The editor's caret is the terminal's own blinking bar: the app asks for that shape at start, gives your default back on quit, and draws no caret at all while the status bar or the panel holds the keyboard. The model is anchored at the left edge and is never dropped — past 20 columns it falls back to the bare model name, and only a label still too wide for that is ellipsized — and the two keys that leave the input are anchored at the right edge as `Shift+↑ read · Shift+↓ status`, narrowing to `Shift+↑↓ nav` and dropped below 40 columns. The key facts fill whatever middle is left, in bar order: effort (`effort default` when the selection leaves reasoning to the model), the running turn's elapsed time, the context window percentage, the todo counts, and the workspace path (shortened with `~` and `…/` when long). Every segment that middle cannot hold folds into a trailing `+N`, together with the segments the unfocused line never draws — the permission preset, cumulative token usage, the goal and plan-mode markers from the projection seam, and the count of pending attachments. Compaction and model-request retries appear as notices, the same facts the browser's markers carry.
45
+ Below the transcript sit a spinner while the agent works, any open prompt, a framed pending-prompt panel while messages wait, the editor, the subagent panel, and the footer: a status bar that, unfocused, is one line built from both ends inward. The editor's caret is the terminal's own blinking bar: the app asks for that shape at start, gives your default back on quit, and draws no caret at all while the status bar or the panel holds the keyboard. The model is anchored at the left edge and is never dropped — past 20 columns it falls back to the bare model name, and only a label still too wide for that is ellipsized — and the two keys that leave the input are anchored at the right edge as `Shift+↑ read · Shift+↓ status`, narrowing to `Shift+↑↓ nav` and dropped below 40 columns. The key facts fill whatever middle is left, in bar order: effort (`effort default` when the selection leaves reasoning to the model), the running turn's elapsed time, the context window percentage, the todo counts, and the workspace path (shortened with `~` and `…/` when long). Every segment that middle cannot hold folds into a trailing `+N`, together with the segments the unfocused line never draws — the permission preset, cumulative token usage, the goal and plan-mode markers from the projection seam, and the count of pending attachments. Compaction and model-request retries appear as notices, the same facts the browser's markers carry.
46
46
 
47
47
  While the keyboard walks the conversation a framed inspector is docked directly above the editor, and the frame is the mode: it is drawn exactly while the conversation holds the keyboard. Its top rule carries an inverse ` ● READ ` chip and the focused section's heading — the section's position among the navigable blocks, the turn it belongs to, and what the section is — as in `╭ ● READ ─ 3/12 · turn 2 · bash git status · result ─╮`. Under it the block's parts draw as a numbered wrapping strip like `← 1 call · [2 result] →` when the block has more than one, the held label bracketed as well as accented so the selection is legible with no color at all; then the section's own source rows, each prefixed with `│ ` and wrapped two columns narrower, folded at `focusPreviewLines` for every section kind — a system prompt and an injected context included — with `… <n> more rows · Ctrl+G reads it` under them. The bottom rule carries the keys the conversation answers, `↑↓ sections · ←→ parts · Space folds · Ctrl+G reader · Esc input`, narrowed to `↑↓ ←→ · Space folds · Esc input` and then to `Esc input` as the terminal loses columns.
48
48
 
@@ -58,13 +58,13 @@ The subagent panel is drawn while a subagent session under the bound one is resi
58
58
 
59
59
  ### Keys and commands
60
60
 
61
- The conversation, the input, the subagent panel, and the status bar stack in the order the screen draws them, and `Up` / `Down` walk that stack through the input: `Down` at the newest section, `Up` on the panel's first row, and `Up` on the status bar with no panel drawn all land at the caret. While a region other than the editor has the keyboard, `Tab` and `Shift+Tab` walk the regions that are drawn, wrapping at both ends; in the editor, `Tab` takes the offered completion and `Shift+Tab` opens the reasoning-effort picker. A printable key pressed in any of them returns to the input and types there, so a sentence started while reading lands where it was aimed; `Space` in the conversation is the one exception, and folds the marked tool card or context block. `Ctrl+G` and `Ctrl+O` mean the same thing in every one of those regions, and `Ctrl+C` and `Ctrl+D` return the keyboard to the input before they act. A prompt and the reader own their whole key stream instead, and answer `Ctrl+C` by giving the keyboard back.
61
+ The conversation, input, subagent panel, and status bar form the vertical arrow-key walk: `Down` at the newest section, `Up` on the subagent panel's first row, and `Up` on the status bar with no subagent panel drawn all land at the caret. The queued-prompt panel sits above the input; `Shift+Down` enters it while it is drawn, and it joins the `Tab` walk. While a region other than the editor has the keyboard, `Tab` and `Shift+Tab` walk the regions that are drawn, wrapping at both ends; in the editor, `Tab` takes the offered completion and `Shift+Tab` opens the reasoning-effort picker. A printable key pressed in any of them returns to the input and types there, so a sentence started while reading lands where it was aimed; `Space` in the conversation is the one exception, and folds the marked tool card or context block. `Ctrl+G` and `Ctrl+O` mean the same thing in every one of those regions, and `Ctrl+C` and `Ctrl+D` return the keyboard to the input before they act. A prompt and the reader own their whole key stream instead, and answer `Ctrl+C` by giving the keyboard back.
62
62
 
63
63
  While the input has the keyboard:
64
64
 
65
65
  | Key | Effect |
66
66
  |---|---|
67
- | `Enter` | Send the editor text; while a turn runs it is queued for the next turn and waits as a dim `⏳ next turn` row above the editor until the loop claims it, entering the conversation then |
67
+ | `Enter` | Send the editor text; while a turn runs it waits for the next turn in the framed `QUEUE` panel above the editor until the loop claims it, entering the conversation then |
68
68
  | `Shift+Enter` | Insert a newline |
69
69
  | `Ctrl+S` | While a turn runs, steer the editor text into the running turn's next step |
70
70
  | `Up` / `Down` | Recall earlier prompts |
@@ -72,7 +72,7 @@ While the input has the keyboard:
72
72
  | `Tab` | Take the completion the editor offers |
73
73
  | `Shift+Tab` | Open the current model's reasoning-effort picker for the next request, the same picker as empty `/effort` |
74
74
  | `Shift+Up` | Focus the conversation on the section the walk stopped at; a first entry, and the entry after a session switch, land on the newest section |
75
- | `Shift+Down` | Focus the subagent panel's first row while it is drawn, and the status bar otherwise |
75
+ | `Shift+Down` | Focus the queued-prompt panel's first row while prompts wait, otherwise the subagent panel's first row while it is drawn, and the status bar otherwise |
76
76
  | `Ctrl+G` | Read the conversation full screen, on its newest section |
77
77
  | `Ctrl+O` | Expand or collapse every tool card and context row |
78
78
  | `Esc` | Arm the stop and say so; a second press while that line is on screen stops the running turn, and queued messages stay queued |
@@ -81,6 +81,18 @@ While the input has the keyboard:
81
81
 
82
82
  An `Esc` that only handed the keyboard back — leaving a region, closing a page, a picker, or the reader — opens a 750 ms window in which an `Esc` reaching the input does nothing at all, so a habitual double press stops no turn. With no turn running, `Esc` closes the completion list while one is open and is silent otherwise. A session with nothing to read yet answers `Shift+Up` and `Ctrl+G` with `nothing in the transcript to read yet` and leaves the keyboard in the input.
83
83
 
84
+ While the queued-prompt panel has the keyboard:
85
+
86
+ | Key | Effect |
87
+ |---|---|
88
+ | `Up` / `Down`, `Home` / `End` | Select a pending prompt |
89
+ | `S` | Remove the selected prompt from its queue and steer it into the nearest step, waking the Agent |
90
+ | `I` | Move the selected prompt to next-step injection without waking the Agent |
91
+ | `E` | Remove the selected prompt into the editor; `Enter` sends the revision and `Ctrl+C` restores the original prompt to the next-turn queue |
92
+ | `Tab` / `Shift+Tab` | The next / previous region that is drawn |
93
+ | `Esc` | Return to the input |
94
+ | Any other printable key | Return to the input and type the character at the caret |
95
+
84
96
  While the conversation has the keyboard:
85
97
 
86
98
  | Key | Effect |
@@ -152,6 +164,7 @@ Typing `/` at the start of the editor completes the terminal's own commands and
152
164
  | `/resume` | Open the same persisted-session picker as `/sessions` and resume the selected previous session |
153
165
  | `/sessions` | Open the persisted-session picker and switch to the selected session |
154
166
  | `/new` | Start a new session |
167
+ | `/clear` | Start a new session with empty context; the previous session stays on disk and is resumable with `/resume` |
155
168
  | `/fork [turn]` | Fork this session at its last completed turn, or after turn `turn` |
156
169
  | `/title <text>` | Rename this session; alone it shows the current title |
157
170
  | `/attach <path>` | Attach an image or file to the next prompt; `/attach` lists, `/attach clear` drops them |
@@ -327,7 +340,7 @@ The runner adds nothing to the request prefix; a `/model` switch starts a new re
327
340
 
328
341
  These limits describe the terminal surface as shipped; they are not a general CLI comparison or a task backlog.
329
342
 
330
- - **One session at a time** — `/resume`, `/sessions`, `/new`, and `/fork` move the terminal between sessions, but only the bound Agent streams; the browser shows several sessions side by side.
343
+ - **One session at a time** — `/resume`, `/sessions`, `/new`, `/clear`, and `/fork` move the terminal between sessions, but only the bound Agent streams; the browser shows several sessions side by side.
331
344
  - **Approvals are one-shot** — the prompt offers allow once or reject, matching the approval seam's vocabulary; there is no remembered grant.
332
345
  - **Browser-only pages stay in the browser** — workspace and directory pickers, open-in-app links, the trajectory ledger, and per-message like/dislike have no terminal counterpart; `/settings`, `/plugins`, `/subagents`, `/outline`, and the shared `/feedback` cover their facts as text, and subagent transcripts are read by switching to the child session.
333
346
  - **Deliverables are named, not opened** — `/deliverables` lists the presented paths and `/changes` shows line comparisons; the browser previews the files.