@songtonyli/dsh-cli 0.1.17 → 0.1.19

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 (59) hide show
  1. package/README.md +1 -1
  2. package/bin/dsh.mjs +1 -1
  3. package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/client/sessions/queue-mirror.js +61 -0
  4. package/node_modules/@deepseek-ai/dsh-client-locale/lib/client.js +7 -7
  5. package/node_modules/@deepseek-ai/dsh-client-ui-agent-preset/lib/client.js +61 -61
  6. package/node_modules/@deepseek-ai/dsh-client-ui-approval/lib/client.js +11 -11
  7. package/node_modules/@deepseek-ai/dsh-client-ui-attachment/lib/client.js +55 -55
  8. package/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/client.js +182 -182
  9. package/node_modules/@deepseek-ai/dsh-client-ui-commands/lib/client.js +16 -16
  10. package/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/client.js +151 -151
  11. package/node_modules/@deepseek-ai/dsh-client-ui-cordis/lib/client.js +74 -74
  12. package/node_modules/@deepseek-ai/dsh-client-ui-deliverables/lib/client.js +76 -76
  13. package/node_modules/@deepseek-ai/dsh-client-ui-directory-picker-browse/lib/client.js +39 -39
  14. package/node_modules/@deepseek-ai/dsh-client-ui-goal/lib/client.js +16 -16
  15. package/node_modules/@deepseek-ai/dsh-client-ui-input-trigger/lib/client.js +23 -23
  16. package/node_modules/@deepseek-ai/dsh-client-ui-jobs/lib/client.js +15 -15
  17. package/node_modules/@deepseek-ai/dsh-client-ui-layout/lib/client.js +8 -8
  18. package/node_modules/@deepseek-ai/dsh-client-ui-message-feedback/lib/client.js +13 -13
  19. package/node_modules/@deepseek-ai/dsh-client-ui-model-selection/lib/client.js +27 -27
  20. package/node_modules/@deepseek-ai/dsh-client-ui-open-in-app/lib/client.js +6 -6
  21. package/node_modules/@deepseek-ai/dsh-client-ui-permission-presets/lib/client.js +18 -18
  22. package/node_modules/@deepseek-ai/dsh-client-ui-plan/lib/client.js +22 -22
  23. package/node_modules/@deepseek-ai/dsh-client-ui-plugin-manager/lib/client.js +115 -115
  24. package/node_modules/@deepseek-ai/dsh-client-ui-schedule/lib/client.js +14 -14
  25. package/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/client.js +40 -40
  26. package/node_modules/@deepseek-ai/dsh-client-ui-settings-models/lib/client.js +85 -85
  27. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/lib/client.js +35 -35
  28. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/client.js +61 -61
  29. package/node_modules/@deepseek-ai/dsh-client-ui-settings-signin/lib/client.js +24 -24
  30. package/node_modules/@deepseek-ai/dsh-client-ui-settings-unarchive-sessions/lib/client.js +10 -10
  31. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +41 -41
  32. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-browser/lib/client.js +17 -17
  33. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/lib/client.js +68 -68
  34. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/lib/client.pdf.js +12 -12
  35. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-files/lib/client.js +21 -21
  36. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-right/lib/client.js +24 -24
  37. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-terminal/lib/client.js +18 -18
  38. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar-terminal/lib/client.terminal.js +11 -11
  39. package/node_modules/@deepseek-ai/dsh-client-ui-skill/lib/client.js +19 -19
  40. package/node_modules/@deepseek-ai/dsh-client-ui-subagent/lib/client.js +38 -38
  41. package/node_modules/@deepseek-ai/dsh-client-ui-theme/lib/client.js +25 -25
  42. package/node_modules/@deepseek-ai/dsh-client-ui-tool/lib/client.js +70 -70
  43. package/node_modules/@deepseek-ai/dsh-client-ui-trajectory/lib/client.js +198 -198
  44. package/node_modules/@deepseek-ai/dsh-client-ui-user-questions/lib/client.js +50 -50
  45. package/node_modules/@deepseek-ai/dsh-client-ui-workflow-run/lib/client.js +24 -24
  46. package/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/client.js +81 -81
  47. package/node_modules/@deepseek-ai/dsh-experimental-client-ui-agent-team/lib/client.js +25 -25
  48. package/node_modules/@deepseek-ai/dsh-llm-cursor/README.i18n.yaml +2 -2
  49. package/node_modules/@deepseek-ai/dsh-llm-cursor/README.md +12 -6
  50. package/node_modules/@deepseek-ai/dsh-llm-cursor/README.zh.md +12 -6
  51. package/node_modules/@deepseek-ai/dsh-llm-cursor/lib/index.js +548 -51
  52. package/node_modules/@deepseek-ai/dsh-session-log-export/lib/client.js +3 -3
  53. package/node_modules/@deepseek-ai/dsh-subprocess-local/lib/runner-launch-UEJ3Ntqn.js +1511 -0
  54. package/node_modules/@deepseek-ai/dsh-tui-app/README.i18n.yaml +2 -2
  55. package/node_modules/@deepseek-ai/dsh-tui-app/README.md +126 -32
  56. package/node_modules/@deepseek-ai/dsh-tui-app/README.zh.md +125 -31
  57. package/node_modules/@deepseek-ai/dsh-tui-app/lib/index.js +3125 -356
  58. package/node_modules/@deepseek-ai/dsh-tui-app/lib/startup.js +3 -2
  59. package/package.json +1 -1
