@songtonyli/dsh-cli 0.1.33 → 0.1.35
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.
- package/README.md +1 -1
- package/bin/dsh.mjs +1 -1
- package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/client.js +3 -2
- package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/client/sessions/session.js +3 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/client.js +336 -325
- package/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/client.js +22 -7
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-llm-cursor/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-llm-cursor/README.md +5 -4
- package/node_modules/@deepseek-ai/dsh-llm-cursor/README.zh.md +5 -4
- package/node_modules/@deepseek-ai/dsh-llm-cursor/lib/index.js +607 -63
- package/node_modules/@deepseek-ai/dsh-tui-app/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-tui-app/README.md +35 -22
- package/node_modules/@deepseek-ai/dsh-tui-app/README.zh.md +35 -22
- package/node_modules/@deepseek-ai/dsh-tui-app/lib/index.js +1077 -205
- package/package.json +1 -1
|
@@ -3412,13 +3412,6 @@ window.__ModuleLoader__.load({
|
|
|
3412
3412
|
type: "file",
|
|
3413
3413
|
receiptId: uploadFor(attachment).receiptId
|
|
3414
3414
|
}));
|
|
3415
|
-
if (session.getSnapshot().subagent !== null) {
|
|
3416
|
-
const content = [...await serializeAttachments(), ...text === "" ? [] : [{
|
|
3417
|
-
type: "text",
|
|
3418
|
-
text
|
|
3419
|
-
}]];
|
|
3420
|
-
return (await session.prompt(content, mode, signal)).ok ? { kind: "success" } : { kind: "error" };
|
|
3421
|
-
}
|
|
3422
3415
|
let finishRetirement;
|
|
3423
3416
|
const retirement = attachments.length === 0 ? void 0 : new Promise((resolve) => {
|
|
3424
3417
|
finishRetirement = resolve;
|
|
@@ -14444,6 +14437,7 @@ window.__ModuleLoader__.load({
|
|
|
14444
14437
|
"hero.preview": "预览版",
|
|
14445
14438
|
"hero.chooseWorkspace": "选择工作区",
|
|
14446
14439
|
"session.hierarchy": "会话层级",
|
|
14440
|
+
"session.returnToMain": "返回主智能体(Alt+↑)",
|
|
14447
14441
|
"todo.title": "任务",
|
|
14448
14442
|
"todo.progress.done": "{done} 已完成",
|
|
14449
14443
|
"todo.progress.active": "{active} 进行中",
|
|
@@ -14794,6 +14788,7 @@ window.__ModuleLoader__.load({
|
|
|
14794
14788
|
"hero.preview": "Preview",
|
|
14795
14789
|
"hero.chooseWorkspace": "Choose workspace",
|
|
14796
14790
|
"session.hierarchy": "Session hierarchy",
|
|
14791
|
+
"session.returnToMain": "Return to the main agent (Alt+↑)",
|
|
14797
14792
|
"todo.title": "To-dos",
|
|
14798
14793
|
"todo.progress.done": "{done} completed",
|
|
14799
14794
|
"todo.progress.active": "{active} in progress",
|
|
@@ -16264,6 +16259,25 @@ window.__ModuleLoader__.load({
|
|
|
16264
16259
|
const tabs = useConversationViews((value) => value);
|
|
16265
16260
|
const active = resolveActiveView(tabs, useStore((s) => s.view));
|
|
16266
16261
|
const ancestry = useSessions((s) => deriveAncestry(s, sessionId), equalBreadcrumbs);
|
|
16262
|
+
const rootAgent = ancestry[0];
|
|
16263
|
+
const currentAgent = ancestry.at(-1);
|
|
16264
|
+
const mainAgentId = rootAgent !== void 0 && currentAgent?.subagent === true ? rootAgent.id : void 0;
|
|
16265
|
+
(0, react.useEffect)(() => {
|
|
16266
|
+
if (mainAgentId === void 0) return;
|
|
16267
|
+
const onKeyDown = (event) => {
|
|
16268
|
+
if (event.key !== "ArrowUp" || !event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;
|
|
16269
|
+
if (event.isComposing) return;
|
|
16270
|
+
const target = event.target;
|
|
16271
|
+
if (target instanceof Element && target.closest("[role=\"dialog\"]") !== null) return;
|
|
16272
|
+
event.preventDefault();
|
|
16273
|
+
event.stopPropagation();
|
|
16274
|
+
open(mainAgentId);
|
|
16275
|
+
};
|
|
16276
|
+
document.addEventListener("keydown", onKeyDown, true);
|
|
16277
|
+
return () => {
|
|
16278
|
+
document.removeEventListener("keydown", onKeyDown, true);
|
|
16279
|
+
};
|
|
16280
|
+
}, [mainAgentId, open]);
|
|
16267
16281
|
const showTabs = !hideChrome && tabs.length > 1;
|
|
16268
16282
|
return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsxs)("div", {
|
|
16269
16283
|
className: ConversationRoot_module_css_default.titleRow,
|
|
@@ -16280,6 +16294,7 @@ window.__ModuleLoader__.load({
|
|
|
16280
16294
|
}) : (0, react_jsx_runtime.jsx)("button", {
|
|
16281
16295
|
type: "button",
|
|
16282
16296
|
className: clsx(ConversationRoot_module_css_default.crumb, summary.subagent && ConversationRoot_module_css_default.crumbSubagent),
|
|
16297
|
+
title: summary.id === mainAgentId ? t("session.returnToMain") : void 0,
|
|
16283
16298
|
onClick: () => {
|
|
16284
16299
|
open(summary.id);
|
|
16285
16300
|
},
|
|
@@ -158,7 +158,7 @@ window.__ModuleLoader__.load({
|
|
|
158
158
|
const SCROLLBAR_LINGER_MS = 2e3;
|
|
159
159
|
/** Format complete-build metadata for the local brand badge. */
|
|
160
160
|
function localBuildVersion() {
|
|
161
|
-
return `0.1.7-alpha.1-
|
|
161
|
+
return `0.1.7-alpha.1-320dc47` + ({}.DSH_CLIENT_GIT_DIRTY === "true" ? "-dirty" : "");
|
|
162
162
|
}
|
|
163
163
|
/** Each panel row subscribes only to its own selection state. */
|
|
164
164
|
function PanelRow({ id, label, wide, usePanelInfo, selectPanel, renderSlot }) {
|
|
@@ -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:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: ebde9246984fdce1e308ddd1f1fe8d4a8bea8a0b
|
|
6
|
+
README.zh.md: 6f9e1fba4a59dba6425d31baa6f185e2116a040e
|
|
@@ -66,7 +66,7 @@ Request-time token order is: launch-environment `CURSOR_ACCESS_TOKEN`, then the
|
|
|
66
66
|
|
|
67
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
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`, `
|
|
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 or CLI Pi workspace exec (`read`, `shell`, `piRead`, 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. A CLI hook is answered with an empty matching response. An MCP-state exec returns the advertised `mcp_dsh_` tools. Any other exec this build cannot type is answered with ExecClientThrow so the Run continues. An exec with no payload still fails the step.
|
|
70
70
|
|
|
71
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`.
|
|
72
72
|
|
|
@@ -98,7 +98,7 @@ Each step is an independent Run. A changed system prompt, history, tool schema,
|
|
|
98
98
|
|
|
99
99
|
#### What the model sees
|
|
100
100
|
|
|
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
|
|
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 or CLI Pi workspace exec is answered with a rejection and the stream continues. A CLI hook or MCP-state exec is answered so the Run stays open. Any other exec this build cannot type is answered with ExecClientThrow and the stream continues. An exec with no payload fails the turn.
|
|
102
102
|
|
|
103
103
|
#### Token effect
|
|
104
104
|
|
|
@@ -115,7 +115,8 @@ Loop-retained response blocks append to the next rebuilt Run. Unrecorded transpo
|
|
|
115
115
|
These limits define where the adapter stops. They are current package constraints, not a Cursor product comparison.
|
|
116
116
|
|
|
117
117
|
- **The integration is unofficial** — auth URLs, headers, client version, and `agent.v1` can change without notice and break this adapter.
|
|
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.
|
|
118
|
+
- **Native Cursor workspace execs are not executed** — `read`, `shell`, CLI Pi tools (`piRead`, `piBash`, and kin), and the same family 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.
|
|
119
|
+
- **CLI control execs do not run Cursor hooks** — hook frames get an empty matching response, MCP-state frames list the advertised `dsh` tools, and any other unnamed exec is answered with ExecClientThrow so the Run continues; none of them execute workspace work.
|
|
119
120
|
- **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
121
|
- **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.
|
|
121
122
|
- **`GenerateOptions.stop` is unsupported** — the unofficial Run does not map stop sequences.
|
|
@@ -135,7 +136,7 @@ These limits define where the adapter stops. They are current package constraint
|
|
|
135
136
|
|
|
136
137
|
This Dev Note is non-authoritative working context: undecided directions and notes for maintainers. Shipped behavior and accepted rationale live in the sections above, the package code, and the linked Agent Notes.
|
|
137
138
|
|
|
138
|
-
- `src/native/agent_pb.ts` is the MIT-licensed generated schema from https://github.com/Rahularya01/pi-cursor. Coverage, oxlint, and verify-export-jsdoc exclude that file. There is no runtime dependency on
|
|
139
|
+
- `src/native/agent_pb.ts` is the MIT-licensed generated schema from the community Cursor proto catalogs used by https://github.com/Rahularya01/pi-cursor and https://github.com/can1357/oh-my-pi. Coverage, oxlint, and verify-export-jsdoc exclude that file. There is no runtime dependency on those packages.
|
|
139
140
|
|
|
140
141
|
</details>
|
|
141
142
|
|
|
@@ -66,7 +66,7 @@ TUI:`/login llm-cursor/cursor`。无头不会打开浏览器;导出 `CURSOR_
|
|
|
66
66
|
|
|
67
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
68
|
|
|
69
|
-
文本、thinking、用量与 MCP 工具调用变成 `StreamChunk`。一次 MCP 工具调用结束该流,以便 agent loop 在本地跑工具。下一次 Run 重放该进行中的轮次及其结果,并把一条固定的继续提示作为 Run 必需的用户消息发送;不使用 `resumeAction`,因为服务端会从该轮的用户消息重新开始而不是继续。Cursor
|
|
69
|
+
文本、thinking、用量与 MCP 工具调用变成 `StreamChunk`。一次 MCP 工具调用结束该流,以便 agent loop 在本地跑工具。下一次 Run 重放该进行中的轮次及其结果,并把一条固定的继续提示作为 Run 必需的用户消息发送;不使用 `resumeAction`,因为服务端会从该轮的用户消息重新开始而不是继续。Cursor 原生或 CLI Pi 工作区 exec(`read`、`shell`、`piRead` 及同类)以其类型化的拒绝应答,并指出应改用的 harness 工具,因此 Run 继续进行,模型把该拒绝当作工具结果读取。CLI 钩子以空的匹配响应应答。MCP-state exec 返回已通告的 `mcp_dsh_` 工具。本构建无法类型化的其他 exec 以 ExecClientThrow 应答,以便 Run 继续。没有 payload 的 exec 仍使该步失败。
|
|
70
70
|
|
|
71
71
|
`LlmAdapter` 要求的归属头出现在每一次 HTTP/2 请求上,并带有 Cursor 客户端头 `x-ghost-mode`、`x-cursor-client-version` 和 `x-cursor-client-type`。
|
|
72
72
|
|
|
@@ -98,7 +98,7 @@ DSH 的每一步模型调用是一次新的 HTTP/2 Connect `Run`,由 harness
|
|
|
98
98
|
|
|
99
99
|
#### 模型看见什么
|
|
100
100
|
|
|
101
|
-
文本增量、thinking 增量、token 用量和 MCP 工具调用变成 harness 分片。一次 MCP 工具调用以 `tool-calls`
|
|
101
|
+
文本增量、thinking 增量、token 用量和 MCP 工具调用变成 harness 分片。一次 MCP 工具调用以 `tool-calls` 结束该流。原生或 CLI Pi 工作区 exec 以拒绝应答且流继续。CLI 钩子或 MCP-state exec 被应答以保持 Run 开启。本构建无法类型化的其他 exec 以 ExecClientThrow 应答且流继续。没有 payload 的 exec 使该轮失败。
|
|
102
102
|
|
|
103
103
|
#### Token 影响
|
|
104
104
|
|
|
@@ -115,7 +115,8 @@ loop 保留的响应块追加到下一次重建的 Run。未记录的传输帧
|
|
|
115
115
|
这些限制划定适配器的停止点。它们是当前的包约束,不是与 Cursor 产品的对比。
|
|
116
116
|
|
|
117
117
|
- **该集成是非官方的** — 认证 URL、头、客户端版本和 `agent.v1` 可能不预先通知就变更并弄坏本适配器。
|
|
118
|
-
- **不执行原生 Cursor 工作区 exec** — `read`、`shell`
|
|
118
|
+
- **不执行原生 Cursor 工作区 exec** — `read`、`shell`、CLI Pi 工具(`piRead`、`piBash` 及同类)以及同一家族收到指出 harness 工具的类型化拒绝,因此选中它们的模型会在调用 `mcp_dsh_` 工具之前多花一个往返。
|
|
119
|
+
- **CLI 控制 exec 不运行 Cursor 钩子** — 钩子帧得到空的匹配响应,MCP-state 帧列出已通告的 `dsh` 工具,其他未命名 exec 以 ExecClientThrow 应答以使 Run 继续;它们都不执行工作区工作。
|
|
119
120
|
- **没有挂起的 HTTP/2 会话** — DSH 的每一步都是新的 Run;在同一次 Cursor 流上中途恢复工具不在范围内。
|
|
120
121
|
- **工具结果以重放的提示消息加一条固定继续提示到达模型** — Cursor 原生是在流内交付结果;该提示是适配器自有的文本,人类从未输入过。
|
|
121
122
|
- **不支持 `GenerateOptions.stop`** — 非官方 Run 不映射停止序列。
|
|
@@ -135,7 +136,7 @@ loop 保留的响应块追加到下一次重建的 Run。未记录的传输帧
|
|
|
135
136
|
|
|
136
137
|
本开发备注是非权威的工作上下文:未决方向与维护者备忘。已交付行为与被接受的理由写在上面各节、包代码以及链接的 Agent Note 中。
|
|
137
138
|
|
|
138
|
-
- `src/native/agent_pb.ts` 是来自 https://github.com/Rahularya01/pi-cursor
|
|
139
|
+
- `src/native/agent_pb.ts` 是来自 https://github.com/Rahularya01/pi-cursor 与 https://github.com/can1357/oh-my-pi 所用社区 Cursor proto 目录的 MIT 许可生成 schema。覆盖率、oxlint 与 verify-export-jsdoc 排除该文件。运行时不依赖这些包。
|
|
139
140
|
|
|
140
141
|
</details>
|
|
141
142
|
|