@stmcw1/dacw 0.0.0-stage → 1.0.1
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 +128 -2
- package/README_EN.md +129 -0
- package/SAFETY.md +32 -0
- package/SAFETY_EN.md +32 -0
- package/cordis.patch.yml +17 -0
- package/dist/index.js +697 -0
- package/dist/plugin.js +994 -0
- package/dist/runner.js +324 -0
- package/dist/state_manager.js +149 -0
- package/icon.svg +20 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +61 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 stmcw1
|
|
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
CHANGED
|
@@ -1,3 +1,129 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# DACW — 防御性智能体编程工作流
|
|
4
|
+
|
|
5
|
+
让 AI 写代码,让机器验代码,让人做最终裁决。
|
|
6
|
+
|
|
7
|
+
简体中文 | [English](README_EN.md) | [安全声明](SAFETY.md)
|
|
8
|
+
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
DACW 是一个 **DSH Host 插件**:写手子代理按增量协议产出代码,确定性运行机执行项目自带测试,独立审查者给出结构化裁决,最后停在人工闸门。所有失败与异常路径都收敛到 `NEED_HUMAN`,**绝不自动合入**。
|
|
12
|
+
|
|
13
|
+
## 特性
|
|
14
|
+
|
|
15
|
+
- **三权分立**:写手只产出 JSON 变更集,运行机只执行白名单命令,审查者只输出裁决——没有任何一方能独立合入代码。
|
|
16
|
+
- **子代理零工具隔离**:写手/审查者运行在 persona-only preset 上,插件在 `agent/created` 阶段用 `ctx.tools.restrict({ allow: [] })` 剥除全部继承工具并校验可见工具为 0;隔离失败则拒绝创建子代理。
|
|
17
|
+
- **输出协议 v2**:写手只输出相对基线的变更,未提及文件逐字节保留,明显减少 token,并避免"上轮通过的代码被改坏"。
|
|
18
|
+
- **确定性运行机**:命令白名单(npm / pnpm / yarn / npx / node / python / python3 / pytest / cargo / go)、环境变量白名单、超时强杀进程树、输出截断。
|
|
19
|
+
- **结构化审查**:裁决必须为精确 JSON,解析失败按 REJECTED 处理;PASS 但含可疑字样 → 人工闸门。
|
|
20
|
+
- **可配置模型**:写手/审查者可分别继承父会话路由,或从 DSH 已配置模型目录中选择;启动日志与结果对象显示实际生效的模型。
|
|
21
|
+
- **工作区安全闸门**:仅接受空目录或本插件写入的合法 `.dacw-workspace` 标记;拒绝系统根、用户主目录、`DSH_HOME`/profile 目录;写入前做 realpath + 逐段符号链接校验。
|
|
22
|
+
- **审计记录**:状态文件包含任务、文件清单摘要、测试输出与审查文本,HMAC-SHA256 签名。
|
|
23
|
+
|
|
24
|
+
## 工作流程
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
写手(JSON 变更集) → 协调器(校验 / 合并 / 落盘) → 运行机(项目测试)
|
|
28
|
+
│ 失败 → 打回重写(最多 maxRounds 轮)
|
|
29
|
+
审查者(JSON 裁决) → 人工闸门 NEED_HUMAN
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
1. 写手按协议 v2 输出变更。
|
|
33
|
+
2. 协调器做路径越权校验、合并基线并把工作区重置为合并集。
|
|
34
|
+
3. 运行机按项目类型执行测试(每轮重新嗅探)。
|
|
35
|
+
4. 审查者审计全量文件 + 地基文件(锁文件送 SHA256 摘要)。
|
|
36
|
+
5. 通过后返回 `success: true`、`status: "NEED_HUMAN"`;其余路径同样收敛到人工闸门。
|
|
37
|
+
|
|
38
|
+
## 安装
|
|
39
|
+
|
|
40
|
+
前置:DSH 提供 `ctx.subagents`、`agentPresets` 服务与 `spawn` provider(`@deepseek-ai/dsh-subagent-spawn-in-process`);构建需要 Node ≥ 22.13;被测试项目的依赖需人工预装。
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
node build.mjs # 构建 dist/(Node 内置类型擦除,无需 typescript)
|
|
44
|
+
node selftest.mjs # 60 项回归自测
|
|
45
|
+
npm pack --pack-destination ../dacw-pack # 生成安装产物
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
在 DSH 插件管理器中执行 `install_bundle`,target 填 tarball 的绝对路径并加 `file:` 前缀(例如 `file:/absolute/path/to/stmcw1-dacw-1.0.0.tgz`)。安装后向 profile 插入 Host 行 `dacw`(bundle 包名 `@stmcw1/dacw`)。**不要用目录路径安装**——目录安装会绕过 `files` 白名单,把源码、测试与构建脚本一并装进 profile。
|
|
49
|
+
|
|
50
|
+
升级:改代码 → `node build.mjs` → `npm pack` → `remove_bundle` → `install_bundle` 同一 tarball → 重启 Harness。
|
|
51
|
+
|
|
52
|
+
## 使用
|
|
53
|
+
|
|
54
|
+
模型调用 `dacw_run` 工具:
|
|
55
|
+
|
|
56
|
+
| 参数 | 必填 | 说明 |
|
|
57
|
+
|---|---|---|
|
|
58
|
+
| `task` | 是 | 需求描述(自然语言,越具体越好) |
|
|
59
|
+
| `workspace` | 否 | 专用工作区;绝对路径或相对会话工作目录,省略则用配置值/会话工作目录 |
|
|
60
|
+
| `task_id` | 否 | 审计记录文件名后缀;省略自动生成 |
|
|
61
|
+
|
|
62
|
+
成功返回:
|
|
63
|
+
|
|
64
|
+
| 字段 | 说明 |
|
|
65
|
+
|---|---|
|
|
66
|
+
| `success` / `status` | 机器闸门结果;`status` 恒为 `NEED_HUMAN` |
|
|
67
|
+
| `message` | 人类可读结论 |
|
|
68
|
+
| `workspace` / `files` / `round` | 工作区、产出文件、终止轮次 |
|
|
69
|
+
| `models` | `{ writer, reviewer }`,实际生效的模型 |
|
|
70
|
+
| `logs` / `elapsed_ms` | 日志尾部与耗时 |
|
|
71
|
+
|
|
72
|
+
启动日志示例:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
🧠 模型配置 | ✍️ 写手: deepseek-account/deepseek-flash(插件配置) | 🔍 审查者: 继承父会话路由(DSH 默认: deepseek-account/deepseek-flash)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
工作流失败时工具抛出错误(附工作区、状态、轮次与日志尾部),不会把失败伪装成普通结果;所有路径都不提交、不合入。
|
|
79
|
+
|
|
80
|
+
## 模型配置
|
|
81
|
+
|
|
82
|
+
`writerModel` / `reviewerModel` 支持四种取值:
|
|
83
|
+
|
|
84
|
+
| 取值 | 行为 |
|
|
85
|
+
|---|---|
|
|
86
|
+
| `null` / `"inherit"` | 继承父会话路由(默认) |
|
|
87
|
+
| `"provider/model"` | 显式指定,并校验 provider 已在 DSH 中注册 |
|
|
88
|
+
| `"model"` | 按模型名在 DSH 已配置模型目录中解析唯一 provider |
|
|
89
|
+
| `{ provider?, model, reasoningEffort? }` | 对象形式,`reasoningEffort` 透传给子代理 |
|
|
90
|
+
|
|
91
|
+
```yaml
|
|
92
|
+
config:
|
|
93
|
+
writerModel: deepseek-account/deepseek-flash
|
|
94
|
+
reviewerModel: { model: deepseek-flash, reasoningEffort: high }
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
解析发生在每次工具调用开始时,DSH 设置变更即时生效;解析失败即 fail-closed,不会静默换用其他模型。
|
|
98
|
+
|
|
99
|
+
## 安全
|
|
100
|
+
|
|
101
|
+
DACW 会执行模型生成的代码与命令,**不是容器级沙箱**。请在专用或一次性环境、最小权限账号下使用,并始终保留人工终审。完整边界与免责声明见 [SAFETY.md](SAFETY.md)。
|
|
102
|
+
|
|
103
|
+
## 项目结构
|
|
104
|
+
|
|
105
|
+
| 路径 | 职责 |
|
|
106
|
+
|---|---|
|
|
107
|
+
| `plugin.ts` | DSH Host 半边:工具注册、子代理 preset、运行时工具隔离、模型解析、工作区闸门 |
|
|
108
|
+
| `index.ts` | 协调器:轮次、基线合并、运行机调度、裁决、人工闸门 |
|
|
109
|
+
| `runner.ts` | 运行机:命令解析、超时强杀、输出截断 |
|
|
110
|
+
| `state_manager.ts` | 状态:原子写、HMAC、串行队列 |
|
|
111
|
+
| `build.mjs` / `selftest.mjs` | 构建(TS → `dist/`)与回归自测 |
|
|
112
|
+
| `cordis.patch.yml` / `locale/` / `icon.svg` | 插件清单与展示资源 |
|
|
113
|
+
|
|
114
|
+
## 开发
|
|
115
|
+
|
|
116
|
+
- `dist/` 由 `build.mjs` 用 Node 内置类型擦除生成,不依赖 `typescript`,也不入库。
|
|
117
|
+
- 提交前请执行 `node build.mjs && node selftest.mjs`。
|
|
118
|
+
- 完整配置项与默认值见 `plugin.ts` 的 `DEFAULT_PLUGIN_CONFIG`(`cordis.patch.yml` 的 `config` 可逐项覆盖)。
|
|
119
|
+
- 实验性项目,接口与行为可能变化。
|
|
120
|
+
|
|
121
|
+
## 状态
|
|
122
|
+
|
|
123
|
+
实验性开发者预览(当前版本 `v1.0.1`,bundle `@stmcw1/dacw`):构建冒烟与回归自测通过,并已在 DSH `desktop` profile 完成真实闭环验证(写手产出 → `npm test` 通过 → 独立审查 PASS → `NEED_HUMAN`),子代理工具隔离实测生效。欢迎 issue / PR。
|
|
124
|
+
|
|
125
|
+
## 许可证
|
|
126
|
+
|
|
127
|
+
本项目基于 [MIT](LICENSE) 许可证开源。
|
|
128
|
+
|
|
129
|
+
<p align="right">npm: <code>@stmcw1/dacw</code> · <a href="https://github.com/stmcw1/DACW">GitHub</a></p>
|
package/README_EN.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# DACW — Defensive Agent Coding Workflow
|
|
4
|
+
|
|
5
|
+
Let AI write the code, let machines verify it, and let humans make the final call.
|
|
6
|
+
|
|
7
|
+
[简体中文](README.md) | English | [Safety](SAFETY_EN.md)
|
|
8
|
+
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
DACW is a **DSH Host plugin**: a writer subagent emits code changes under an incremental protocol, a deterministic runner executes the project's own tests, an independent reviewer returns a structured verdict, and the workflow stops at a human gate. Every failure path converges to `NEED_HUMAN` — **nothing is ever merged automatically**.
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- **Separation of powers**: the writer only emits a JSON changeset, the runner only executes whitelisted commands, the reviewer only emits a verdict — no single party can merge code.
|
|
16
|
+
- **Zero-tool child isolation**: writer/reviewer run on persona-only presets; on `agent/created` the plugin uses `ctx.tools.restrict({ allow: [] })` to strip every inherited tool and verifies the child sees zero tools. If isolation fails, the child is never created.
|
|
17
|
+
- **Output protocol v2**: the writer emits only deltas against the baseline, untouched files are preserved byte-for-byte, which cuts tokens and prevents "the code that passed last round got broken" regressions.
|
|
18
|
+
- **Deterministic runner**: command whitelist (npm / pnpm / yarn / npx / node / python / python3 / pytest / cargo / go), environment whitelist, timeout tree-kill, output truncation.
|
|
19
|
+
- **Structured review**: the verdict must be exact JSON; unparseable output is treated as REJECTED; PASS containing suspicious wording goes to the human gate.
|
|
20
|
+
- **Configurable models**: writer/reviewer can each inherit the parent session route or select from the DSH configured-model directory; the startup log and the result object show the models actually in effect.
|
|
21
|
+
- **Workspace safety gate**: accepts only an empty directory or a valid `.dacw-workspace` marker written by this plugin; refuses filesystem roots, the user home directory, and `DSH_HOME`/profile directories; writes are checked with realpath plus per-segment symlink checks.
|
|
22
|
+
- **Audit record**: the state file records the task, file manifest summary, test output and review text, signed with HMAC-SHA256.
|
|
23
|
+
|
|
24
|
+
## How it works
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
Writer (JSON changeset) → Orchestrator (validate / merge / write) → Runner (project tests)
|
|
28
|
+
│ failure → rewrite (up to maxRounds)
|
|
29
|
+
Reviewer (JSON verdict) → human gate NEED_HUMAN
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
1. The writer emits deltas under protocol v2.
|
|
33
|
+
2. The orchestrator escape-checks paths, merges the baseline, and resets the workspace to the merged set.
|
|
34
|
+
3. The runner executes tests by project type (re-sniffed every round).
|
|
35
|
+
4. The reviewer audits the full file set plus foundation files (lockfiles as SHA256 digests).
|
|
36
|
+
5. On PASS the tool returns `success: true` and `status: "NEED_HUMAN"`; every other path also converges to the human gate.
|
|
37
|
+
|
|
38
|
+
## Install
|
|
39
|
+
|
|
40
|
+
Prerequisites: a DSH providing `ctx.subagents`, `agentPresets` and the `spawn` provider (`@deepseek-ai/dsh-subagent-spawn-in-process`); Node ≥ 22.13 for the build; the tested project's dependencies must be installed manually.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
node build.mjs # build dist/ (Node built-in type stripping, no typescript)
|
|
44
|
+
node selftest.mjs # 60 regression vectors
|
|
45
|
+
npm pack --pack-destination ../dacw-pack # produce the install artifact
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
In the DSH plugin manager run `install_bundle` with the tarball's absolute path prefixed by `file:` (for example `file:/absolute/path/to/stmcw1-dacw-1.0.0.tgz`). Installation inserts Host row `dacw` (bundle package `@stmcw1/dacw`) into the profile. **Do not install with a directory path** — a directory install bypasses the `files` whitelist and ships sources, tests and build scripts into the profile.
|
|
49
|
+
|
|
50
|
+
Upgrade: edit sources → `node build.mjs` → `npm pack` → `remove_bundle` → `install_bundle` the same tarball → restart the Harness.
|
|
51
|
+
|
|
52
|
+
## Usage
|
|
53
|
+
|
|
54
|
+
A model calls the `dacw_run` tool:
|
|
55
|
+
|
|
56
|
+
| Argument | Required | Description |
|
|
57
|
+
|---|---|---|
|
|
58
|
+
| `task` | yes | Natural-language requirement (the more specific, the better) |
|
|
59
|
+
| `workspace` | no | Dedicated workspace; absolute or relative to the session working directory; omitted means the configured value / session working directory |
|
|
60
|
+
| `task_id` | no | Suffix for the audit record filename; auto-generated when omitted |
|
|
61
|
+
|
|
62
|
+
On success:
|
|
63
|
+
|
|
64
|
+
| Field | Description |
|
|
65
|
+
|---|---|
|
|
66
|
+
| `success` / `status` | Machine-gate result; `status` is always `NEED_HUMAN` |
|
|
67
|
+
| `message` | Human-readable conclusion |
|
|
68
|
+
| `workspace` / `files` / `round` | Workspace, produced files, terminating round |
|
|
69
|
+
| `models` | `{ writer, reviewer }`, the models actually in effect |
|
|
70
|
+
| `logs` / `elapsed_ms` | Log tail and elapsed time |
|
|
71
|
+
|
|
72
|
+
Example startup log line:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
🧠 模型配置 | ✍️ 写手: deepseek-account/deepseek-flash(插件配置) | 🔍 审查者: 继承父会话路由(DSH 默认: deepseek-account/deepseek-flash)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
On workflow failure the tool throws (including workspace, status, round and log tail) instead of returning a normal failure result; no path commits or merges anything.
|
|
79
|
+
|
|
80
|
+
## Model configuration
|
|
81
|
+
|
|
82
|
+
`writerModel` / `reviewerModel` accept four forms:
|
|
83
|
+
|
|
84
|
+
| Value | Behavior |
|
|
85
|
+
|---|---|
|
|
86
|
+
| `null` / `"inherit"` | Inherit the parent session route (default) |
|
|
87
|
+
| `"provider/model"` | Explicit; the provider must be registered in DSH |
|
|
88
|
+
| `"model"` | Resolve the unique provider from the DSH configured-model directory |
|
|
89
|
+
| `{ provider?, model, reasoningEffort? }` | Object form; `reasoningEffort` is forwarded to the child |
|
|
90
|
+
|
|
91
|
+
```yaml
|
|
92
|
+
config:
|
|
93
|
+
writerModel: deepseek-account/deepseek-flash
|
|
94
|
+
reviewerModel: { model: deepseek-flash, reasoningEffort: high }
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Resolution happens at the start of every tool call, so DSH settings changes apply immediately; a resolution failure fails closed and never silently switches models.
|
|
98
|
+
|
|
99
|
+
## Safety
|
|
100
|
+
|
|
101
|
+
DACW executes model-generated code and commands and is **not a container-grade sandbox**. Run it in a disposable or dedicated environment under a least-privilege account, and always keep the human gate. See [SAFETY_EN.md](SAFETY_EN.md) for the full boundaries and disclaimer.
|
|
102
|
+
|
|
103
|
+
## Project layout
|
|
104
|
+
|
|
105
|
+
| Path | Responsibility |
|
|
106
|
+
|---|---|
|
|
107
|
+
| `plugin.ts` | DSH Host half: tool registration, child presets, runtime tool isolation, model resolution, workspace gate |
|
|
108
|
+
| `index.ts` | Orchestrator: rounds, baseline merge, runner dispatch, verdict, human gate |
|
|
109
|
+
| `runner.ts` | Runner: command resolution, timeout tree-kill, output truncation |
|
|
110
|
+
| `state_manager.ts` | State: atomic writes, HMAC, serial queue |
|
|
111
|
+
| `build.mjs` / `selftest.mjs` | Build (TS → `dist/`) and regression self-test |
|
|
112
|
+
| `cordis.patch.yml` / `locale/` / `icon.svg` | Plugin manifest and display resources |
|
|
113
|
+
|
|
114
|
+
## Development
|
|
115
|
+
|
|
116
|
+
- `dist/` is produced by `build.mjs` with Node built-in type stripping; it needs no `typescript` and is not committed.
|
|
117
|
+
- Run `node build.mjs && node selftest.mjs` before submitting changes.
|
|
118
|
+
- Every config field and its default lives in `DEFAULT_PLUGIN_CONFIG` in `plugin.ts` (each can be overridden in the `config` block of `cordis.patch.yml`).
|
|
119
|
+
- Experimental project; interfaces and behavior may change.
|
|
120
|
+
|
|
121
|
+
## Status
|
|
122
|
+
|
|
123
|
+
Experimental developer preview (current version `v1.0.1`, bundle `@stmcw1/dacw`): the build smoke check and regression self-test pass, and a live loop has been verified on the DSH `desktop` profile (writer produced files → `npm test` passed → independent reviewer PASS → `NEED_HUMAN`), with child tool isolation measured in effect. Issues and PRs are welcome.
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
Released under the [MIT](LICENSE) license.
|
|
128
|
+
|
|
129
|
+
<p align="right">npm: <code>@stmcw1/dacw</code> · <a href="https://github.com/stmcw1/DACW">GitHub</a></p>
|
package/SAFETY.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# 安全声明
|
|
2
|
+
|
|
3
|
+
[English](SAFETY_EN.md) | 简体中文
|
|
4
|
+
|
|
5
|
+
## 实验性状态
|
|
6
|
+
|
|
7
|
+
DACW 是实验性开发者预览插件,未经安全审计,不得用于生产环境。它会执行模型生成的代码与命令(npm / pytest / cargo / go 等),并向其开放工作区文件、环境变量与本地进程;错误的模型输出、缺陷、配置错误或恶意输入可能损坏宿主、泄露数据或造成其他非预期影响。
|
|
8
|
+
|
|
9
|
+
## 沙箱限制
|
|
10
|
+
|
|
11
|
+
DACW **不是容器级沙箱**:子进程与宿主同用户同权限,可访问网络。命令白名单、环境变量隔离、HMAC 签名、结构化裁决与人工闸门可以降低风险,但不构成隔离保证。不要把 DACW 作为不可信工作负载唯一的安全控制措施。
|
|
12
|
+
|
|
13
|
+
## 关键边界
|
|
14
|
+
|
|
15
|
+
- 插件运行在 DSH Host 进程内,通过 `node:fs` 直接读写工作区与状态文件,不经过 DSH 会话的文件沙箱;实际文件权限等于运行 Harness 的系统账号权限。
|
|
16
|
+
- 写手/审查者是真实的子代理会话(可在 profile 中查看);显式配置模型时,任务描述与工作区代码会发送给所选模型提供方。
|
|
17
|
+
- 工作区每轮被重置为非地基文件集,这是设计上的破坏性行为;`workspacePolicy: "allow"` 会跳过空目录/标记检查。
|
|
18
|
+
- 状态文件默认落在 `os.tmpdir()/dacw-state`,包含任务描述、测试输出与审查文本,不自动清理、不做崩溃恢复。
|
|
19
|
+
- 子代理工具隔离依赖宿主的 `ctx.tools.restrict` 与 `agent/created` 事件;隔离或 preset 注册失败时默认拒绝运行(可用 `enforceChildToolIsolation` / `allowInheritedPresets` 显式关闭,关闭即失去对应保证)。
|
|
20
|
+
- 被测试项目的依赖需人工预装,`node_modules` 被视为可信基座。
|
|
21
|
+
- 审查者模型可能被工作区注入的指令劫持,格式合法的伪造 PASS 仍可能出现——**人工闸门是最终兜底**。
|
|
22
|
+
|
|
23
|
+
## 负责任地使用
|
|
24
|
+
|
|
25
|
+
- 仅安装来源可信、经过审查的 bundle;安装/升级会修改整个 DSH profile。
|
|
26
|
+
- 在专用或一次性环境、最小权限账号下运行;使用专用空工作区,并备份可访问的文件。
|
|
27
|
+
- 不要把敏感凭据或数据暴露给不可信的模型。
|
|
28
|
+
- 在 NEED_HUMAN 人工终审完成前,不要合入产出。
|
|
29
|
+
|
|
30
|
+
## 免责声明
|
|
31
|
+
|
|
32
|
+
请在充分了解相关风险的前提下使用 DACW。在适用法律允许的最大范围内,作者与版权持有人不对因使用本项目造成的计算机损坏、数据丢失或泄露、文件丢失或其他损害承担责任。
|
package/SAFETY_EN.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Safety
|
|
2
|
+
|
|
3
|
+
[简体中文](SAFETY.md) | English
|
|
4
|
+
|
|
5
|
+
## Experimental status
|
|
6
|
+
|
|
7
|
+
DACW is an experimental developer-preview plugin. It has not undergone a security audit and must not be used in production. It executes model-generated code and commands (npm / pytest / cargo / go etc.) and grants them access to workspace files, environment variables and local processes; wrong model output, defects, misconfiguration or malicious input may damage the host, leak data, or cause other unintended effects.
|
|
8
|
+
|
|
9
|
+
## Sandbox limitations
|
|
10
|
+
|
|
11
|
+
DACW is **not a container-grade sandbox**: child processes run with the same user and privileges as the host and can access the network. Command whitelists, environment isolation, HMAC signing, structured verdicts and the human gate reduce risk but do not constitute isolation. Do not treat DACW as the sole security control for untrusted workloads.
|
|
12
|
+
|
|
13
|
+
## Key boundaries
|
|
14
|
+
|
|
15
|
+
- The plugin runs inside the DSH Host process and reads/writes the workspace and state files through `node:fs`, outside the DSH session file sandbox; effective file permissions are those of the system account running the Harness.
|
|
16
|
+
- Writer/reviewer are real subagent sessions (visible in the profile); with an explicitly configured model, the task description and workspace code are sent to the selected model provider.
|
|
17
|
+
- The workspace is reset to the non-foundation file set every round — destructive by design; `workspacePolicy: "allow"` skips the empty-directory/marker check.
|
|
18
|
+
- State files default to `os.tmpdir()/dacw-state` and contain the task description, test output and review text; they are never cleaned automatically and have no crash recovery.
|
|
19
|
+
- Child tool isolation relies on the host's `ctx.tools.restrict` and the `agent/created` event; when isolation or preset registration fails the run is refused by default (it can be disabled explicitly with `enforceChildToolIsolation` / `allowInheritedPresets`, which gives up the corresponding guarantee).
|
|
20
|
+
- The tested project's dependencies must be installed manually; `node_modules` is treated as a trusted base.
|
|
21
|
+
- The reviewer model can be hijacked by instructions planted in the workspace, and a well-formed forged PASS can still appear — **the human gate is the final line of defense**.
|
|
22
|
+
|
|
23
|
+
## Responsible use
|
|
24
|
+
|
|
25
|
+
- Install only bundles you have reviewed and trust; installing/upgrading modifies the whole DSH profile.
|
|
26
|
+
- Run in a disposable or dedicated environment under a least-privilege account; use a dedicated empty workspace and back up files it can access.
|
|
27
|
+
- Do not expose sensitive credentials or data to untrusted models.
|
|
28
|
+
- Do not merge output before the NEED_HUMAN human review is complete.
|
|
29
|
+
|
|
30
|
+
## Disclaimer
|
|
31
|
+
|
|
32
|
+
Use DACW only with a full understanding of these risks. To the maximum extent permitted by applicable law, the authors and copyright holders are not liable for any computer damage, data loss or leakage, file loss, or other damages arising from the use of this project.
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# DACW bundle patch: inserts one Host plugin row.
|
|
2
|
+
# `id` is the stable row id used by the profile patch layers; `name` resolves to
|
|
3
|
+
# this package. `config` values are merged over the plugin's built-in defaults;
|
|
4
|
+
# every field lives in plugin.ts (DEFAULT_PLUGIN_CONFIG), and README.md covers
|
|
5
|
+
# the main knobs and the writer/reviewer model configuration.
|
|
6
|
+
- insert:
|
|
7
|
+
- id: dacw
|
|
8
|
+
name: '@stmcw1/dacw'
|
|
9
|
+
config:
|
|
10
|
+
toolName: dacw_run
|
|
11
|
+
workspace: ''
|
|
12
|
+
workspacePolicy: guarded
|
|
13
|
+
maxRounds: 3
|
|
14
|
+
subagentProvider: spawn
|
|
15
|
+
# 可选:写手/审查者模型(默认继承父会话路由)
|
|
16
|
+
# writerModel: deepseek-account/deepseek-flash # 或 "deepseek-flash" 按 DSH 已配置模型目录解析 / "inherit"
|
|
17
|
+
# reviewerModel: { model: deepseek-flash, reasoningEffort: high }
|