@creative-dswork/dscode 0.2.0
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/LICENSE +21 -0
- package/README.md +342 -0
- package/dist/dscode.mjs +12424 -0
- package/dist/mdx-runtime.js +566 -0
- package/dist/sandbox.html +184 -0
- package/dist/web/assets/index-Be1HthqJ.css +1 -0
- package/dist/web/assets/index-mH0fup1c.js +72 -0
- package/dist/web/dscode-logo.svg +36 -0
- package/dist/web/favicon.svg +13 -0
- package/dist/web/index.html +17 -0
- package/package.json +47 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 dscode contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/assets/dscode-logo.svg" alt="dscode" width="460" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<strong>
|
|
7
|
+
MCP-first coding agent for digital studios.<br />
|
|
8
|
+
Powering creative work across Blender, game engines, and production tools.
|
|
9
|
+
</strong>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="https://www.npmjs.com/package/@creative-dswork/dscode"><img src="docs/assets/badge-npm.svg" alt="npm version" /></a>
|
|
14
|
+
<img src="docs/assets/badge-node.svg" alt="Node.js >=20" />
|
|
15
|
+
<img src="docs/assets/badge-deepseek.svg" alt="DeepSeek native" />
|
|
16
|
+
<img src="docs/assets/badge-spec-driven.svg" alt="spec driven" />
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
<sub><a href="README.zh-CN.md">中文文档</a></sub>
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## See it in action
|
|
26
|
+
|
|
27
|
+
<table align="center">
|
|
28
|
+
<tr>
|
|
29
|
+
<td align="center" width="50%">
|
|
30
|
+
<img src="docs/screen_shots/show_dscode_web_ui.gif" alt="dscode Web UI" width="100%" />
|
|
31
|
+
<br /><sub><b>Web UI</b> — streaming chat, tool calls, permission dialogs</sub>
|
|
32
|
+
</td>
|
|
33
|
+
<td align="center" width="50%">
|
|
34
|
+
<img src="docs/screen_shots/show_dscode_tui.gif" alt="dscode TUI" width="100%" />
|
|
35
|
+
<br /><sub><b>Terminal UI</b> — real-time streaming, slash commands, inline rendering</sub>
|
|
36
|
+
</td>
|
|
37
|
+
</tr>
|
|
38
|
+
</table>
|
|
39
|
+
|
|
40
|
+
> **Tip:** GIFs auto-play in GitHub. Click any image for full-size view.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## What makes dscode different
|
|
45
|
+
|
|
46
|
+
<table>
|
|
47
|
+
<tr>
|
|
48
|
+
<td width="50%" valign="top">
|
|
49
|
+
|
|
50
|
+
### 🔌 MCP-First
|
|
51
|
+
|
|
52
|
+
Digital studios don't use one tool. They use ten. MCP turns every tool into an API — dscode is the agent that orchestrates them. Blender for 3D modeling, PlayCanvas for real-time graphics, browser automation for testing, documents for specs, spreadsheets for data. If your production tool has an MCP server, dscode brings it into the workflow.
|
|
53
|
+
|
|
54
|
+
**Your toolchain. One agent. All through MCP.**
|
|
55
|
+
|
|
56
|
+
</td>
|
|
57
|
+
<td width="50%" valign="top">
|
|
58
|
+
|
|
59
|
+
### 🧬 Spec-Driven Development
|
|
60
|
+
|
|
61
|
+
dscode is built entirely through **spec coding** with [OpenSpec](https://github.com/Fission-AI/OpenSpec). Every feature begins as a formal spec — `openspec/specs/` is the source of truth, code is the implementation. We don't encourage manual commits; all design and development flows through the SDD pipeline.
|
|
62
|
+
|
|
63
|
+
**Code is the implementation of specs — not the other way around.**
|
|
64
|
+
|
|
65
|
+
</td>
|
|
66
|
+
</tr>
|
|
67
|
+
<tr>
|
|
68
|
+
<td width="50%" valign="top">
|
|
69
|
+
|
|
70
|
+
### 🔍 MCP Tool Search
|
|
71
|
+
|
|
72
|
+
Too many MCP servers? Context explosion is a real problem when every tool schema competes for token budget. dscode ships with a built-in `search_tools` driver — MCP tools are discovered **on-demand** by the model, not pre-loaded. Only the tools actually needed enter the context window. Connect dozens of MCP servers without worrying about overhead.
|
|
73
|
+
|
|
74
|
+
**All the tools. None of the bloat.**
|
|
75
|
+
|
|
76
|
+
</td>
|
|
77
|
+
<td width="50%" valign="top">
|
|
78
|
+
|
|
79
|
+
### 🐋 DeepSeek V4 Pro — Recommended
|
|
80
|
+
|
|
81
|
+
dscode is purpose-built for DeepSeek V4 Pro — our recommended model for digital creation. Its reasoning depth handles complex multi-tool workflows ("model this in Blender, render in PlayCanvas, document the result") without losing context. A **vision model fallback pipeline** transparently routes screenshots and reference images to vision-capable models. Prompt caching is tuned to maintain **97–99% cache hit rates** via `prompt_cache_key` affinity and prefix-stable message construction. Every optimization is measured against DeepSeek's API behavior.
|
|
82
|
+
|
|
83
|
+
**DeepSeek V4 Pro. For when your toolchain needs more than autocomplete.**
|
|
84
|
+
|
|
85
|
+
</td>
|
|
86
|
+
</tr>
|
|
87
|
+
</table>
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Capabilities
|
|
92
|
+
|
|
93
|
+
<table>
|
|
94
|
+
<tr>
|
|
95
|
+
<td width="33%" valign="top">
|
|
96
|
+
<strong>🖥 Terminal + Web</strong><br />
|
|
97
|
+
<sub>Full TUI with streaming, thinking, tool calls. Modern React Web UI with identical feature parity via WebSocket.</sub>
|
|
98
|
+
</td>
|
|
99
|
+
<td width="33%" valign="top">
|
|
100
|
+
<strong>🔌 MCP Connector</strong><br />
|
|
101
|
+
<sub>Stdio, Streamable HTTP (MCP 2025-11-25), legacy SSE fallback. Auto transport inference. MCP App sandbox for server-driven UI.</sub>
|
|
102
|
+
</td>
|
|
103
|
+
<td width="33%" valign="top">
|
|
104
|
+
<strong>🛡 Agent Harness</strong><br />
|
|
105
|
+
<sub>Permission control, context compression (1M token window), session persistence, cross-session memory, retry with exponential backoff.</sub>
|
|
106
|
+
</td>
|
|
107
|
+
</tr>
|
|
108
|
+
<tr>
|
|
109
|
+
<td width="33%" valign="top">
|
|
110
|
+
<strong>📦 Skills System</strong><br />
|
|
111
|
+
<sub>Declarative third-party extensions via SKILL.md. On-demand activation. User-level + project-level scopes.</sub>
|
|
112
|
+
</td>
|
|
113
|
+
<td width="33%" valign="top">
|
|
114
|
+
<strong>👁 Vision Pipeline</strong><br />
|
|
115
|
+
<sub>Auto-routing to vision-capable models. tesseract OCR fallback (ENG + CHI). Drag, paste, or @-file images.</sub>
|
|
116
|
+
</td>
|
|
117
|
+
<td width="33%" valign="top">
|
|
118
|
+
<strong>🔧 Built-in Drivers</strong><br />
|
|
119
|
+
<sub><code>read_file</code>, <code>write_file</code>, <code>edit</code> (hash-anchor), <code>bash</code>, <code>grep</code>, <code>glob</code>. MCP tools discovered on-demand via <code>search_tools</code>.</sub>
|
|
120
|
+
</td>
|
|
121
|
+
</tr>
|
|
122
|
+
</table>
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## MCP in 30 seconds
|
|
127
|
+
|
|
128
|
+
```jsonc
|
|
129
|
+
// ~/.dscode/settings.json
|
|
130
|
+
{
|
|
131
|
+
"mcpServers": {
|
|
132
|
+
"blender": {
|
|
133
|
+
"command": "uvx",
|
|
134
|
+
"args": ["blender-mcp"]
|
|
135
|
+
},
|
|
136
|
+
"playwright": {
|
|
137
|
+
"command": "npx",
|
|
138
|
+
"args": ["@anthropic/mcp-playwright"]
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
dscode auto-connects on launch. Tools appear as `mcp_blender_*` and `mcp_playwright_*`. MCP servers can also serve sandboxed UI via the App Host — no boilerplate, no SDK, no glue code.
|
|
145
|
+
|
|
146
|
+
### See what MCP can do
|
|
147
|
+
|
|
148
|
+
<table align="center">
|
|
149
|
+
<tr>
|
|
150
|
+
<td align="center" width="50%">
|
|
151
|
+
<img src="docs/screen_shots/show_playcanvas.gif" alt="PlayCanvas via MCP" width="100%" />
|
|
152
|
+
<br /><sub><b>PlayCanvas + MCP</b> — build a jump game entirely through natural language</sub>
|
|
153
|
+
</td>
|
|
154
|
+
<td align="center" width="50%">
|
|
155
|
+
<img src="docs/screen_shots/show_blender.gif" alt="Blender via MCP" width="100%" />
|
|
156
|
+
<br /><sub><b>Blender + MCP</b> — 3D modeling and scene composition through conversation</sub>
|
|
157
|
+
</td>
|
|
158
|
+
</tr>
|
|
159
|
+
</table>
|
|
160
|
+
|
|
161
|
+
> **Tip:** These are real MCP workflows — dscode orchestrates PlayCanvas and Blender as if they were native APIs.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Install
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
npm install -g @creative-dswork/dscode
|
|
169
|
+
dscode # Terminal UI
|
|
170
|
+
dscode --web # Web UI → http://localhost:3000
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
> First launch? Run `/config key <your-api-key>` and `/config model deepseek-v4-pro` to get started. Type `/help` for the full guide.
|
|
174
|
+
|
|
175
|
+
**Build from source:**
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
git clone https://github.com/creativedswork/dscode.git
|
|
179
|
+
cd dscode && npm install && npm run build
|
|
180
|
+
node dist/dscode.mjs
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Configuration
|
|
186
|
+
|
|
187
|
+
dscode uses two levels of `settings.json`, merged with project settings overriding user settings:
|
|
188
|
+
|
|
189
|
+
| Scope | Path | Purpose |
|
|
190
|
+
|-------|------|---------|
|
|
191
|
+
| User | `~/.dscode/settings.json` | Defaults across all projects |
|
|
192
|
+
| Project | `.dscode/settings.json` | Per-project overrides |
|
|
193
|
+
|
|
194
|
+
> **Note:** Model configuration (`provider`, `modelId`, `apiKey`, `thinkingLevel`) lives in `~/.dscode/config.json`, managed via `/config` commands. Type `/help` in-session for the full command list.
|
|
195
|
+
|
|
196
|
+
### Quick reference
|
|
197
|
+
|
|
198
|
+
```jsonc
|
|
199
|
+
// ~/.dscode/settings.json
|
|
200
|
+
{
|
|
201
|
+
// --- MCP Servers ---
|
|
202
|
+
"mcpServers": {
|
|
203
|
+
"blender": {
|
|
204
|
+
"command": "uvx",
|
|
205
|
+
"args": ["blender-mcp"]
|
|
206
|
+
},
|
|
207
|
+
"playwright": {
|
|
208
|
+
"command": "npx",
|
|
209
|
+
"args": ["@anthropic/mcp-playwright"]
|
|
210
|
+
},
|
|
211
|
+
"my-api": {
|
|
212
|
+
"url": "https://my-mcp.example.com/mcp",
|
|
213
|
+
"headers": { "Authorization": "Bearer <token>" }
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
|
|
217
|
+
// --- Permissions ---
|
|
218
|
+
"permissions": {
|
|
219
|
+
"allow": [
|
|
220
|
+
"Bash(git add *)",
|
|
221
|
+
"Bash(npm *)"
|
|
222
|
+
],
|
|
223
|
+
"deny": [
|
|
224
|
+
"Bash(rm -rf *)"
|
|
225
|
+
],
|
|
226
|
+
"rules": [
|
|
227
|
+
{ "tool": "Bash(curl *)", "decision": "allow", "priority": 5 }
|
|
228
|
+
]
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
// --- Skills ---
|
|
232
|
+
"skills": ["brandkit", "minimalist-ui"],
|
|
233
|
+
|
|
234
|
+
// --- Retry ---
|
|
235
|
+
// Controls how dscode retries failed API calls (rate limits, timeouts, server errors).
|
|
236
|
+
// Uses exponential backoff: starts at baseDelayMs, doubles each retry, capped at maxDelayMs.
|
|
237
|
+
"retry": {
|
|
238
|
+
"maxRetries": 3, // Max retry attempts before giving up
|
|
239
|
+
"baseDelayMs": 1000, // Initial delay before first retry (ms)
|
|
240
|
+
"maxDelayMs": 30000, // Upper bound on backoff delay (ms)
|
|
241
|
+
"retryOnTimeout": true, // Retry when the provider times out
|
|
242
|
+
"retryOnRateLimit": true, // Retry when hitting rate limits (respects Retry-After header)
|
|
243
|
+
"retryOnServerError": true // Retry on 5xx server errors
|
|
244
|
+
},
|
|
245
|
+
|
|
246
|
+
// --- @-file limits ---
|
|
247
|
+
"atFileMaxFiles": 5,
|
|
248
|
+
"atFileMaxFileSize": 51200,
|
|
249
|
+
"atFileMaxTotalSize": 204800
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### MCP server config
|
|
254
|
+
|
|
255
|
+
Each server under `mcpServers` supports:
|
|
256
|
+
|
|
257
|
+
| Field | Type | Description |
|
|
258
|
+
|-------|------|-------------|
|
|
259
|
+
| `command` | string | Executable (for stdio transport) |
|
|
260
|
+
| `args` | string[] | Arguments passed to the command |
|
|
261
|
+
| `url` | string | HTTP endpoint (for streamable-http transport) |
|
|
262
|
+
| `env` | object | Extra environment variables for the server process |
|
|
263
|
+
| `headers` | object | Custom HTTP headers |
|
|
264
|
+
| `transport` | string | `"stdio"` \| `"streamable-http"` \| `"sse"` (auto-detected if omitted) |
|
|
265
|
+
| `preferredProtocolVersion` | string | `"2025-11-25"` \| `"2025-03-26"` \| `"2024-11-05"` |
|
|
266
|
+
| `requestTimeoutMs` | number | Per-request timeout |
|
|
267
|
+
| `connectTimeoutMs` | number | Connection timeout |
|
|
268
|
+
|
|
269
|
+
> **Tip:** Transport is auto-detected — if `url` is set without `command`, streamable-http is used. Otherwise stdio.
|
|
270
|
+
|
|
271
|
+
### Environment variables
|
|
272
|
+
|
|
273
|
+
All settings can also be set via environment variables for CI / containers:
|
|
274
|
+
|
|
275
|
+
| Variable | Setting |
|
|
276
|
+
|----------|---------|
|
|
277
|
+
| `DEEPSEEK_API_KEY` | API key (provider-specific vars also supported: `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, etc.) |
|
|
278
|
+
| `AGENT_PROVIDER` | Provider override |
|
|
279
|
+
| `AGENT_MODEL` | Model override |
|
|
280
|
+
| `AGENT_THINKING_LEVEL` | Thinking level override |
|
|
281
|
+
| `AGENT_VISION_PROVIDER` | Vision model provider |
|
|
282
|
+
| `AGENT_VISION_MODEL` | Vision model ID |
|
|
283
|
+
| `DSCODE_MAX_TOKENS` | Max tokens |
|
|
284
|
+
| `DSCODE_CONFIG_HOME` | Custom config directory (default: `~/.dscode`) |
|
|
285
|
+
| `DSCODE_DATA_HOME` | Custom data directory |
|
|
286
|
+
| `DSCODE_PROJECT_PATH` | Project directory |
|
|
287
|
+
| `DSCODE_RETRY_MAX_RETRIES` | Retry max retries |
|
|
288
|
+
| `DSCODE_RETRY_BASE_DELAY_MS` | Retry base delay |
|
|
289
|
+
| `DSCODE_RETRY_MAX_DELAY_MS` | Retry max delay |
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
## Harness Philosophy
|
|
295
|
+
|
|
296
|
+
We follow **Occam's razor** in harness design. dscode does not pre-build intent understanding modules, plan modes, or elaborate agentic scaffolding until the system prompt proves insufficient. Most coding agents pile on pre-turn planning, reflection loops, and multi-agent orchestration upfront — we wait until the model demands it.
|
|
297
|
+
|
|
298
|
+
That doesn't mean the harness is bare. It means every piece earns its place.
|
|
299
|
+
|
|
300
|
+
One example where we went deeper: the **edit tool**. Based on [@_can1357's hash-anchor protocol](https://x.com/_can1357/status/2021828033640911196), our `edit` tool replaces fragile line-number and regex-based editing with a **content-addressable anchor system** ([spec](openspec/specs/edit-tool/spec.md)):
|
|
301
|
+
|
|
302
|
+
- **Three-level adaptive resolution** — ambiguous 6-char hashes are resolved silently through 8-char → context-augmented (3-line window) matching before rejection
|
|
303
|
+
- **Occurrence + line-hint disambiguation** — `occurrence: 3` picks the Nth match; `line` field auto-selects the closest candidate, rejecting only when equidistant
|
|
304
|
+
- **Proximity-based range resolution** — for range endpoints, if one side is unique the other automatically resolves to the nearest candidate in the correct direction
|
|
305
|
+
- **Low-entropy filtering** — lines like `}` are rejected as anchors; the tool returns up to 6 neighboring `[high]` anchors as alternatives
|
|
306
|
+
- **Atomic batch + overlap detection** — 6 operation types in one call, all-or-nothing. Overlapping ranges within a batch are detected and rejected
|
|
307
|
+
- **Checkpoint + safety rollback** — file checkpointed before edit. Post-edit sanity checks (duplicate lines, delimiter balance, orphan `else`) roll back suspicious changes
|
|
308
|
+
- **Structured invalidation scope** — `anchors_valid_through` and `must_refresh_from_line` tell the model exactly which anchors survive, enabling chained edits without re-reading
|
|
309
|
+
- **Localized diff with live anchors** — successful edits return a diff with fresh 6-char hashes, so the model can continue editing immediately
|
|
310
|
+
|
|
311
|
+
**dscode builds dscode.** This edit tool — combined with our spec-driven workflow — is what enabled dscode to develop itself. Every feature, from the hash-anchor protocol to the checkpoint system, was implemented by dscode running on DeepSeek V4 Pro, editing its own source tree through MCP-driven tools. It's not a demo. It's how this project ships.
|
|
312
|
+
|
|
313
|
+
This is the kind of harness work we invest in: not adding more AI, but making the AI's tools dependable.
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
## Learn more
|
|
318
|
+
|
|
319
|
+
| Document | What's inside |
|
|
320
|
+
|----------|---------------|
|
|
321
|
+
| [ARCHITECTURE.md](docs/ARCHITECTURE.md) | Full architecture: Agent as OS, 6-layer design, Driver/Skill model, source tree |
|
|
322
|
+
| [ROADMAP.md](docs/ROADMAP.md) | What's next: Sub-Agent system, System Prompt modularization, Diff-based editing |
|
|
323
|
+
| [CONTRIBUTING.md](CONTRIBUTING.md) | How to contribute: philosophy alignment, OpenSpec SDD workflow, coding conventions |
|
|
324
|
+
| [STYLE.md](docs/STYLE.md) | TypeScript coding style: naming, imports, module structure, error handling |
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## Acknowledgments
|
|
329
|
+
|
|
330
|
+
dscode stands on the shoulders of:
|
|
331
|
+
|
|
332
|
+
- **[OpenSpec](https://github.com/Fission-AI/OpenSpec)** — the spec-driven development framework that shapes our entire workflow
|
|
333
|
+
|
|
334
|
+
- **[pi-ai](https://www.npmjs.com/package/@mariozechner/pi-ai) / [pi-agent-core](https://www.npmjs.com/package/@mariozechner/pi-agent-core)** — Mario Zechner's agent loop and model abstraction foundation
|
|
335
|
+
- **[taste-skill](https://github.com/Leonxlnx/taste-skill)** — Leonxlnx's design taste skill system, inspired our skills architecture
|
|
336
|
+
- **[@_can1357](https://x.com/_can1357/status/2021828033640911196)** — hash-anchor editing protocol, the cornerstone of our `edit` tool
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
<p align="center">
|
|
341
|
+
<sub>If you like this project, give it a ⭐ Star — your support keeps dscode evolving.</sub>
|
|
342
|
+
</p>
|