@@ -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/llm/llm-cursor/README.md
5
- README.md: ed90bf879f0f0a6e709b6008f0cd16f78e565a48
6
- README.zh.md: c18c787d2ff6b51945b08213b6738a82fdf28ca3
5
+ README.md: 115f31dabd27797f6e27f75ea58ec3d57574fe21
6
+ README.zh.md: 64290a131aa904e94bf1be85dafbef69025c6fe1
@@ -64,7 +64,9 @@ Sign-out is `deleteRecord` on that key. It does not revoke the session at Cursor
64
64
 
65
65
  Request-time token order is: launch-environment `CURSOR_ACCESS_TOKEN`, then the stored OAuth grant (refresh inside `modifyRecord` when near expiry), then optional Keychain / `state.vscdb` harvest when `reuseInstalledCursorLogin` is true. A stored DSH login wins over harvest.
66
66
 
67
- Each DSH model step is a new HTTP/2 Connect `Run` rebuilt from harness history, system prompt, and MCP tool definitions (`providerIdentifier: dsh`, `clientName: dsh`). Text, thinking, usage, and MCP tool calls become `StreamChunk`. An MCP tool call finishes the stream so the agent loop can run the tool locally; the next step is a new Run. Cursor-native workspace execs are rejected on the wire.
67
+ Each DSH model step is a new HTTP/2 Connect `Run` rebuilt from harness history, system prompt, and MCP tool definitions (`providerIdentifier: dsh`, `clientName: dsh`). Cursor's server builds the model prompt from `root_prompt_messages_json`, never renders `conversation_state.turns` into it, and discards a `{"role":"system"}` entry there in favour of its own prompt. The adapter therefore publishes the system prompt as a `<rules>` user prompt message and replays every prior turn as `user`, `assistant`, and `tool` prompt messages, naming historic MCP calls `mcp_dsh_<tool>` as Cursor does; the turn structures ride along for the server's bookkeeping. The request-context answer adds one global Cursor rule telling the model that Cursor's built-in tools return a rejection here and that the `mcp_dsh_` tools are the ones to call.
68
+
69
+ Text, thinking, usage, and MCP tool calls become `StreamChunk`. An MCP tool call finishes the stream so the agent loop can run the tool locally. The next Run replays that in-flight turn with its results and sends a fixed continuation notice as the user message a Run requires; a `resumeAction` is not used because the server restarts the turn from its user message instead of continuing it. A Cursor-native workspace exec (`read`, `shell`, `grep`, and kin) is answered with its typed rejection naming the harness tool to call instead, so the Run continues and the model reads the refusal as a tool outcome; an exec this build does not know fails the step.
68
70
 
69
71
  Attribution headers required by `LlmAdapter` go on every HTTP/2 request, with Cursor client headers `x-ghost-mode`, `x-cursor-client-version`, and `x-cursor-client-type`.
70
72
 
@@ -82,11 +84,11 @@ Attribution headers required by `LlmAdapter` go on every HTTP/2 request, with Cu
82
84
 
83
85
  #### What the model sees
84
86
 
