@songtonyli/dsh-cli 0.1.69 → 0.1.71
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-client-ui-sidebar/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-llm-cursor/README.i18n.yaml +6 -6
- package/node_modules/@deepseek-ai/dsh-llm-cursor/README.md +3 -2
- package/node_modules/@deepseek-ai/dsh-llm-cursor/README.zh.md +3 -2
- package/node_modules/@deepseek-ai/dsh-llm-cursor/lib/index.js +173 -40
- package/node_modules/@deepseek-ai/dsh-llm-pi-ai/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-llm-pi-ai/README.md +1 -1
- package/node_modules/@deepseek-ai/dsh-llm-pi-ai/README.zh.md +1 -1
- package/node_modules/@deepseek-ai/dsh-llm-pi-ai/lib/index.js +53 -1
- package/node_modules/@deepseek-ai/dsh-llm-pi-ai/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-sandbox-apple-container/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-sandbox-apple-container/README.md +1 -1
- package/node_modules/@deepseek-ai/dsh-sandbox-apple-container/README.zh.md +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +0 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ workspace and no build step. Native packages that ship one build per platform
|
|
|
26
26
|
ripgrep, the PTY backend's addons, sharp, koffi, and the Landlock launcher — are
|
|
27
27
|
ordinary optional dependencies, so npm resolves the right one for your machine.
|
|
28
28
|
|
|
29
|
-
Requires Node `^22.19.0 || >=24.0.0`. Version 0.1.
|
|
29
|
+
Requires Node `^22.19.0 || >=24.0.0`. Version 0.1.71; `dsh --version`
|
|
30
30
|
also reports the harness build the package was assembled from.
|
|
31
31
|
|
|
32
32
|
## License
|
package/bin/dsh.mjs
CHANGED
|
@@ -18,7 +18,7 @@ const argv = process.argv.slice(2)
|
|
|
18
18
|
// version this package publishes. Reporting only one of the two would make an
|
|
19
19
|
// ordinary `npm install @songtonyli/dsh-cli@x` look like it installed something else.
|
|
20
20
|
if (argv.length === 1 && (argv[0] === '--version' || argv[0] === '-V')) {
|
|
21
|
-
console.log('@songtonyli/dsh-cli 0.1.
|
|
21
|
+
console.log('@songtonyli/dsh-cli 0.1.71 (deepseek-harness 0.2.1-alpha.2)')
|
|
22
22
|
process.exit(0)
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -167,7 +167,7 @@ window.__ModuleLoader__.load({
|
|
|
167
167
|
const SCROLLBAR_LINGER_MS = 2e3;
|
|
168
168
|
/** Format complete-build metadata for the local brand badge. */
|
|
169
169
|
function localBuildVersion() {
|
|
170
|
-
return `0.2.1-alpha.2-
|
|
170
|
+
return `0.2.1-alpha.2-7a0923b` + ({}.DSH_CLIENT_GIT_DIRTY === "true" ? "-dirty" : "");
|
|
171
171
|
}
|
|
172
172
|
/** Each panel row subscribes only to its own selection state. */
|
|
173
173
|
function PanelRow({ id, label, wide, usePanelInfo, selectPanel, renderSlot }) {
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
en: fcbbad190e87edf0
|
|
28
28
|
zh: 4ccdfdcbdbd568df
|
|
29
29
|
/deepseek-ai-dsh-llm-cursor/understand-the-implementation:
|
|
30
|
-
en:
|
|
31
|
-
zh:
|
|
30
|
+
en: 41348b42ce26d343
|
|
31
|
+
zh: abb0112c8c7b3270
|
|
32
32
|
/deepseek-ai-dsh-llm-cursor/further-exploration:
|
|
33
33
|
en: 86cfc3c8b643ad03
|
|
34
34
|
zh: b0762ac35601eae9
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
en: 6dfb8a3225eee97d
|
|
52
52
|
zh: 0521b054723a58e4
|
|
53
53
|
/deepseek-ai-dsh-llm-cursor/model-experience/cursor-run-response/what-the-model-sees:
|
|
54
|
-
en:
|
|
55
|
-
zh:
|
|
54
|
+
en: 3b3a2596a5ea98e5
|
|
55
|
+
zh: 78fd7d25b16b05fd
|
|
56
56
|
/deepseek-ai-dsh-llm-cursor/model-experience/cursor-run-response/token-effect:
|
|
57
57
|
en: a179b4520b89ac65
|
|
58
58
|
zh: 7759fe1f4e9254c9
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
en: e67424f14f51cc08
|
|
61
61
|
zh: 291f84030ca04d8d
|
|
62
62
|
/deepseek-ai-dsh-llm-cursor/known-limitations-and-deferred-work:
|
|
63
|
-
en:
|
|
64
|
-
zh:
|
|
63
|
+
en: 52069cb3a7f37206
|
|
64
|
+
zh: 0ece8025a0bfed87
|
|
65
65
|
/deepseek-ai-dsh-llm-cursor/known-limitations-and-deferred-work/dev-note:
|
|
66
66
|
en: 6501f6a2bda8f5b1
|
|
67
67
|
zh: 813e64f16dbecaad
|
|
@@ -68,7 +68,7 @@ Request-time token order is: launch-environment `CURSOR_ACCESS_TOKEN`, then the
|
|
|
68
68
|
|
|
69
69
|
A new Run is 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, writing each historic harness tool call as the `CallDynamicTool` call Cursor records for an MCP tool; the turn structures ride along for the server's bookkeeping. A Cursor CLI Run exposes MCP tools to the model only through `GetDynamicTools` and `CallDynamicTool`, so the request-context answer adds one global Cursor rule telling the model that Cursor's built-in tools return a rejection here, that harness tools are called with `CallDynamicTool` in namespace `dsh`, and which tool names exist.
|
|
70
70
|
|
|
71
|
-
Text, thinking, usage, and MCP tool calls become `StreamChunk`. MCP tool calls end the step once Cursor sends the checkpoint that follows the model's last parallel call, or after `toolCallSettleMs` without a frame. When the request names a Session and is not a compaction or title request, the Run then parks: the adapter keeps the stream open with a `clientHeartbeat` every five seconds. The next request from that Session resumes it when its history before the last assistant message is unchanged and that message is followed only by the pending calls' results and harness-injected user-role context; the adapter answers each call with `mcpResult` on the same stream, appends such context to the last result, and keeps reading. Any other request, a Run that died while parked, or one older than `parkedRunTimeoutMs` falls back to a new Run that replays the 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 through `CallDynamicTool`, so the Run continues and the model reads the refusal as a tool outcome; text after a refused exec starts a new text block. A native Cursor question receives a typed rejection that directs the model to the harness `ask_user_question` MCP tool when available, or to ask in a reply otherwise; the Run continues. A web-search approval query is approved because Cursor runs that search on its own side; a web-fetch approval query is rejected with the reason the `fetch` exec carries, because an approved fetch returns here as that refused exec. A CLI hook is answered with an empty matching response. An MCP-state exec returns the advertised `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.
|
|
71
|
+
Text, thinking, usage, and MCP tool calls become `StreamChunk`. MCP tool calls end the step once Cursor sends the checkpoint that follows the model's last parallel call, or after `toolCallSettleMs` without a frame. When the request names a Session and is not a compaction or title request, the Run then parks: the adapter keeps the stream open with a `clientHeartbeat` every five seconds. The next request from that Session resumes it when its history before the last assistant message is unchanged and that message is followed only by the pending calls' results and harness-injected user-role context; the adapter answers each call with `mcpResult` on the same stream, appends such context to the last result, and keeps reading. Any other request, a Run that died while parked, or one older than `parkedRunTimeoutMs` falls back to a new Run that replays the 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 through `CallDynamicTool`, so the Run continues and the model reads the refusal as a tool outcome; text after a refused exec starts a new text block. A native Cursor question receives a typed rejection that directs the model to the harness `ask_user_question` MCP tool when available, or to ask in a reply otherwise; the Run continues. A web-search approval query is approved because Cursor runs that search on its own side; a web-fetch approval query is rejected with the reason the `fetch` exec carries, because an approved fetch returns here as that refused exec. A CLI hook is answered with an empty matching response. An MCP-state exec returns the advertised `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. Kimi models on Cursor sometimes write their native tool-call markup (`<|open|>toolscall tool="CallDynamicTool" …<|close|>tools<|sep|>`) as text that Cursor's server does not parse, so the turn ends without an exec. The adapter withholds text from the first `<|open|>tools` until its block ends. When the turn ends on a withheld tail that parses entirely as `CallDynamicTool` calls in namespace `dsh` naming advertised harness tools, the tail becomes tool-call blocks that finish the step with `tool-calls`, and the next step opens a new Run rebuilt from history; any other withheld text is streamed unchanged.
|
|
72
72
|
|
|
73
73
|
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`.
|
|
74
74
|
|
|
@@ -101,7 +101,7 @@ The steps of a turn share one Cursor conversation while the Run resumes. A new R
|
|
|
101
101
|
|
|
102
102
|
#### What the model sees
|
|
103
103
|
|
|
104
|
-
Text deltas, thinking deltas, token usage, and MCP tool calls become harness chunks. MCP tool calls finish the step with `tool-calls` after the model's parallel calls arrive. 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.
|
|
104
|
+
Text deltas, thinking deltas, token usage, and MCP tool calls become harness chunks. MCP tool calls finish the step with `tool-calls` after the model's parallel calls arrive. Leaked `CallDynamicTool` markup that ends a turn is recorded as the tool calls it names instead of as text, so later requests replay it as ordinary 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.
|
|
105
105
|
|
|
106
106
|
#### Token effect
|
|
107
107
|
|
|
@@ -122,6 +122,7 @@ These limits define where the adapter stops. They are current package constraint
|
|
|
122
122
|
- **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.
|
|
123
123
|
- **A parked Run lives in one process** — it is not journaled, so a restarted process, a human message after the tool results, or any changed history falls back to a new Run rebuilt from history.
|
|
124
124
|
- **A fallback Run delivers tool results as replayed prompt messages plus a fixed continuation notice** — the notice is adapter-owned text the human never typed; a resumed Run delivers injected context inside the last tool result instead of as its own message.
|
|
125
|
+
- **Leaked tool-call recovery matches one observed markup** — only the Kimi `<|open|>tools` form at the end of a turn is recovered; text from that marker streams only when its block ends, and a reply that ends by quoting complete markup for an advertised tool runs that tool.
|
|
125
126
|
- **`GenerateOptions.stop` is unsupported** — the unofficial Run does not map stop sequences.
|
|
126
127
|
- **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.
|
|
127
128
|
- **`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`.
|
|
@@ -68,7 +68,7 @@ TUI:`/login llm-cursor/cursor`。无头不会打开浏览器;导出 `CURSOR_
|
|
|
68
68
|
|
|
69
69
|
新的 Run 由 harness 历史、系统提示和 MCP 工具定义重建(`providerIdentifier: dsh`,`clientName: dsh`)。Cursor 服务端只从 `root_prompt_messages_json` 构建模型提示,从不把 `conversation_state.turns` 渲染进去,并且会丢弃其中的 `{"role":"system"}` 条目而使用自己的提示。因此适配器把系统提示作为 `<rules>` user 提示消息发布,并把每个先前轮次重放为 `user`、`assistant` 和 `tool` 提示消息,把每个历史 harness 工具调用写成 Cursor 为 MCP 工具记录的 `CallDynamicTool` 调用;轮次结构一同发送,供服务端记账。Cursor CLI 的 Run 只通过 `GetDynamicTools` 和 `CallDynamicTool` 向模型暴露 MCP 工具,因此请求上下文的应答额外带一条全局 Cursor 规则,告知模型 Cursor 内建工具在这里会返回拒绝、harness 工具以命名空间 `dsh` 中的 `CallDynamicTool` 调用,以及有哪些工具名。
|
|
70
70
|
|
|
71
|
-
文本、thinking、用量与 MCP 工具调用变成 `StreamChunk`。当 Cursor 发出模型最后一个并行调用之后的检查点,或 `toolCallSettleMs` 内没有新帧时,MCP 工具调用结束该步。若请求带有 Session 且不是压缩或标题请求,该 Run 随后挂起:适配器每五秒发送一次 `clientHeartbeat` 保持流开启。该 Session 的下一次请求在以下条件成立时恢复它:最后一条 assistant 消息之前的历史不变,且该消息之后只有待处理调用的结果以及 harness 注入的 user 角色上下文;适配器在同一条流上以 `mcpResult` 应答每个调用,把这类上下文追加到最后一个结果之后,并继续读取。任何其他请求、挂起期间死亡的 Run,或超过 `parkedRunTimeoutMs` 的 Run,都回退为新的 Run:它重放该进行中的轮次及其结果,并把一条固定的继续提示作为 Run 必需的用户消息发送;不使用 `resumeAction`,因为服务端会从该轮的用户消息重新开始而不是继续。Cursor 原生或 CLI Pi 工作区 exec(`read`、`shell`、`piRead` 及同类)以其类型化的拒绝应答,并指出应通过 `CallDynamicTool` 调用的 harness 工具,因此 Run 继续进行,模型把该拒绝当作工具结果读取;被拒绝的 exec 之后的文本开启新的文本块。Cursor 原生提问会收到类型化的拒绝:若 harness 提供 `ask_user_question` MCP 工具,拒绝会引导模型调用该工具;否则会引导模型在回复中提问。Run 随后继续。网页搜索的批准查询会被批准,因为该搜索由 Cursor 在自己那一侧执行;网页抓取的批准查询会被拒绝,并带上 `fetch` exec 所携带的原因,因为获批的抓取会作为那个被拒绝的 exec 回到这里。CLI 钩子以空的匹配响应应答。MCP-state exec 返回已通告的 `dsh` 工具。本构建无法类型化的其他 exec 以 ExecClientThrow 应答,以便 Run 继续。没有 payload 的 exec 仍使该步失败。
|
|
71
|
+
文本、thinking、用量与 MCP 工具调用变成 `StreamChunk`。当 Cursor 发出模型最后一个并行调用之后的检查点,或 `toolCallSettleMs` 内没有新帧时,MCP 工具调用结束该步。若请求带有 Session 且不是压缩或标题请求,该 Run 随后挂起:适配器每五秒发送一次 `clientHeartbeat` 保持流开启。该 Session 的下一次请求在以下条件成立时恢复它:最后一条 assistant 消息之前的历史不变,且该消息之后只有待处理调用的结果以及 harness 注入的 user 角色上下文;适配器在同一条流上以 `mcpResult` 应答每个调用,把这类上下文追加到最后一个结果之后,并继续读取。任何其他请求、挂起期间死亡的 Run,或超过 `parkedRunTimeoutMs` 的 Run,都回退为新的 Run:它重放该进行中的轮次及其结果,并把一条固定的继续提示作为 Run 必需的用户消息发送;不使用 `resumeAction`,因为服务端会从该轮的用户消息重新开始而不是继续。Cursor 原生或 CLI Pi 工作区 exec(`read`、`shell`、`piRead` 及同类)以其类型化的拒绝应答,并指出应通过 `CallDynamicTool` 调用的 harness 工具,因此 Run 继续进行,模型把该拒绝当作工具结果读取;被拒绝的 exec 之后的文本开启新的文本块。Cursor 原生提问会收到类型化的拒绝:若 harness 提供 `ask_user_question` MCP 工具,拒绝会引导模型调用该工具;否则会引导模型在回复中提问。Run 随后继续。网页搜索的批准查询会被批准,因为该搜索由 Cursor 在自己那一侧执行;网页抓取的批准查询会被拒绝,并带上 `fetch` exec 所携带的原因,因为获批的抓取会作为那个被拒绝的 exec 回到这里。CLI 钩子以空的匹配响应应答。MCP-state exec 返回已通告的 `dsh` 工具。本构建无法类型化的其他 exec 以 ExecClientThrow 应答,以便 Run 继续。没有 payload 的 exec 仍使该步失败。Cursor 上的 Kimi 模型有时把其原生工具调用标记(`<|open|>toolscall tool="CallDynamicTool" …<|close|>tools<|sep|>`)作为文本写出,Cursor 服务端不解析它,于是该轮在没有 exec 的情况下结束。适配器从第一个 `<|open|>tools` 起暂扣文本,直到其文本块结束。若该轮结束时暂扣的尾部能完整解析为命名空间 `dsh` 中、指向已通告 harness 工具的 `CallDynamicTool` 调用,该尾部就变成工具调用块并以 `tool-calls` 结束该步,下一步打开一个由历史重建的新 Run;其他暂扣文本原样流出。
|
|
72
72
|
|
|
73
73
|
`LlmAdapter` 要求的归属头出现在每一次 HTTP/2 请求上,并带有 Cursor 客户端头 `x-ghost-mode`、`x-cursor-client-version` 和 `x-cursor-client-type`。
|
|
74
74
|
|
|
@@ -101,7 +101,7 @@ TUI:`/login llm-cursor/cursor`。无头不会打开浏览器;导出 `CURSOR_
|
|
|
101
101
|
|
|
102
102
|
#### 模型看见什么
|
|
103
103
|
|
|
104
|
-
文本增量、thinking 增量、token 用量和 MCP 工具调用变成 harness 分片。模型的并行调用到齐之后,MCP 工具调用以 `tool-calls`
|
|
104
|
+
文本增量、thinking 增量、token 用量和 MCP 工具调用变成 harness 分片。模型的并行调用到齐之后,MCP 工具调用以 `tool-calls` 结束该步。结束一轮的泄漏 `CallDynamicTool` 标记被记录为它所指定的工具调用而非文本,因此后续请求把它当作普通调用重放。原生或 CLI Pi 工作区 exec 以拒绝应答且流继续。CLI 钩子或 MCP-state exec 被应答以保持 Run 开启。本构建无法类型化的其他 exec 以 ExecClientThrow 应答且流继续。没有 payload 的 exec 使该轮失败。
|
|
105
105
|
|
|
106
106
|
#### Token 影响
|
|
107
107
|
|
|
@@ -122,6 +122,7 @@ TUI:`/login llm-cursor/cursor`。无头不会打开浏览器;导出 `CURSOR_
|
|
|
122
122
|
- **CLI 控制 exec 不运行 Cursor 钩子** — 钩子帧得到空的匹配响应,MCP-state 帧列出已通告的 `dsh` 工具,其他未命名 exec 以 ExecClientThrow 应答以使 Run 继续;它们都不执行工作区工作。
|
|
123
123
|
- **挂起的 Run 只存在于一个进程中** — 它没有 journal,因此进程重启、工具结果之后的人类消息或任何历史变化都会回退为由历史重建的新 Run。
|
|
124
124
|
- **回退的 Run 以重放的提示消息加一条固定继续提示交付工具结果** — 该提示是适配器自有的文本,人类从未输入过;恢复的 Run 把注入上下文放在最后一个工具结果内部交付,而不是作为独立消息。
|
|
125
|
+
- **泄漏工具调用的恢复只匹配一种已观察到的标记** — 只恢复位于轮次末尾的 Kimi `<|open|>tools` 形式;从该标记起的文本要到其文本块结束才流出,而以完整引用某个已通告工具的标记结束的回复会运行该工具。
|
|
125
126
|
- **不支持 `GenerateOptions.stop`** — 非官方 Run 不映射停止序列。
|
|
126
127
|
- **不发送图片字节** — 该路由声明只接受文本输入,因此每张图片以 harness 的纯文本占位符到达模型,而不是作为 Cursor 选中图片。
|
|
127
128
|
- **不映射 `maxTokens`、`temperature` 和 `reasoningEffort`** — Run 没有对应字段;努力程度通过 Cursor 模型 id 后缀(如 `-high`)选择。
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { launchEnvironmentOf } from "@deepseek-ai/dsh-launch-environment";
|
|
2
2
|
import { LlmAdapter, LlmError, RetryPolicySchema, ToolCallId, assertUsableApiKey, attributionHeaders, resolveRetryPolicy } from "@deepseek-ai/dsh-llm";
|
|
3
|
-
import { createHash } from "node:crypto";
|
|
3
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import { create, fromBinary, fromJson, toBinary, toJson } from "@bufbuild/protobuf";
|
|
5
5
|
import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
7
7
|
import { ValueSchema } from "@bufbuild/protobuf/wkt";
|
|
8
|
-
import { randomUUID } from "@deepseek-ai/dsh-util-crypto";
|
|
8
|
+
import { randomUUID as randomUUID$1 } from "@deepseek-ai/dsh-util-crypto";
|
|
9
9
|
import { assertNever } from "@deepseek-ai/dsh-util-values";
|
|
10
10
|
import { MAX_TIMER_DELAY_MS, idleWatchdog, timeoutOf } from "@deepseek-ai/dsh-timeout";
|
|
11
11
|
import http2 from "node:http2";
|
|
@@ -1341,7 +1341,7 @@ function buildTurnStepBytes(step) {
|
|
|
1341
1341
|
} }));
|
|
1342
1342
|
}
|
|
1343
1343
|
function createUserMessage(text, selectedContextBlob) {
|
|
1344
|
-
const messageId = randomUUID();
|
|
1344
|
+
const messageId = randomUUID$1();
|
|
1345
1345
|
const message = create(UserMessageSchema, {
|
|
1346
1346
|
text,
|
|
1347
1347
|
messageId,
|
|
@@ -1612,7 +1612,7 @@ function buildCursorRun(options) {
|
|
|
1612
1612
|
value: create(AgentConversationTurnStructureSchema, {
|
|
1613
1613
|
userMessage: storeAsBlob(toBinary(UserMessageSchema, createUserMessage(turn.userText, selectedCtxBlob)), blobStore),
|
|
1614
1614
|
steps: turn.steps.map((step) => storeAsBlob(buildTurnStepBytes(step), blobStore)),
|
|
1615
|
-
requestId: randomUUID()
|
|
1615
|
+
requestId: randomUUID$1()
|
|
1616
1616
|
})
|
|
1617
1617
|
} });
|
|
1618
1618
|
turnBlobIds.push(storeAsBlob(toBinary(ConversationTurnStructureSchema, turnStructure), blobStore));
|
|
@@ -1650,7 +1650,7 @@ function buildCursorRun(options) {
|
|
|
1650
1650
|
value: create(UserMessageActionSchema, { userMessage })
|
|
1651
1651
|
} }),
|
|
1652
1652
|
requestedModel,
|
|
1653
|
-
conversationId: options.sessionId ?? randomUUID(),
|
|
1653
|
+
conversationId: options.sessionId ?? randomUUID$1(),
|
|
1654
1654
|
mcpTools: create(McpToolsSchema, { mcpTools })
|
|
1655
1655
|
})
|
|
1656
1656
|
} })),
|
|
@@ -2037,7 +2037,7 @@ function cursorHeaders(rpcPath, accessToken, contentType) {
|
|
|
2037
2037
|
"x-ghost-mode": "true",
|
|
2038
2038
|
"x-cursor-client-version": CURSOR_CLIENT_VERSION,
|
|
2039
2039
|
"x-cursor-client-type": "cli",
|
|
2040
|
-
"x-request-id": randomUUID(),
|
|
2040
|
+
"x-request-id": randomUUID$1(),
|
|
2041
2041
|
...attributionHeaders()
|
|
2042
2042
|
};
|
|
2043
2043
|
}
|
|
@@ -2236,6 +2236,101 @@ function openConnectStream(request, connect = defaultConnect) {
|
|
|
2236
2236
|
};
|
|
2237
2237
|
}
|
|
2238
2238
|
//#endregion
|
|
2239
|
+
//#region lib/types/leaked-call.js
|
|
2240
|
+
/**
|
|
2241
|
+
* Recover harness tool calls that a Cursor model wrote as text. Kimi models on
|
|
2242
|
+
* Cursor sometimes emit their native tool-call markup
|
|
2243
|
+
* (`<|open|>toolscall tool="CallDynamicTool" index="1"<|sep|>…<|close|>tools<|sep|>`)
|
|
2244
|
+
* that Cursor's server does not parse: the markup arrives as `textDelta` and
|
|
2245
|
+
* the turn ends without an exec, so the call never runs.
|
|
2246
|
+
*
|
|
2247
|
+
* @module @deepseek-ai/dsh-llm-cursor/leaked-call
|
|
2248
|
+
*/
|
|
2249
|
+
/** Opening of leaked tool-call markup; text from its first occurrence is withheld until the turn ends. */
|
|
2250
|
+
const LEAKED_CALLS_MARKER = "<|open|>tools";
|
|
2251
|
+
/**
|
|
2252
|
+
* Where a text block stops being safe to stream: the first
|
|
2253
|
+
* {@link LEAKED_CALLS_MARKER}, or the start of a trailing partial marker.
|
|
2254
|
+
* The result never decreases as the text grows, so a caller may pass the
|
|
2255
|
+
* previous result as `from`.
|
|
2256
|
+
* @param text - text block so far.
|
|
2257
|
+
* @param from - offset already known to precede any marker.
|
|
2258
|
+
* @returns the length of the prefix that cannot belong to leaked markup.
|
|
2259
|
+
*/
|
|
2260
|
+
function leakedMarkupStart(text, from = 0) {
|
|
2261
|
+
const found = text.indexOf(LEAKED_CALLS_MARKER, from);
|
|
2262
|
+
if (found >= 0) return found;
|
|
2263
|
+
for (let start = Math.max(from, text.length - 13 + 1); start < text.length; start += 1) if ("<|open|>tools".startsWith(text.slice(start))) return start;
|
|
2264
|
+
return text.length;
|
|
2265
|
+
}
|
|
2266
|
+
const CALL_OPEN = /^(?:<\|open\|>)?call tool="([^"]*)"(?: index="\d+")?<\|sep\|>/;
|
|
2267
|
+
const ARGUMENT_OPEN = /^<\|open\|>argument key="([^"]*)" type="([^"]*)"<\|sep\|>/;
|
|
2268
|
+
const ARGUMENT_CLOSE = "<|close|>argument<|sep|>";
|
|
2269
|
+
const CALL_CLOSE = "<|close|>call<|sep|>";
|
|
2270
|
+
const CALLS_CLOSE = "<|close|>tools<|sep|>";
|
|
2271
|
+
function decodeArgument(type, raw) {
|
|
2272
|
+
if (type === "string") return { value: raw };
|
|
2273
|
+
try {
|
|
2274
|
+
return { value: JSON.parse(raw) };
|
|
2275
|
+
} catch (_notJson) {
|
|
2276
|
+
return;
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
function isRecord(value) {
|
|
2280
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2281
|
+
}
|
|
2282
|
+
function harnessCall(tool, args, toolNames) {
|
|
2283
|
+
if (tool !== "CallDynamicTool" || args["namespace"] !== "dsh") return void 0;
|
|
2284
|
+
const named = args["toolName"];
|
|
2285
|
+
if (typeof named !== "string") return void 0;
|
|
2286
|
+
const toolName = named.startsWith(MCP_PROMPT_TOOL_PREFIX) ? named.slice(MCP_PROMPT_TOOL_PREFIX.length) : named;
|
|
2287
|
+
const callArguments = args["arguments"] ?? {};
|
|
2288
|
+
if (!toolNames.has(toolName) || !isRecord(callArguments)) return void 0;
|
|
2289
|
+
return {
|
|
2290
|
+
toolName,
|
|
2291
|
+
arguments: callArguments
|
|
2292
|
+
};
|
|
2293
|
+
}
|
|
2294
|
+
/**
|
|
2295
|
+
* Parse text that starts at {@link LEAKED_CALLS_MARKER} into harness tool
|
|
2296
|
+
* calls. Every call must be a complete `CallDynamicTool` call in namespace
|
|
2297
|
+
* `dsh` naming an advertised harness tool, and only whitespace may follow the
|
|
2298
|
+
* markup; anything else returns `undefined` so the caller keeps the text.
|
|
2299
|
+
* @param text - withheld text, starting at the marker.
|
|
2300
|
+
* @param toolNames - harness tool names advertised on the Run.
|
|
2301
|
+
* @returns the recovered calls in order, or `undefined`.
|
|
2302
|
+
*/
|
|
2303
|
+
function parseLeakedToolCalls(text, toolNames) {
|
|
2304
|
+
if (!text.startsWith("<|open|>tools")) return void 0;
|
|
2305
|
+
let rest = text.slice(13);
|
|
2306
|
+
const calls = [];
|
|
2307
|
+
while (true) {
|
|
2308
|
+
rest = rest.startsWith("<|sep|>") ? rest.slice(7) : rest;
|
|
2309
|
+
const call = CALL_OPEN.exec(rest);
|
|
2310
|
+
if (call === null) return void 0;
|
|
2311
|
+
rest = rest.slice(call[0].length);
|
|
2312
|
+
const args = {};
|
|
2313
|
+
let argument = ARGUMENT_OPEN.exec(rest);
|
|
2314
|
+
while (argument !== null) {
|
|
2315
|
+
rest = rest.slice(argument[0].length);
|
|
2316
|
+
const end = rest.indexOf(ARGUMENT_CLOSE);
|
|
2317
|
+
if (end < 0) return void 0;
|
|
2318
|
+
const decoded = decodeArgument(argument[2], rest.slice(0, end));
|
|
2319
|
+
if (decoded === void 0) return void 0;
|
|
2320
|
+
args[argument[1]] = decoded.value;
|
|
2321
|
+
rest = rest.slice(end + 24);
|
|
2322
|
+
argument = ARGUMENT_OPEN.exec(rest);
|
|
2323
|
+
}
|
|
2324
|
+
if (!rest.startsWith(CALL_CLOSE)) return void 0;
|
|
2325
|
+
rest = rest.slice(20);
|
|
2326
|
+
const recovered = harnessCall(call[1], args, toolNames);
|
|
2327
|
+
if (recovered === void 0) return void 0;
|
|
2328
|
+
calls.push(recovered);
|
|
2329
|
+
if (rest.startsWith(CALLS_CLOSE)) rest = rest.slice(21);
|
|
2330
|
+
if (rest.trim().length === 0) return calls;
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
//#endregion
|
|
2239
2334
|
//#region lib/types/stream.js
|
|
2240
2335
|
/**
|
|
2241
2336
|
* Translate Cursor Connect Runs into harness StreamChunks, one DSH step at a time.
|
|
@@ -2784,11 +2879,40 @@ function rejectNativeQuestion(stream, query, mcpTools) {
|
|
|
2784
2879
|
})
|
|
2785
2880
|
} });
|
|
2786
2881
|
}
|
|
2787
|
-
function*
|
|
2882
|
+
function* emitThrough(state, open, end) {
|
|
2883
|
+
if (end <= open.emitted) return;
|
|
2884
|
+
if (open.index === void 0) {
|
|
2885
|
+
open.index = state.nextIndex;
|
|
2886
|
+
state.nextIndex += 1;
|
|
2887
|
+
yield {
|
|
2888
|
+
type: "block-start",
|
|
2889
|
+
index: open.index,
|
|
2890
|
+
blockType: open.type
|
|
2891
|
+
};
|
|
2892
|
+
}
|
|
2893
|
+
const text = open.text.slice(open.emitted, end);
|
|
2894
|
+
open.emitted = end;
|
|
2895
|
+
yield open.type === "text" ? {
|
|
2896
|
+
type: "text-delta",
|
|
2897
|
+
index: open.index,
|
|
2898
|
+
text
|
|
2899
|
+
} : {
|
|
2900
|
+
type: "reasoning-delta",
|
|
2901
|
+
index: open.index,
|
|
2902
|
+
text
|
|
2903
|
+
};
|
|
2904
|
+
}
|
|
2905
|
+
/** End the open block, first emitting any withheld text, and clear it. */
|
|
2906
|
+
function* closeOpen(state) {
|
|
2907
|
+
const open = state.open;
|
|
2788
2908
|
if (open === void 0) return;
|
|
2909
|
+
state.open = void 0;
|
|
2910
|
+
yield* emitThrough(state, open, open.text.length);
|
|
2911
|
+
const index = open.index;
|
|
2912
|
+
if (index === void 0) return;
|
|
2789
2913
|
if (open.type === "text") yield {
|
|
2790
2914
|
type: "block-end",
|
|
2791
|
-
index
|
|
2915
|
+
index,
|
|
2792
2916
|
block: {
|
|
2793
2917
|
type: "text",
|
|
2794
2918
|
text: open.text
|
|
@@ -2796,13 +2920,33 @@ function* closeOpen(open) {
|
|
|
2796
2920
|
};
|
|
2797
2921
|
else yield {
|
|
2798
2922
|
type: "block-end",
|
|
2799
|
-
index
|
|
2923
|
+
index,
|
|
2800
2924
|
block: {
|
|
2801
2925
|
type: "reasoning",
|
|
2802
2926
|
text: open.text
|
|
2803
2927
|
}
|
|
2804
2928
|
};
|
|
2805
2929
|
}
|
|
2930
|
+
/**
|
|
2931
|
+
* At turn end, replace a withheld text tail that parses as leaked harness tool
|
|
2932
|
+
* calls with tool-call blocks. The text before the markup stays a text block.
|
|
2933
|
+
* @returns the replacing chunks, or `undefined` when nothing was recovered.
|
|
2934
|
+
*/
|
|
2935
|
+
function recoverLeakedCalls(state, mcpTools) {
|
|
2936
|
+
const open = state.open;
|
|
2937
|
+
if (open?.type !== "text" || open.emitted === open.text.length) return void 0;
|
|
2938
|
+
const calls = parseLeakedToolCalls(open.text.slice(open.emitted), new Set(mcpTools.map((tool) => tool.toolName)));
|
|
2939
|
+
if (calls === void 0) return void 0;
|
|
2940
|
+
open.text = open.text.slice(0, open.emitted);
|
|
2941
|
+
const chunks = [...closeOpen(state)];
|
|
2942
|
+
for (const call of calls) {
|
|
2943
|
+
const toolCallId = `cursor-leaked-${randomUUID()}`;
|
|
2944
|
+
chunks.push(...emitToolCall(state.nextIndex, toolCallId, call.toolName, call.arguments));
|
|
2945
|
+
state.nextIndex += 1;
|
|
2946
|
+
state.toolCallIds.push(toolCallId);
|
|
2947
|
+
}
|
|
2948
|
+
return chunks;
|
|
2949
|
+
}
|
|
2806
2950
|
function* emitToolCall(index, id, name, args) {
|
|
2807
2951
|
const argumentsText = JSON.stringify(args);
|
|
2808
2952
|
yield {
|
|
@@ -2916,8 +3060,7 @@ async function* stepOnRun(run, options, inputTokens, timing, produced, sessionId
|
|
|
2916
3060
|
toolCallIds: []
|
|
2917
3061
|
};
|
|
2918
3062
|
const finish = function* (reason) {
|
|
2919
|
-
yield* closeOpen(state
|
|
2920
|
-
state.open = void 0;
|
|
3063
|
+
yield* closeOpen(state);
|
|
2921
3064
|
yield {
|
|
2922
3065
|
type: "usage",
|
|
2923
3066
|
usage: {
|
|
@@ -2959,7 +3102,7 @@ async function* stepOnRun(run, options, inputTokens, timing, produced, sessionId
|
|
|
2959
3102
|
}
|
|
2960
3103
|
if (outcome.turnEnded === true) {
|
|
2961
3104
|
run.close(false);
|
|
2962
|
-
yield* finish({ kind: "stop" });
|
|
3105
|
+
yield* finish({ kind: outcome.recoveredCalls === true ? "tool-calls" : "stop" });
|
|
2963
3106
|
return;
|
|
2964
3107
|
}
|
|
2965
3108
|
if (endsToolBatch || outcome.checkpoint === true && state.toolCallIds.length > 0) {
|
|
@@ -2994,34 +3137,28 @@ function handleServerMessage(message, run, state) {
|
|
|
2994
3137
|
if (text.length > 0) {
|
|
2995
3138
|
const type = updateCase === "textDelta" ? "text" : "reasoning";
|
|
2996
3139
|
if (state.open?.type !== type) {
|
|
2997
|
-
chunks.push(...closeOpen(state
|
|
3140
|
+
chunks.push(...closeOpen(state));
|
|
2998
3141
|
state.open = {
|
|
2999
|
-
index:
|
|
3142
|
+
index: void 0,
|
|
3000
3143
|
type,
|
|
3001
|
-
text: ""
|
|
3144
|
+
text: "",
|
|
3145
|
+
emitted: 0
|
|
3002
3146
|
};
|
|
3003
|
-
chunks.push({
|
|
3004
|
-
type: "block-start",
|
|
3005
|
-
index: state.nextIndex,
|
|
3006
|
-
blockType: type
|
|
3007
|
-
});
|
|
3008
|
-
state.nextIndex += 1;
|
|
3009
3147
|
}
|
|
3010
|
-
state.open
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
index: state.open.index,
|
|
3014
|
-
text
|
|
3015
|
-
} : {
|
|
3016
|
-
type: "reasoning-delta",
|
|
3017
|
-
index: state.open.index,
|
|
3018
|
-
text
|
|
3019
|
-
});
|
|
3148
|
+
const open = state.open;
|
|
3149
|
+
open.text += text;
|
|
3150
|
+
chunks.push(...emitThrough(state, open, type === "text" ? leakedMarkupStart(open.text, open.emitted) : open.text.length));
|
|
3020
3151
|
state.sawContent = true;
|
|
3021
3152
|
}
|
|
3022
3153
|
} else if (updateCase === "tokenDelta") state.outputTokens += message.message.value.message.value.tokens;
|
|
3023
3154
|
else if (updateCase === "turnEnded") {
|
|
3024
3155
|
if (!state.sawContent && state.open === void 0) throw new LlmError("llm-cursor: Cursor returned no content", "EMPTY_RESPONSE");
|
|
3156
|
+
const recovered = recoverLeakedCalls(state, payload.mcpTools);
|
|
3157
|
+
if (recovered !== void 0) return {
|
|
3158
|
+
chunks: [...chunks, ...recovered],
|
|
3159
|
+
turnEnded: true,
|
|
3160
|
+
recoveredCalls: true
|
|
3161
|
+
};
|
|
3025
3162
|
return {
|
|
3026
3163
|
chunks,
|
|
3027
3164
|
turnEnded: true
|
|
@@ -3044,8 +3181,7 @@ function handleServerMessage(message, run, state) {
|
|
|
3044
3181
|
if (execCase === "mcpArgs") {
|
|
3045
3182
|
const mcp = exec.message.value;
|
|
3046
3183
|
const toolCallId = mcp.toolCallId || `cursor-${exec.id}`;
|
|
3047
|
-
chunks.push(...closeOpen(state
|
|
3048
|
-
state.open = void 0;
|
|
3184
|
+
chunks.push(...closeOpen(state));
|
|
3049
3185
|
chunks.push(...emitToolCall(state.nextIndex, toolCallId, harnessToolName(mcp), decodeMcpArgsMap(mcp.args)));
|
|
3050
3186
|
state.nextIndex += 1;
|
|
3051
3187
|
state.sawContent = true;
|
|
@@ -3061,8 +3197,7 @@ function handleServerMessage(message, run, state) {
|
|
|
3061
3197
|
return {};
|
|
3062
3198
|
}
|
|
3063
3199
|
if (execCase === "executeHookArgs" && answerHook(stream, exec, exec.message.value.request)) return {};
|
|
3064
|
-
chunks.push(...closeOpen(state
|
|
3065
|
-
state.open = void 0;
|
|
3200
|
+
chunks.push(...closeOpen(state));
|
|
3066
3201
|
if (answerNativeExec(stream, exec, payload.mcpTools)) return { chunks };
|
|
3067
3202
|
rejectUnknownExec(stream, exec);
|
|
3068
3203
|
if (execCase !== void 0 || exec.$unknown !== void 0 && exec.$unknown.length > 0) return { chunks };
|
|
@@ -3075,14 +3210,12 @@ function handleServerMessage(message, run, state) {
|
|
|
3075
3210
|
return {};
|
|
3076
3211
|
}
|
|
3077
3212
|
if (query.query.case === "webFetchRequestQuery") {
|
|
3078
|
-
chunks.push(...closeOpen(state
|
|
3079
|
-
state.open = void 0;
|
|
3213
|
+
chunks.push(...closeOpen(state));
|
|
3080
3214
|
rejectNativeFetch(stream, query, payload.mcpTools);
|
|
3081
3215
|
return { chunks };
|
|
3082
3216
|
}
|
|
3083
3217
|
if (query.query.case === "askQuestionInteractionQuery") {
|
|
3084
|
-
chunks.push(...closeOpen(state
|
|
3085
|
-
state.open = void 0;
|
|
3218
|
+
chunks.push(...closeOpen(state));
|
|
3086
3219
|
rejectNativeQuestion(stream, query, payload.mcpTools);
|
|
3087
3220
|
return { chunks };
|
|
3088
3221
|
}
|
|
@@ -3685,7 +3818,7 @@ function createCursorOauthClient(deps = {}) {
|
|
|
3685
3818
|
const requestTimeoutMs = deps.requestTimeoutMs ?? 15e3;
|
|
3686
3819
|
const sleepImpl = deps.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
3687
3820
|
const generatePkceImpl = deps.generatePkce ?? generatePkce;
|
|
3688
|
-
const randomUUIDImpl = deps.randomUUID ?? randomUUID;
|
|
3821
|
+
const randomUUIDImpl = deps.randomUUID ?? randomUUID$1;
|
|
3689
3822
|
const now = deps.now ?? Date.now;
|
|
3690
3823
|
async function generateParams() {
|
|
3691
3824
|
const { verifier, challenge } = await generatePkceImpl();
|
|
@@ -87,8 +87,8 @@
|
|
|
87
87
|
en: b6bd570c0159ba08
|
|
88
88
|
zh: 7d2d91eea6a8d830
|
|
89
89
|
/deepseek-ai-dsh-llm-pi-ai/known-limitations-and-deferred-work:
|
|
90
|
-
en:
|
|
91
|
-
zh:
|
|
90
|
+
en: 895f7600d32339c2
|
|
91
|
+
zh: be3bd102c49d7800
|
|
92
92
|
/deepseek-ai-dsh-llm-pi-ai/known-limitations-and-deferred-work/dev-note:
|
|
93
93
|
en: 3678dd0f6642c2a5
|
|
94
94
|
zh: 75cbdd064cc64282
|
|
@@ -237,7 +237,7 @@ These limits define where the adapter stops and future work begins. They are cur
|
|
|
237
237
|
- **Images are accepted only in user and tool-result messages** — images in system, developer, or assistant history fail with `UNSUPPORTED_CONTENT` on both conversion paths.
|
|
238
238
|
- **Provider HTTP status is unavailable** — pi-ai error events do not expose a stable HTTP status across providers.
|
|
239
239
|
- **Retry policy is provider-owned, not an SDK retry** — pi-ai SDK retries stay disabled so durable agent steps and `llm/retry` events own every visible attempt, and direct `ctx.llm.stream()` calls remain single-attempt.
|
|
240
|
-
- **
|
|
240
|
+
- **pi-ai partial tool-call arguments may be populated during streaming** — this adapter reads only the delta strings and finalized arguments. The LLM package does not depend on partial arguments before `toolcall_end`.
|
|
241
241
|
|
|
242
242
|
<a id="dev-note"></a>
|
|
243
243
|
### Dev Note
|
|
@@ -237,7 +237,7 @@ pi-ai 事件变成 harness 的推理、文本、工具调用、用量与 finish
|
|
|
237
237
|
- **图片只在 user 与工具结果消息中被接受**——system、developer 或 assistant 历史中的图片在两条转换路径上都会以 `UNSUPPORTED_CONTENT` 失败。
|
|
238
238
|
- **提供方 HTTP 状态不可用**——pi-ai 错误事件不跨提供方暴露稳定 HTTP 状态。
|
|
239
239
|
- **重试策略由提供方自有,而非 SDK 重试**——pi-ai SDK 重试保持禁用,因此持久 agent(智能体)步骤与 `llm/retry` 事件拥有每个可见尝试,直接 `ctx.llm.stream()` 调用仍是单次尝试。
|
|
240
|
-
-
|
|
240
|
+
- **pi-ai partial 工具调用参数可能在流式传输期间填充**——本适配器只读取 delta 字符串与最终参数;LLM 包不会依赖 `toolcall_end` 之前的 partial 参数。
|
|
241
241
|
|
|
242
242
|
<a id="dev-note"></a>
|
|
243
243
|
### 开发备注
|
|
@@ -264,7 +264,59 @@ function toPiAssistant(message, onDegrade) {
|
|
|
264
264
|
* @module dsh-llm-pi-ai/catalog-supplement
|
|
265
265
|
*/
|
|
266
266
|
/** One provider route's supplemental models, keyed by model id. */
|
|
267
|
-
const SUPPLEMENT = {
|
|
267
|
+
const SUPPLEMENT = { anthropic: { "claude-haiku-5-5": {
|
|
268
|
+
id: "claude-haiku-5-5",
|
|
269
|
+
name: "Claude Haiku 5.5",
|
|
270
|
+
api: "anthropic-messages",
|
|
271
|
+
provider: "anthropic",
|
|
272
|
+
baseUrl: "https://api.anthropic.com",
|
|
273
|
+
reasoning: true,
|
|
274
|
+
input: ["text", "image"],
|
|
275
|
+
cost: {
|
|
276
|
+
input: .1,
|
|
277
|
+
output: .5,
|
|
278
|
+
cacheRead: .01,
|
|
279
|
+
cacheWrite: .125,
|
|
280
|
+
tiers: [{
|
|
281
|
+
inputTokensAbove: 1e5,
|
|
282
|
+
input: .5,
|
|
283
|
+
output: 2.5,
|
|
284
|
+
cacheRead: .05,
|
|
285
|
+
cacheWrite: .625
|
|
286
|
+
}]
|
|
287
|
+
},
|
|
288
|
+
contextWindow: 1e6,
|
|
289
|
+
maxTokens: 128e3,
|
|
290
|
+
compat: {
|
|
291
|
+
supportsMidConvoEffort: true,
|
|
292
|
+
supportsMidConvoSystemMessages: true,
|
|
293
|
+
supportsMidConvoToolChanges: true,
|
|
294
|
+
forceAdaptiveThinking: true,
|
|
295
|
+
supportsStrictTools: true
|
|
296
|
+
},
|
|
297
|
+
thinkingLevelMap: {
|
|
298
|
+
off: null,
|
|
299
|
+
xhigh: "xhigh",
|
|
300
|
+
max: "max"
|
|
301
|
+
},
|
|
302
|
+
promptCache: {
|
|
303
|
+
short: 300,
|
|
304
|
+
long: 3600
|
|
305
|
+
},
|
|
306
|
+
inputLimits: {
|
|
307
|
+
maxRequestBytes: 33554432,
|
|
308
|
+
images: {
|
|
309
|
+
maxPerRequest: 600,
|
|
310
|
+
resize: {
|
|
311
|
+
maxWidth: 2e3,
|
|
312
|
+
maxHeight: 2e3,
|
|
313
|
+
maxBytes: 4718592,
|
|
314
|
+
jpegQuality: 80
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
type: "chat"
|
|
319
|
+
} } };
|
|
268
320
|
/**
|
|
269
321
|
* Supplemental catalog models for one pi-ai provider route.
|
|
270
322
|
* @param provider - provider route key.
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@deepseek-ai/dsh-brand": "0.2.1-alpha.2",
|
|
42
42
|
"@deepseek-ai/dsh-util-values": "0.2.1-alpha.2",
|
|
43
43
|
"@deepseek-ai/schemastery": "3.18.5-alpha.1",
|
|
44
|
-
"@earendil-works/pi-ai": "^1.0
|
|
44
|
+
"@earendil-works/pi-ai": "^1.1.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@deepseek-ai/cordis": "4.0.5-alpha.1",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
en: fd474288bb2dac31
|
|
10
10
|
zh: e0e109692d3df1c4
|
|
11
11
|
/deepseek-ai-dsh-sandbox-apple-container/summary:
|
|
12
|
-
en:
|
|
13
|
-
zh:
|
|
12
|
+
en: 20f21185b9538294
|
|
13
|
+
zh: f421f10616852e8f
|
|
14
14
|
/deepseek-ai-dsh-sandbox-apple-container/table-of-contents:
|
|
15
15
|
en: d152484eb41ac6b4
|
|
16
16
|
zh: 09388d293f9be9cb
|
|
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
|
|
|
9
9
|
|
|
10
10
|
## Summary
|
|
11
11
|
|
|
12
|
-
Use this package to
|
|
12
|
+
Use this package to confine bash, terminal, and PTC commands in an [Apple `container`](https://github.com/apple/container) Linux VM on macOS with Apple silicon and CLI 1.5.0 or newer. The VM mounts only the session workspace, limits model file tools to the same read scope, masks `.env` files, excludes credential-shaped environment variables, and makes `.git` read-only. Other hosts and sessions switched with `/sandbox local` use the inherited local sandbox chain.
|
|
13
13
|
|
|
14
14
|
## Table of Contents
|
|
15
15
|
|
|
@@ -9,7 +9,7 @@ kind: "package-reference"
|
|
|
9
9
|
|
|
10
10
|
## 概述
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
使用本包可在搭载 Apple 芯片、运行 Apple `container` CLI 1.5.0 或更高版本的 macOS 上,将 bash、终端和 PTC 命令限制在 [Apple `container`](https://github.com/apple/container) Linux 虚拟机中。虚拟机只挂载会话工作区,模型文件工具也受相同读取范围限制;`.env` 文件会被遮蔽,类似凭据的环境变量不会传入客户机,`.git` 保持只读。其他主机和通过 `/sandbox local` 切换的会话使用继承的本地沙箱链。
|
|
13
13
|
|
|
14
14
|
## 目录
|
|
15
15
|
|
|
@@ -553,7 +553,6 @@ export const stream = (model, context, options) => {
|
|
|
553
553
|
const block = blocks[index];
|
|
554
554
|
if (block && block.type === "toolCall") {
|
|
555
555
|
block.partialJson += event.delta.partial_json;
|
|
556
|
-
block.arguments = parseStreamingJson(block.partialJson);
|
|
557
556
|
stream.push({
|
|
558
557
|
type: "toolcall_delta",
|
|
559
558
|
contentIndex: index,
|
|
@@ -461,7 +461,6 @@ function handleContentBlockDelta(event, blocks, output, stream) {
|
|
|
461
461
|
}
|
|
462
462
|
else if (delta?.toolUse && block?.type === "toolCall") {
|
|
463
463
|
block.partialJson = (block.partialJson || "") + (delta.toolUse.input || "");
|
|
464
|
-
block.arguments = parseStreamingJson(block.partialJson);
|
|
465
464
|
stream.push({ type: "toolcall_delta", contentIndex: index, delta: delta.toolUse.input || "", partial: output });
|
|
466
465
|
}
|
|
467
466
|
else if (delta?.reasoningContent) {
|
package/package.json
CHANGED