@crazyhappyone/dsh-tui 0.1.0-alpha.42 → 0.1.0-alpha.43

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/dist/zen-proxy.js CHANGED
@@ -835,15 +835,19 @@ function apply(ctx, config) {
835
835
  forward(req, res, { method: "GET", path: `${config.upstreamBasePath}/models`, body: null });
836
836
  return;
837
837
  }
838
- if (method !== "POST" || url !== "/v1/chat/completions") {
838
+ const forwardablePost = url === "/v1/chat/completions" || url === "/v1/responses";
839
+ if (method !== "POST" || !forwardablePost) {
839
840
  res.writeHead(404, { "content-type": "application/json" });
840
841
  res.end(JSON.stringify({ error: { type: "not_found", message: `zen-proxy: unsupported ${method} ${url}` } }));
841
842
  return;
842
843
  }
843
844
  let body = "";
844
- req.on("data", (c) => body += c);
845
+ req.on("data", (c) => {
846
+ body += c;
847
+ });
845
848
  req.on("end", () => {
846
- forward(req, res, { method: "POST", path: `${config.upstreamBasePath}/chat/completions`, body });
849
+ const upstreamPath = url === "/v1/responses" ? "/responses" : "/chat/completions";
850
+ forward(req, res, { method: "POST", path: `${config.upstreamBasePath}${upstreamPath}`, body });
847
851
  });
848
852
  });