85
- One rebuilt Cursor `AgentRunRequest`: the system prompt as a root blob, completed turns (user text plus assistant text, thinking, and MCP tool calls with results), the current user action, requested model id, and MCP tool definitions with `providerIdentifier: dsh`. Consecutive user-role messages with no assistant between them — the human prompt plus runtime-context snapshots, skill catalogs, and other injected user messages — join in order into that turn's user text, because a Run has one `userMessageAction`. Images are not sent as Cursor selected images. Native Cursor workspace tools are not offered.
87
+ One rebuilt Cursor `AgentRunRequest` whose `root_prompt_messages_json` carries the model-visible history: the system prompt as a `<rules>` user message, then each prior turn as a `<user_query>` user message, assistant messages holding text and `tool-call` parts named `mcp_dsh_<tool>`, and `tool` messages holding the results; thinking is not replayed. The current user action, requested model id, and MCP tool definitions with `providerIdentifier: dsh` complete the request. Consecutive user-role messages with no assistant between them — the human prompt plus runtime-context snapshots, skill catalogs, and other injected user messages — join in order into that turn's user text, because a Run has one `userMessageAction`. After locally executed tool calls, the in-flight turn is replayed with its results and the user action is the fixed notice `The results of your tool calls are in the tool messages above. Continue the task.`. The request context carries one global rule stating that Cursor's built-in tools return a rejection and naming the `mcp_dsh_` tools as the ones to call. Images reach the model as the harness's text-only placeholder because the route declares text-only input; no image bytes are sent. Cursor still offers its own built-in tools beside the harness MCP tools.
86
88
 
87
89
  #### Token effect
88
90
 
89
- Provider tokenization governs exact input. History is fully rebuilt on every DSH step, so the wire request is the current assembled messages rather than a resumed Cursor conversation.
91
+ Provider tokenization governs exact input. History is fully rebuilt on every DSH step, so the wire request is the current assembled messages rather than a resumed Cursor conversation. Replayed history travels twice on the wire, as prompt messages and as turn structures, but only the prompt messages reach the model. Cursor reports no prompt usage, so `inputTokens` is an estimate of one token per four characters of rules, replayed prompt messages, action text, and MCP tool definitions; `outputTokens` comes from Cursor's `tokenDelta` events.
90
92
 
91
93
  #### KV Cache effect
92
94
 
@@ -96,7 +98,7 @@ Each step is an independent Run. A changed system prompt, history, tool schema,
96
98
 
97
99
  #### What the model sees
98
100
 
99
- Text deltas, thinking deltas, token usage, and MCP tool calls become harness chunks. An MCP tool call finishes the stream with `tool-calls`; native execs fail the turn.
101
+ Text deltas, thinking deltas, token usage, and MCP tool calls become harness chunks. An MCP tool call finishes the stream with `tool-calls`. A native exec is answered with a rejection and the stream continues; an unknown exec fails the turn.
100
102
 
101
103
  #### Token effect
102
104
 
@@ -113,10 +115,14 @@ Loop-retained response blocks append to the next rebuilt Run. Unrecorded transpo
113
115
  These limits define where the adapter stops. They are current package constraints, not a Cursor product comparison.
114
116
 
115
117
  - **The integration is unofficial** — auth URLs, headers, client version, and `agent.v1` can change without notice and break this adapter.
116
- - **Native Cursor workspace execs are not executed** — `read`, `shell`, and kin are rejected so the turn cannot park inside Cursor; use harness MCP tools.
118
+ - **Native Cursor workspace execs are not executed** — `read`, `shell`, and kin receive a typed rejection naming the harness tool, so a model that picks one spends a round trip on the refusal before calling the `mcp_dsh_` tool.
117
119
  - **There is no parked HTTP/2 conversation** — each DSH step is a new Run; mid-tool resume on the same Cursor stream is out of scope.
120
+ - **Tool results reach the model as replayed prompt messages plus a fixed continuation notice** — Cursor delivers results in-stream natively; the notice is adapter-owned text the human never typed.
118
121
  - **`GenerateOptions.stop` is unsupported** — the unofficial Run does not map stop sequences.
119
- - **Images are not sent as Cursor selected images** — request images in history are omitted from the rebuilt Run.
122
+ - **Image bytes are not sent** — the route declares text-only input, so every image reaches the model as the harness's text-only placeholder rather than as a Cursor selected image.
123
+ - **`maxTokens`, `temperature`, and `reasoningEffort` are not mapped** — the Run has no fields for them; effort is chosen through the Cursor model id suffix such as `-high`.
124
+ - **Reasoning is not replayed** — Cursor renders no `reasoning` prompt part, so a thinking model re-derives its plan after each locally executed tool call.
125
+ - **Prompt token usage is an estimate** — Cursor reports none, so the TUI context meter shows the adapter's character-based estimate.
120
126
  - **Sign-out does not revoke at Cursor** — it only deletes the local grant; harvest can still satisfy the next request until `reuseInstalledCursorLogin` is false.
121
127
  - **Harvest can bill a different Cursor account** — a stored DSH grant wins; turn harvest off when this machine's IDE login is not the account to use.
122
128
  - **A sign-in lives only in the process that started it** — reloading the page mid-login abandons the attempt.
@@ -64,7 +64,9 @@ TUI:`/login llm-cursor/cursor`。无头不会打开浏览器;导出 `CURSOR_
64
64
 
65
65
  请求时令牌顺序为:启动环境中的 `CURSOR_ACCESS_TOKEN`,然后是已存储的 OAuth 授权(临近过期时在 `modifyRecord` 内刷新),然后在 `reuseInstalledCursorLogin` 为 true 时可选读取钥匙串 / `state.vscdb`。已存储的 DSH 登录优先于采集。
66
66
 
67
- DSH 的每一步模型调用是一次新的 HTTP/2 Connect `Run`,由 harness 历史、系统提示和 MCP 工具定义重建(`providerIdentifier: dsh`,`clientName: dsh`)。文本、thinking、用量与 MCP 工具调用变成 `StreamChunk`。一次 MCP 工具调用结束该流,以便 agent loop 在本地跑工具;下一步是新的 Run。Cursor 原生工作区 exec 在链路上被拒绝。
67
+ DSH 的每一步模型调用是一次新的 HTTP/2 Connect `Run`,由 harness 历史、系统提示和 MCP 工具定义重建(`providerIdentifier: dsh`,`clientName: dsh`)。Cursor 服务端只从 `root_prompt_messages_json` 构建模型提示,从不把 `conversation_state.turns` 渲染进去,并且会丢弃其中的 `{"role":"system"}` 条目而使用自己的提示。因此适配器把系统提示作为 `<rules>` user 提示消息发布,并把每个先前轮次重放为 `user`、`assistant` 和 `tool` 提示消息,历史 MCP 调用按 Cursor 的命名写成 `mcp_dsh_<tool>`;轮次结构一同发送,供服务端记账。请求上下文的应答额外带一条全局 Cursor 规则,告知模型 Cursor 内建工具在这里会返回拒绝,应调用 `mcp_dsh_` 工具。
68
+
69
+ 文本、thinking、用量与 MCP 工具调用变成 `StreamChunk`。一次 MCP 工具调用结束该流,以便 agent loop 在本地跑工具。下一次 Run 重放该进行中的轮次及其结果,并把一条固定的继续提示作为 Run 必需的用户消息发送;不使用 `resumeAction`,因为服务端会从该轮的用户消息重新开始而不是继续。Cursor 原生工作区 exec(`read`、`shell`、`grep` 及同类)以其类型化的拒绝应答,并指出应改用的 harness 工具,因此 Run 继续进行,模型把该拒绝当作工具结果读取;本构建不认识的 exec 会使该步失败。
68
70
 
69
71
  `LlmAdapter` 要求的归属头出现在每一次 HTTP/2 请求上,并带有 Cursor 客户端头 `x-ghost-mode`、`x-cursor-client-version` 和 `x-cursor-client-type`。
70
72
 
@@ -82,11 +84,11 @@ DSH 的每一步模型调用是一次新的 HTTP/2 Connect `Run`,由 harness
82
84
 
83
85
  #### 模型看见什么
84
86
 
85
- 一次重建的 Cursor `AgentRunRequest`:作为根 blob 的系统提示、已完成的轮次(用户文本加上助手文本、thinking,以及带结果的 MCP 工具调用)、当前用户动作、请求的模型 id,以及 `providerIdentifier: dsh` 的 MCP 工具定义。中间没有助手回复的连续 user 角色消息——人类提示加上运行时上下文快照、技能目录和其他注入的用户消息——按顺序拼进该轮的用户文本,因为一次 Run 只有一个 `userMessageAction`。图片不会作为 Cursor 选中图片发送。不提供原生 Cursor 工作区工具。
87
+ 一次重建的 Cursor `AgentRunRequest`,其 `root_prompt_messages_json` 承载模型可见的历史:系统提示作为 `<rules>` user 消息,然后每个先前轮次作为 `<user_query>` user 消息、承载文本和名为 `mcp_dsh_<tool>` 的 `tool-call` 部分的 assistant 消息,以及承载结果的 `tool` 消息;thinking 不重放。当前用户动作、请求的模型 id,以及 `providerIdentifier: dsh` 的 MCP 工具定义补全该请求。中间没有助手回复的连续 user 角色消息——人类提示加上运行时上下文快照、技能目录和其他注入的用户消息——按顺序拼进该轮的用户文本,因为一次 Run 只有一个 `userMessageAction`。本地执行工具调用之后,进行中的轮次连同其结果被重放,用户动作是固定提示 `The results of your tool calls are in the tool messages above. Continue the task.`。请求上下文带一条全局规则,声明 Cursor 内建工具会返回拒绝,并指出应调用 `mcp_dsh_` 工具。由于该路由声明只接受文本输入,图片以 harness 的纯文本占位符到达模型;不发送图片字节。Cursor 仍在 harness MCP 工具之外提供自己的内建工具。
86
88
 
87
89
  #### Token 影响
88
90
 
89
- 精确输入由提供方分词决定。历史在 DSH 的每一步完整重建,因此线路上的请求是当前组装好的消息,而不是恢复中的 Cursor 会话。
91
+ 精确输入由提供方分词决定。历史在 DSH 的每一步完整重建,因此线路上的请求是当前组装好的消息,而不是恢复中的 Cursor 会话。重放的历史在线路上传输两次——作为提示消息和作为轮次结构——但只有提示消息到达模型。Cursor 不报告提示用量,因此 `inputTokens` 是按规则、重放的提示消息、动作文本与 MCP 工具定义每四个字符一个 token 的估算;`outputTokens` 来自 Cursor 的 `tokenDelta` 事件。
90
92
 
91
93
  #### KV Cache 影响
92
94
 
@@ -96,7 +98,7 @@ DSH 的每一步模型调用是一次新的 HTTP/2 Connect `Run`,由 harness
96
98
 
97
99
  #### 模型看见什么
98
100
 
99
- 文本增量、thinking 增量、token 用量和 MCP 工具调用变成 harness 分片。一次 MCP 工具调用以 `tool-calls` 结束该流;原生 exec 使该轮失败。
101
+ 文本增量、thinking 增量、token 用量和 MCP 工具调用变成 harness 分片。一次 MCP 工具调用以 `tool-calls` 结束该流。原生 exec 以拒绝应答且流继续;未知 exec 使该轮失败。
100
102
 
101
103
  #### Token 影响
102
104
 
@@ -113,10 +115,14 @@ loop 保留的响应块追加到下一次重建的 Run。未记录的传输帧
113
115
  这些限制划定适配器的停止点。它们是当前的包约束,不是与 Cursor 产品的对比。
114
116
 
115
117
  - **该集成是非官方的** — 认证 URL、头、客户端版本和 `agent.v1` 可能不预先通知就变更并弄坏本适配器。
116
- - **不执行原生 Cursor 工作区 exec** — `read`、`shell` 及同类会被拒绝,以免该轮停在 Cursor 内;请使用 harness 的 MCP 工具。
118
+ - **不执行原生 Cursor 工作区 exec** — `read`、`shell` 及同类收到指出 harness 工具的类型化拒绝,因此选中它们的模型会在调用 `mcp_dsh_` 工具之前多花一个往返。
117
119
  - **没有挂起的 HTTP/2 会话** — DSH 的每一步都是新的 Run;在同一次 Cursor 流上中途恢复工具不在范围内。
120
+ - **工具结果以重放的提示消息加一条固定继续提示到达模型** — Cursor 原生是在流内交付结果;该提示是适配器自有的文本,人类从未输入过。
118
121
  - **不支持 `GenerateOptions.stop`** — 非官方 Run 不映射停止序列。
119
- - **图片不会作为 Cursor 选中图片发送** — 历史中的请求图片在重建的 Run 中被省略。
122
+ - **不发送图片字节** — 该路由声明只接受文本输入,因此每张图片以 harness 的纯文本占位符到达模型,而不是作为 Cursor 选中图片。
123
+ - **不映射 `maxTokens`、`temperature` 和 `reasoningEffort`** — Run 没有对应字段;努力程度通过 Cursor 模型 id 后缀(如 `-high`)选择。
124
+ - **不重放 reasoning** — Cursor 不渲染 `reasoning` 提示部分,因此 thinking 模型在每次本地执行工具调用之后重新推导计划。
125
+ - **提示 token 用量是估算值** — Cursor 不报告,因此 TUI 上下文计量显示适配器基于字符数的估算。
120
126
  - **退出登录不会在 Cursor 一侧撤销** — 它只删除本地授权;在 `reuseInstalledCursorLogin` 为 false 之前,采集仍可能满足下一次请求。
121
127
  - **采集可能把账记到另一个 Cursor 账户** — 已存储的 DSH 授权优先;当本机 IDE 登录不是要用的账户时请关掉采集。
122
128
  - **登录只存在于启动它的那个进程** — 登录途中刷新页面会放弃该次尝试。