849
853
  server.on("error", (error) => {
@@ -862,15 +866,18 @@ function apply(ctx, config) {
862
866
  function forward(req, res, { method, path, body }) {
863
867
  const headers = {
864
868
  "content-type": "application/json",
865
- // Pass through the caller's Authorization if present; nothing else.
866
- ...req.headers.authorization ? { authorization: req.headers.authorization } : {},
867
869
  "user-agent": config.userAgent,
868
870
  "x-opencode-client": config.clientHeader,
869
871
  "x-opencode-project": config.projectHeader,
870
872
  "x-opencode-session": rnd("ses_"),
871
873
  "x-opencode-request": rnd("msg_")
872
874
  };
873
- if (body !== null) headers["content-length"] = Buffer.byteLength(body);
875
+ if (req.headers.authorization !== void 0) {
876
+ headers.authorization = req.headers.authorization;
877
+ }
878
+ if (body !== null) {
879
+ headers["content-length"] = Buffer.byteLength(body);
880
+ }
874
881
  const out = https.request(
875
882
  {
876
883
  host: config.upstreamHost,
@@ -889,8 +896,11 @@ function apply(ctx, config) {
889
896
  res.writeHead(502);
890
897
  res.end(String(e));
891
898
  });
892
- if (body !== null) out.end(body);
893
- else out.end();
899
+ if (body === null) {
900
+ out.end();
901
+ } else {
902
+ out.end(body);
903
+ }
894
904
  }
895
905
  }
896
906
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crazyhappyone/dsh-tui",
3
- "version": "0.1.0-alpha.42",
3
+ "version": "0.1.0-alpha.43",
4
4
  "description": "Source-runtime launcher for the DeepSeek Harness terminal interface",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,3 +1,4 @@
1
+ # yaml-language-server: $schema=none
1
2
  # The deepseek-tui bundle patch: terminal-surface mode directly over dsh-base.
2
3
  # It mounts no Host, HTTP server, Web runtime, or browser plugin. An ordinary
3
4
  # provider plugin parses --resume/--cwd and the task positional, then the
@@ -9,8 +10,10 @@
9
10
  - id: system-prompt
10
11
  config:
11
12
  persona: >-
12
- You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}.
13
- You are interacting with the user through the deepseek-tui terminal interface.
13
+ You are a coding agent powered by the {{model}} model.
14
+ Your working directory is {{cwd}}.
15
+ You are interacting with the user through the deepseek-tui
16
+ terminal interface.
14
17
 
15
18
  # The shared module-reload HMR row stays off; the launcher's watch-only
16
19
  # fallback still keeps the user patch layers live until the run exits.
@@ -20,11 +23,16 @@
20
23
  - id: tools
21
24
  config:
22
25
  # Keep the same temporary process-wide Code Mode opt-in as the Web surface.
26
+ # pi-lens-ignore: YAML:0
23
27
  mode: !!js process.env.DSH_TOOLS_MODE
24
28
 
25
29
  - id: approval
30
+ # pi-lens-ignore: YAML:0
26
31
  config:
27
- policy: !!js "(process.env.DSH_PERMISSION_MODE ?? 'workspace-write') === 'danger-full-access' ? 'never' : 'ask'"
32
+ policy: !!js >-
33
+ (process.env.DSH_PERMISSION_MODE ?? 'workspace-write')
34
+ === 'danger-full-access'
35
+ ? 'never' : 'ask'
28
36
 
29
37
  # Full-text session search stays disabled until the first Ctrl+K search (the
30
38
  # base row's `openAt: never`). The TUI has no browser-latency concern, so the
@@ -39,11 +47,15 @@
39
47
  models:
40
48
  - id: deepseek-v4-flash
41
49
  name: DeepSeek-V4-Flash
42
- description: Fast, efficient, and economical; suited to focused, routine, or parallel tasks.
50
+ description: >-
51
+ Fast, efficient, and economical; suited to focused, routine,
52
+ or parallel tasks.
43
53
  contextWindow: 1000000
44
54
  - id: deepseek-v4-pro
45
55
  name: DeepSeek-V4-Pro
46
- description: Stronger agentic coding, knowledge, and difficult reasoning; suited to complex or quality-critical tasks at higher cost.
56
+ description: >-
57
+ Stronger agentic coding, knowledge, and difficult reasoning;
58
+ suited to complex or quality-critical tasks at higher cost.
47
59
  contextWindow: 1000000
48
60
  - id: deepseek-v4-flash-vision-exp
49
61
  name: DeepSeek-V4-Flash-Vision-Exp
@@ -51,13 +63,17 @@
51
63
  inputModalities: [text, image]
52
64
  - id: deepseek-v4.1-flash-expires-on-0910
53
65
  name: DeepSeek-V4.1-Flash
54
- description: DeepSeek V4.1 Flash intermediate beta with native multimodal support, higher capability, faster speed, and lower cost.
66
+ description: >-
67
+ DeepSeek V4.1 Flash intermediate beta with native multimodal
68
+ support, higher capability, faster speed, and lower cost.
55
69
  contextWindow: 1000000
56
70
  inputModalities: [text, image]
57
71
 
58
72
  - id: agent-default-model
59
73
  config:
74
+ # pi-lens-ignore: YAML:0
60
75
  provider: deepseek-official
76
+ # pi-lens-ignore: YAML:0
61
77
  model: !!js "process.env.DSH_MODEL ?? 'deepseek-v4-flash'"
62
78
 
63
79
  - insert:
@@ -92,17 +108,32 @@
92
108
  - id: llm-anthropic
93
109
  name: "@deepseek-ai/dsh-llm-anthropic"
94
110
 
111
+ # In-process OpenCode Zen header proxy (vendored from
112
+ # zhangyang-crazy-one/dsh-zen-proxy, MIT). Listens on localhost
113
+ # only; point an opencode provider baseURL at
114
+ # http://127.0.0.1:4097/v1 to reach the Zen free tier.
115
+ # Remove this row to disable the listener.
116
+ - id: zen-proxy
117
+ name: "./zen-proxy/index.js"
118
+ config:
119
+ host: 127.0.0.1
120
+ port: 4097
121
+
95
122
  # Reads its task from the ordinary tuiStartup provider.
96
123
  - id: tui-runtime
124
+ # pi-lens-ignore: YAML:0
97
125
  name: "@deepseek-ai/dsh-tui"
98
126
  inject: [tuiStartup]
127
+ # pi-lens-ignore: YAML:0
99
128
  config:
129
+ # pi-lens-ignore: YAML:0
100
130
  task: !!js ctx.tuiStartup.task
101
131
  resume: !!js ctx.tuiStartup.resume
132
+ # pi-lens-ignore: YAML:0
102
133
  cwd: !!js ctx.tuiStartup.cwd
103
134
  model: !!js ctx.tuiStartup.model
104
135
  frameStats: !!js ctx.tuiStartup.frameStats
105
- # Render policy (overscan + stream pacing + scroll pacing + cache budgets).
136
+ # Render policy (overscan, stream pacing, scroll pacing, cache).
106
137
  # Loaded by the runtime Config schema; the values below mirror the
107
138
  # schema defaults so the deployment layer owns the tunables. Override
108
139
  # here to retune without touching the plugin.