dvalincode 0.22.0 → 0.24.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.
Files changed (195) hide show
  1. package/README.md +103 -35
  2. package/README.zh-CN.md +86 -30
  3. package/dist/agent/compact.js +9 -1
  4. package/dist/agent/compact.js.map +1 -1
  5. package/dist/agent/loop.d.ts +9 -1
  6. package/dist/agent/loop.js +58 -14
  7. package/dist/agent/loop.js.map +1 -1
  8. package/dist/agent/modes.js +7 -0
  9. package/dist/agent/modes.js.map +1 -1
  10. package/dist/agent/runner.d.ts +13 -1
  11. package/dist/agent/runner.js +198 -33
  12. package/dist/agent/runner.js.map +1 -1
  13. package/dist/agent/session.d.ts +21 -0
  14. package/dist/agent/session.js +76 -36
  15. package/dist/agent/session.js.map +1 -1
  16. package/dist/agent/toolFollowups.d.ts +13 -0
  17. package/dist/agent/toolFollowups.js +50 -0
  18. package/dist/agent/toolFollowups.js.map +1 -0
  19. package/dist/agent/types.d.ts +3 -1
  20. package/dist/agent/types.js.map +1 -1
  21. package/dist/audit/log.d.ts +41 -1
  22. package/dist/audit/log.js.map +1 -1
  23. package/dist/audit/minimize.js +2 -1
  24. package/dist/audit/minimize.js.map +1 -1
  25. package/dist/audit/taps.js +10 -1
  26. package/dist/audit/taps.js.map +1 -1
  27. package/dist/cli.js +4 -0
  28. package/dist/cli.js.map +1 -1
  29. package/dist/commands/agents.d.ts +11 -0
  30. package/dist/commands/agents.js +223 -0
  31. package/dist/commands/agents.js.map +1 -0
  32. package/dist/commands/checkpoint.d.ts +3 -0
  33. package/dist/commands/checkpoint.js +34 -0
  34. package/dist/commands/checkpoint.js.map +1 -0
  35. package/dist/commands/mcpInstall.d.ts +24 -0
  36. package/dist/commands/mcpInstall.js +62 -17
  37. package/dist/commands/mcpInstall.js.map +1 -1
  38. package/dist/commands/provider.js +4 -1
  39. package/dist/commands/provider.js.map +1 -1
  40. package/dist/commands/run.d.ts +1 -0
  41. package/dist/commands/run.js +46 -18
  42. package/dist/commands/run.js.map +1 -1
  43. package/dist/commands/security.d.ts +13 -0
  44. package/dist/commands/security.js +47 -10
  45. package/dist/commands/security.js.map +1 -1
  46. package/dist/core/checkpoint.d.ts +41 -0
  47. package/dist/core/checkpoint.js +159 -0
  48. package/dist/core/checkpoint.js.map +1 -0
  49. package/dist/core/context.d.ts +7 -0
  50. package/dist/core/context.js +1 -0
  51. package/dist/core/context.js.map +1 -1
  52. package/dist/core/gitRead.d.ts +20 -0
  53. package/dist/core/gitRead.js +97 -0
  54. package/dist/core/gitRead.js.map +1 -0
  55. package/dist/core/ignorefile.d.ts +2 -0
  56. package/dist/core/ignorefile.js +8 -0
  57. package/dist/core/ignorefile.js.map +1 -1
  58. package/dist/core/policy.d.ts +4 -0
  59. package/dist/core/policy.js +8 -6
  60. package/dist/core/policy.js.map +1 -1
  61. package/dist/core/redactSecrets.d.ts +14 -0
  62. package/dist/core/redactSecrets.js +35 -0
  63. package/dist/core/redactSecrets.js.map +1 -0
  64. package/dist/core/trust.d.ts +5 -0
  65. package/dist/core/trust.js +12 -0
  66. package/dist/core/trust.js.map +1 -1
  67. package/dist/core/webEgress.d.ts +66 -0
  68. package/dist/core/webEgress.js +281 -0
  69. package/dist/core/webEgress.js.map +1 -0
  70. package/dist/dvalinCli.js +2 -0
  71. package/dist/dvalinCli.js.map +1 -1
  72. package/dist/evidence/compliance.js +1 -1
  73. package/dist/evidence/compliance.js.map +1 -1
  74. package/dist/harness/run.d.ts +4 -0
  75. package/dist/harness/run.js +20 -15
  76. package/dist/harness/run.js.map +1 -1
  77. package/dist/mcp/agents.d.ts +41 -0
  78. package/dist/mcp/agents.js +129 -0
  79. package/dist/mcp/agents.js.map +1 -0
  80. package/dist/mcp/install.d.ts +43 -6
  81. package/dist/mcp/install.js +104 -1
  82. package/dist/mcp/install.js.map +1 -1
  83. package/dist/mcp/register.js +4 -1
  84. package/dist/mcp/register.js.map +1 -1
  85. package/dist/mcp/server.d.ts +3 -2
  86. package/dist/mcp/server.js +33 -9
  87. package/dist/mcp/server.js.map +1 -1
  88. package/dist/providers/anthropic.js +16 -1
  89. package/dist/providers/anthropic.js.map +1 -1
  90. package/dist/providers/chatImages.d.ts +21 -0
  91. package/dist/providers/chatImages.js +18 -0
  92. package/dist/providers/chatImages.js.map +1 -0
  93. package/dist/providers/egress.js +7 -0
  94. package/dist/providers/egress.js.map +1 -1
  95. package/dist/providers/openaiCompatible.js +19 -1
  96. package/dist/providers/openaiCompatible.js.map +1 -1
  97. package/dist/providers/retry.js +2 -0
  98. package/dist/providers/retry.js.map +1 -1
  99. package/dist/providers/runBudget.d.ts +11 -0
  100. package/dist/providers/runBudget.js +74 -0
  101. package/dist/providers/runBudget.js.map +1 -0
  102. package/dist/providers/trustedBaseUrls.js +1 -1
  103. package/dist/providers/trustedBaseUrls.js.map +1 -1
  104. package/dist/providers/types.d.ts +6 -0
  105. package/dist/remediation/cases.d.ts +1 -0
  106. package/dist/remediation/cases.js +1 -0
  107. package/dist/remediation/cases.js.map +1 -1
  108. package/dist/remediation/codexSecurity.d.ts +54 -0
  109. package/dist/remediation/codexSecurity.js +366 -0
  110. package/dist/remediation/codexSecurity.js.map +1 -0
  111. package/dist/remediation/sarif.d.ts +10 -0
  112. package/dist/remediation/sarif.js +2 -2
  113. package/dist/remediation/sarif.js.map +1 -1
  114. package/dist/remediation/scannerSuite.d.ts +1 -0
  115. package/dist/remediation/scannerSuite.js +1 -1
  116. package/dist/remediation/scannerSuite.js.map +1 -1
  117. package/dist/server/auth.d.ts +33 -0
  118. package/dist/server/auth.js +53 -0
  119. package/dist/server/auth.js.map +1 -0
  120. package/dist/server/configStore.d.ts +10 -0
  121. package/dist/server/configStore.js +9 -0
  122. package/dist/server/configStore.js.map +1 -1
  123. package/dist/server/index.d.ts +5 -0
  124. package/dist/server/index.js +73 -5
  125. package/dist/server/index.js.map +1 -1
  126. package/dist/server/routes/config.js +37 -0
  127. package/dist/server/routes/config.js.map +1 -1
  128. package/dist/server/routes/sessions.js +2 -1
  129. package/dist/server/routes/sessions.js.map +1 -1
  130. package/dist/server/wsHandler.js +23 -12
  131. package/dist/server/wsHandler.js.map +1 -1
  132. package/dist/sessions/journal.d.ts +2 -0
  133. package/dist/sessions/journal.js.map +1 -1
  134. package/dist/sessions/store.d.ts +6 -0
  135. package/dist/sessions/store.js +11 -0
  136. package/dist/sessions/store.js.map +1 -1
  137. package/dist/tools/applyPatch.d.ts +13 -0
  138. package/dist/tools/applyPatch.js +144 -0
  139. package/dist/tools/applyPatch.js.map +1 -0
  140. package/dist/tools/askUser.d.ts +3 -0
  141. package/dist/tools/askUser.js +23 -0
  142. package/dist/tools/askUser.js.map +1 -0
  143. package/dist/tools/checkDiagnostics.d.ts +8 -0
  144. package/dist/tools/checkDiagnostics.js +48 -0
  145. package/dist/tools/checkDiagnostics.js.map +1 -0
  146. package/dist/tools/editFile.d.ts +8 -2
  147. package/dist/tools/editFile.js +95 -26
  148. package/dist/tools/editFile.js.map +1 -1
  149. package/dist/tools/gitBlame.d.ts +11 -0
  150. package/dist/tools/gitBlame.js +43 -0
  151. package/dist/tools/gitBlame.js.map +1 -0
  152. package/dist/tools/gitDiff.js +13 -24
  153. package/dist/tools/gitDiff.js.map +1 -1
  154. package/dist/tools/gitLog.d.ts +11 -0
  155. package/dist/tools/gitLog.js +39 -0
  156. package/dist/tools/gitLog.js.map +1 -0
  157. package/dist/tools/gitShow.d.ts +11 -0
  158. package/dist/tools/gitShow.js +41 -0
  159. package/dist/tools/gitShow.js.map +1 -0
  160. package/dist/tools/gitStatus.js +2 -5
  161. package/dist/tools/gitStatus.js.map +1 -1
  162. package/dist/tools/htmlText.d.ts +19 -0
  163. package/dist/tools/htmlText.js +104 -0
  164. package/dist/tools/htmlText.js.map +1 -0
  165. package/dist/tools/readFile.js +84 -1
  166. package/dist/tools/readFile.js.map +1 -1
  167. package/dist/tools/registry.d.ts +2 -1
  168. package/dist/tools/registry.js +29 -3
  169. package/dist/tools/registry.js.map +1 -1
  170. package/dist/tools/rollbackRun.d.ts +5 -0
  171. package/dist/tools/rollbackRun.js +142 -0
  172. package/dist/tools/rollbackRun.js.map +1 -0
  173. package/dist/tools/runCheck.js +10 -1
  174. package/dist/tools/runCheck.js.map +1 -1
  175. package/dist/tools/searchText.d.ts +10 -0
  176. package/dist/tools/searchText.js +193 -19
  177. package/dist/tools/searchText.js.map +1 -1
  178. package/dist/tools/updatePlan.d.ts +38 -0
  179. package/dist/tools/updatePlan.js +81 -0
  180. package/dist/tools/updatePlan.js.map +1 -0
  181. package/dist/tools/webFetch.d.ts +8 -0
  182. package/dist/tools/webFetch.js +103 -0
  183. package/dist/tools/webFetch.js.map +1 -0
  184. package/dist/tools/webSearch.d.ts +26 -0
  185. package/dist/tools/webSearch.js +157 -0
  186. package/dist/tools/webSearch.js.map +1 -0
  187. package/dist/tools/writeFile.js +4 -1
  188. package/dist/tools/writeFile.js.map +1 -1
  189. package/dist/tui/app.js +22 -1
  190. package/dist/tui/app.js.map +1 -1
  191. package/dist/tui/render.js +7 -1
  192. package/dist/tui/render.js.map +1 -1
  193. package/dist/version.d.ts +1 -1
  194. package/dist/version.js +1 -1
  195. package/package.json +1 -1
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  <p align="center">
10
10
  <a href="https://github.com/arthurpanhku/dvalincode/releases/latest"><img src="https://img.shields.io/github/v/release/arthurpanhku/dvalincode?style=for-the-badge&color=818cf8&label=Release" alt="Release"></a>
11
11
  <a href="https://github.com/arthurpanhku/dvalincode/releases"><img src="https://img.shields.io/github/downloads/arthurpanhku/dvalincode/total?style=for-the-badge&color=blue&label=Downloads" alt="Downloads"></a>
12
- <a href="#-tests"><img src="https://img.shields.io/badge/Tests-584%20%2F%20584%20%E2%9C%93-success?style=for-the-badge" alt="Tests"></a>
12
+ <a href="#-tests"><img src="https://img.shields.io/badge/Tests-819%20%2F%20819%20%E2%9C%93-success?style=for-the-badge" alt="Tests"></a>
13
13
  <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-green?style=for-the-badge" alt="License"></a>
14
14
  <a href="https://scorecard.dev/viewer/?uri=github.com/arthurpanhku/dvalincode"><img src="https://api.scorecard.dev/projects/github.com/arthurpanhku/dvalincode/badge" alt="OpenSSF Scorecard"></a>
15
15
  <a href="#-quick-install"><img src="https://img.shields.io/badge/Platforms-macOS%20·%20Windows%20·%20Linux-blue?style=for-the-badge" alt="Platforms"></a>
@@ -64,7 +64,7 @@ finds something.
64
64
  Dvalin is the independent security runtime between code generation and merge.
65
65
  Humans, coding agents, and CI call the same versioned contract for discovery,
66
66
  remediation, and verification. It runs independently, or interoperates with
67
- specialist systems such as Codex Security through portable SARIF. Its built-in
67
+ specialist systems such as Codex Security through sealed scan artifacts or portable SARIF. Its built-in
68
68
  coding capability is a remediation executor — not the trust boundary, and not an
69
69
  attempt to compete with every general-purpose coding agent. See the
70
70
  [security-agent strategy](docs/SECURITY-AGENT-STRATEGY.md).
@@ -112,7 +112,7 @@ To gate every commit locally too, add the [pre-commit](https://pre-commit.com) h
112
112
  # .pre-commit-config.yaml
113
113
  repos:
114
114
  - repo: https://github.com/arthurpanhku/dvalincode
115
- rev: v0.22.0 # the hook ships in v0.22.0
115
+ rev: v0.23.0 # the hook ships in v0.22.0 and later
116
116
  hooks:
117
117
  - id: dvalin-scan # or dvalin-scan-installed, to use the CLI you installed
118
118
  ```
@@ -263,7 +263,7 @@ steps:
263
263
  - uses: actions/checkout@v5
264
264
  with:
265
265
  fetch-depth: 0 # so the scan can reach the base commit
266
- - uses: arthurpanhku/dvalincode@v0.21.0
266
+ - uses: arthurpanhku/dvalincode@v0.23.0
267
267
  with:
268
268
  fail-on: high
269
269
  diff: true # only report on what this PR changed
@@ -287,7 +287,7 @@ engines were missing is not the same answer as "no findings" from a complete one
287
287
  If your pipeline produced a fix record, hand it to the same action:
288
288
 
289
289
  ```yaml
290
- - uses: arthurpanhku/dvalincode@v0.21.0
290
+ - uses: arthurpanhku/dvalincode@v0.23.0
291
291
  with:
292
292
  fix-record: fix-record.json
293
293
  ```
@@ -331,7 +331,7 @@ A repair that regressed says so in the same place, and fails the job with it:
331
331
  with:
332
332
  fetch-depth: 0 # the base commit has to be reachable
333
333
  - run: npm ci # the project's checks run on the runner
334
- - uses: arthurpanhku/dvalincode@v0.22.0 # reverify ships in v0.22.0; until it is tagged, pin a main commit SHA
334
+ - uses: arthurpanhku/dvalincode@v0.23.0 # reverify needs v0.22.0 or later
335
335
  with:
336
336
  fix-record: fix-record.json
337
337
  reverify: true
@@ -382,15 +382,35 @@ claude mcp add dvalin -- npx -y dvalincode mcp-serve --workspace .
382
382
  One command configures the editor you actually use:
383
383
 
384
384
  ```sh
385
+ npx dvalincode mcp-install codex # ~/.codex/config.toml, via `codex mcp add`
385
386
  npx dvalincode mcp-install cursor # .cursor/mcp.json
386
387
  npx dvalincode mcp-install vscode # .vscode/mcp.json
387
388
  npx dvalincode mcp-install claude-code # .mcp.json
389
+ npx dvalincode mcp-install gemini # .gemini/settings.json
390
+ npx dvalincode mcp-install opencode # opencode.json
388
391
  ```
389
392
 
390
- The formats differ in a way that fails silently — VS Code keys its servers under
393
+ For Codex, Dvalin delegates to the official `codex mcp add` command, so it safely
394
+ updates TOML without hand-editing user configuration. The other formats differ
395
+ in a way that fails silently — VS Code keys its servers under
391
396
  `servers`, Cursor under `mcpServers` — so the command writes the right one and
392
397
  merges into whatever is already there. [Editors and MCP →](integrations/mcp/)
393
398
 
399
+ Or let Dvalin find them. `agents` lists the coding agents on this machine and
400
+ where Dvalin is already connected; `agents connect` plans the rest, and writes
401
+ nothing until you add `--yes`:
402
+
403
+ ```sh
404
+ npx dvalincode agents # which agents are here, and which have Dvalin
405
+ npx dvalincode agents connect # the plan: what each agent gets
406
+ npx dvalincode agents connect --yes # apply it
407
+ ```
408
+
409
+ If you manage MCP servers with [CC Switch](https://github.com/farion1231/cc-switch),
410
+ `agents connect cc-switch --yes` hands Dvalin to it instead. CC Switch shows the
411
+ import, asks first, then syncs Dvalin into Claude Code, Codex, Gemini CLI and
412
+ OpenCode.
413
+
394
414
  `dvalin_scan` accepts `diff: "uncommitted"`, which reports only on what the
395
415
  agent just wrote rather than everything the repository already carried — the
396
416
  difference between a usable answer and a wall of pre-existing findings. It never
@@ -418,10 +438,13 @@ handshake — which client, which version, and on what date is a table rather
418
438
  than a sentence, because hand-written version numbers go stale quietly.
419
439
  [Integration support ↓](#-integration-support) · [Agent integrations →](integrations/)
420
440
 
421
- The repository also contains one [dual Codex/Claude plugin payload](integrations/dvalin-security/)
422
- with both native manifests, the shared security-gate skill, and the local MCP
423
- server configuration. Installing it makes the gate discoverable from task
424
- context instead of requiring every developer to remember a scan prompt.
441
+ The repository also contains one [portable Codex/Claude plugin payload](integrations/dvalin-security/)
442
+ with the current root Agent Plugins manifest, compatibility manifests, the
443
+ shared security-gate skill, and a Claude-compatible MCP configuration. A repo-local
444
+ marketplace makes it discoverable in Codex desktop; installing it lets task
445
+ context trigger the gate instead of requiring every developer to remember a scan prompt.
446
+ For Codex, `mcp-install codex` separately binds the server to the active project;
447
+ the plugin does not risk scanning its own installed cache directory.
425
448
  Codex honors the scan's read-only MCP annotation. Claude Code requires one
426
449
  explicit MCP permission by design; the plugin documents the exact scan-only
427
450
  allow rule instead of asking users to bypass all permissions.
@@ -432,10 +455,13 @@ One server, reached the way each tool expects:
432
455
 
433
456
  | Harness | How Dvalin reaches it |
434
457
  |---|---|
435
- | **Claude Code** | [dual plugin](integrations/dvalin-security/) or `claude mcp add` · [standalone skill](integrations/claude-code/) |
436
- | **Codex** | [dual plugin](integrations/dvalin-security/) or `codex mcp add` · [SARIF interop](integrations/codex-security/) with Codex Security |
458
+ | **Claude Code** | [portable plugin](integrations/dvalin-security/) or `claude mcp add` · [standalone skill](integrations/claude-code/) |
459
+ | **Codex** | `dvalincode mcp-install codex` · [portable plugin](integrations/dvalin-security/) · [sealed scan + SARIF interop](integrations/codex-security/) with Codex Security |
437
460
  | **Cursor** | `dvalincode mcp-install cursor` |
438
461
  | **VS Code** | `dvalincode mcp-install vscode` · [extension](editors/vscode/) for Problems, coverage/gate status, and offline VFR verification — *built, not yet published* |
462
+ | **Gemini CLI** | `dvalincode mcp-install gemini` |
463
+ | **OpenCode** | `dvalincode mcp-install opencode` |
464
+ | **CC Switch** | `dvalin agents connect cc-switch` — one import, synced into each agent CC Switch manages |
439
465
  | **Windsurf · Zed** | stdio MCP through their own settings — [server command](integrations/mcp/) |
440
466
  | **Any MCP client** | [MCP registry](https://registry.modelcontextprotocol.io/): `io.github.arthurpanhku/dvalincode` |
441
467
  | **GitHub Actions** | [Marketplace action](https://github.com/marketplace/actions/dvalin-security-scan) — findings inline on the pull request diff |
@@ -443,31 +469,30 @@ One server, reached the way each tool expects:
443
469
  | **pre-commit** | [`dvalin-scan` hook](.pre-commit-hooks.yaml) — the same policy gate before every commit |
444
470
  | **Any CI** | `dvalin scan . --fail-on high`, SARIF out for code scanning |
445
471
 
446
- The MCP config formats are not interchangeable — VS Code keys its servers under
447
- `servers`, Cursor under `mcpServers`, and the wrong one fails silently — so
472
+ The MCP config formats are not interchangeable — Codex uses TOML through its own
473
+ CLI, VS Code keys its servers under
474
+ `servers`, Cursor under `mcpServers`, OpenCode under `mcp` with the command line
475
+ in one array, and the wrong one fails silently — so
448
476
  `mcp-install` writes the right shape and merges into whatever is already there.
449
477
  [Editors and MCP →](integrations/mcp/)
450
478
 
451
479
  ### Or interoperate with Codex Security
452
480
 
453
- [Codex Security](https://github.com/openai/codex-security) can export a completed,
454
- sealed scan as SARIF. Import that portable projection without coupling Dvalin to
455
- Codex Security's private state directory:
481
+ [Codex Security](https://github.com/openai/codex-security) writes completed,
482
+ sealed scans with a manifest, structured findings, and coverage. Import those
483
+ portable artifacts without coupling Dvalin to its private application state:
456
484
 
457
485
  ```sh
458
486
  DVALIN_CODEX_SCAN_DIR=/tmp/codex-security-results
459
487
  npx @openai/codex-security scan . --output-dir "$DVALIN_CODEX_SCAN_DIR"
460
- npx @openai/codex-security export "$DVALIN_CODEX_SCAN_DIR" \
461
- --export-format sarif --source-root "$PWD" --output /tmp/codex-security.sarif
462
-
463
- dvalin import /tmp/codex-security.sarif .
488
+ dvalin import "$DVALIN_CODEX_SCAN_DIR" .
464
489
  dvalin scan . --fail-on high
465
490
  ```
466
491
 
467
- The import creates stable Dvalin remediation cases; `--no-persist` validates the
468
- handoff without changing the backlog. Keep Codex Security's original manifest,
469
- findings, and coverage artifacts together—Dvalin imports the SARIF finding
470
- projection but does not rewrite its sealed bundle or reinterpret its coverage.
492
+ The import verifies manifest-recorded artifact hashes, creates stable Dvalin
493
+ remediation cases, and reports exclusions and deferred work as explicit
494
+ complete, partial, or unknown coverage. `--no-persist` validates the handoff
495
+ without changing the backlog. SARIF remains the findings-only fallback.
471
496
  [Integration guide →](integrations/codex-security/)
472
497
 
473
498
  ### Then let it fix what it found
@@ -542,9 +567,11 @@ answer does not change depending on who asks it.
542
567
 
543
568
  | Stage of the loop | Where you are | How Dvalin gets there | Status |
544
569
  |---|---|---|---|
545
- | **Writing the code** | Claude Code | [dual plugin](integrations/dvalin-security/) · `claude mcp add` · `mcp-install claude-code` | ✅ session verified |
546
- | | Codex | [dual plugin](integrations/dvalin-security/) · `codex mcp add` · [SARIF interop](integrations/codex-security/) | ✅ session verified · capture below |
570
+ | **Writing the code** | Claude Code | [portable plugin](integrations/dvalin-security/) · `claude mcp add` · `mcp-install claude-code` | ✅ session verified |
571
+ | | Codex | `mcp-install codex` · [portable plugin](integrations/dvalin-security/) · [sealed scan + SARIF interop](integrations/codex-security/) | ✅ session verified · capture below |
547
572
  | | Cursor | `dvalincode mcp-install cursor` | ⚙️ config verified |
573
+ | | Gemini CLI · OpenCode | `mcp-install gemini\|opencode` · `dvalin agents connect` | ⚙️ config verified |
574
+ | | CC Switch | `dvalin agents connect cc-switch` | ⚙️ link format tested, not yet imported |
548
575
  | | Windsurf · Zed | stdio MCP through their own settings | ⚙️ documented, unverified |
549
576
  | | Any MCP client | registry `io.github.arthurpanhku/dvalincode` | ⚙️ published |
550
577
  | **Reading it back** | VS Code | `mcp-install vscode` · [extension](editors/vscode/) for Problems, coverage and gate status | ✅ editor verified |
@@ -568,6 +595,8 @@ config file that loads is not evidence that a tool was ever called.
568
595
  | Codex | CLI 0.151.0 | 2026-08-31 | weekly `harness-interop` — the server spec is accepted and stored as stdio. **Not a handshake**: the tool-call step stays skipped until `CODEX_API_KEY` is set |
569
596
  | VS Code | 1.134.0 · extension 0.18.0 | 2026-09-03 | packaged VSIX in a clean profile; finding, gate and coverage rendered in the editor — capture below |
570
597
  | Cursor | — | 2026-09-04 | `mcp-install cursor` writes `.cursor/mcp.json` under `mcpServers`; no session has been captured |
598
+ | Gemini CLI · OpenCode | — | 2026-11-11 | `mcp-install` writes the shapes their own docs specify (Gemini: `mcpServers` in `settings.json`; OpenCode: the V1 `mcp` entry, which V2 still reads); no session has been captured |
599
+ | CC Switch | — | 2026-11-11 | the `ccswitch://` link follows CC Switch's deep-link guide and importer source; not yet opened in a running CC Switch |
571
600
 
572
601
  That weekly workflow exists because an earlier version of this claim named two
573
602
  CLI versions by hand, both went stale within weeks, and nothing said so. It now
@@ -713,6 +742,36 @@ not claim third-party ISO certification.
713
742
 
714
743
  ---
715
744
 
745
+ ## ⭐ What's New in v0.23.0 — connect Dvalin to the agents you already use
746
+
747
+ - **`dvalin agents` finds the coding agents on this machine** — Claude Code,
748
+ Codex, Cursor, VS Code, Gemini CLI and OpenCode, and where Dvalin is already
749
+ connected to each. It only looks: a command on `PATH`, the folder the agent
750
+ creates, or its macOS app. Nothing is run or written.
751
+ - **`dvalin agents connect` wires Dvalin in** — it plans the MCP entry for every
752
+ agent that lacks one and writes only with `--yes`, through the same writers as
753
+ `mcp-install`. That command now also covers Codex (through `codex mcp add`),
754
+ Gemini CLI and OpenCode. [Editors and MCP →](integrations/mcp/)
755
+ - **CC Switch support** — `dvalin agents connect cc-switch` hands Dvalin to
756
+ CC Switch through its own import link, and CC Switch syncs it into every agent
757
+ it manages. `provider set cc-switch` now points at CC Switch's local routing,
758
+ `127.0.0.1:15721`. It used to point at port 3456, which belongs to
759
+ claude-code-router.
760
+ - **Import Codex Security scans** — `dvalin import` reads a sealed Codex
761
+ Security scan directory, checking its manifest, hashes and coverage, or a
762
+ SARIF handoff, into remediation cases. A portable Codex security skill and a
763
+ repository-local plugin marketplace ship alongside.
764
+ [Codex Security interop →](integrations/codex-security/)
765
+ - **MCP clients learn the workflow when they connect** — at initialization the
766
+ server tells an agent to scan uncommitted changes, check coverage before
767
+ trusting zero findings, then inspect a finding and ask for independent
768
+ verification.
769
+ - **A failed turn keeps its work** — a turn that fails part-way now saves what it
770
+ finished, so its session can resume, and the audit log records its iterations
771
+ and tokens.
772
+
773
+ ---
774
+
716
775
  ## ⭐ What's New in v0.14.0 — Dvalin security engineering
717
776
 
718
777
  - **Home unifies Chat and Cowork** — the GUI now has a single Home workspace
@@ -975,7 +1034,7 @@ source ~/.zshrc # or ~/.bashrc
975
1034
  dvalincode # interactive terminal agent
976
1035
  dvalincode dvalin . # white-box security scan (GUI-independent)
977
1036
  dvalincode serve # start the web GUI, open the browser
978
- dvalincode serve --host 0.0.0.0 --no-open # host it on a server for remote/browser use
1037
+ dvalincode serve --host 0.0.0.0 --no-open # host it on a server; open the printed ?token= link
979
1038
  echo "inspect src and summarize" | dvalincode run - --output-format stream-json
980
1039
  dvalincode mcp-serve # task-level stdio MCP server for external agents
981
1040
  ```
@@ -1054,15 +1113,17 @@ restarts `DvalinCode.app`. A failed replacement rolls back to the previous app.
1054
1113
 
1055
1114
  ## 🎬 First-time setup
1056
1115
 
1057
- **Terminal (default):** run `dvalincode`. On first launch it walks you through a one-time provider setup (pick a provider, paste your API key, choose a model) and saves it to `~/.dvalincode/config.json`. Then you're at the prompt — type to chat, `/mode` to switch between Chat / Cowork / Code / Dvalin, `/help` for commands. In the GUI, Chat and Cowork are grouped under **Home**.
1116
+ **Terminal (default):** run `dvalincode`. On first launch it walks you through a one-time provider setup (pick a provider, paste your API key, choose a model) and saves it to `~/.dvalincode/config.json`. Then you're at the prompt — type to chat, `/mode` to switch between Chat / Cowork / Code / Dvalin, `/help` for commands. In the GUI, Chat and Cowork are the **Chat** workspace, as Ask and Collaborate in the composer's mode menu.
1058
1117
 
1059
1118
  **Web GUI:** run `dvalincode serve` and:
1060
1119
 
1061
- 1. The server starts on `http://localhost:3000` and your browser opens automatically.
1062
- 2. Click **LLM Configuration** in the sidebar (bottom-left).
1120
+ 1. The server starts on `http://localhost:3000` and opens your browser at the link it prints.
1121
+ 2. Open **Settings** (bottom of the sidebar) → **LLM Providers** → **Configure**.
1063
1122
  3. Pick a provider, paste your API key, choose a model, hit **Save**.
1064
1123
  4. Optional: save the current config as a named profile (e.g. `fast`, `cheap`, `local-ollama`) to switch quickly later.
1065
1124
 
1125
+ **Access token:** the server drives an agent that edits files and runs commands, so it refuses `/api` and `/ws` without its access token. A fresh token is minted on every start and printed in the launch link (`http://localhost:3000/?token=…`); the page trades it for an HttpOnly cookie. Keep the link private. A browser without it shows an unlock screen where you can paste the link or the token; scripts send `Authorization: Bearer <token>`. Set `DVALINCODE_SERVER_TOKEN` (16+ characters of `A–Z a–z 0–9 - _`) to keep one token across restarts. The desktop app handles its token on its own. To use the GUI from another machine (`--host 0.0.0.0`), also set `DVALINCODE_ALLOWED_ORIGINS` to the URL you open it at.
1126
+
1066
1127
  Both share the same config and sessions in `~/.dvalincode/`.
1067
1128
 
1068
1129
  ---
@@ -1076,6 +1137,7 @@ Both share the same config and sessions in `~/.dvalincode/`.
1076
1137
  | **Workspaces** | Open folder / Import Git / Add worktree | Cowork and Code can switch to a local folder, clone a Git project, or create a Git worktree from the UI |
1077
1138
  | **Governance** | OpenSSF Scorecard / ISO 42001 AIMS alignment | Scorecard, CodeQL, Dependabot, pinned Actions, AI impact assessment, risk register, and review cadence are documented under `docs/security/` and `docs/governance/` |
1078
1139
  | **Secure remediation** | Built-in + Semgrep CE + Trivy + OSV-Scanner / SARIF / cases / worktrees / tests / draft PR | Dvalin detects installed engines, normalizes SARIF, scores risk, persists cases, drives evidence-backed fixes, verifies changes, and publishes only after an explicit user action |
1140
+ | **Agent integrations** | `dvalin agents` / MCP server | Finds Claude Code, Codex, Cursor, VS Code, Gemini CLI and OpenCode on this machine and wires Dvalin's MCP server into each, writing only with `--yes`; or hands it to CC Switch. [Editors and MCP →](integrations/mcp/) |
1079
1141
  | **Skills** | Upload / download / built-in security skills | Skills live under `~/.dvalincode/skills`; built-ins guide security scanning and remediation with dedicated agent tools. [Format →](docs/SKILLS.md) |
1080
1142
  | **Composer** | `@` file references | Type `@` for a fuzzy file search; selected files get inlined into the prompt |
1081
1143
  | | `/` slash commands | `/clear` `/compact` `/git` `/plan` `/undo` `/help` |
@@ -1086,8 +1148,11 @@ Both share the same config and sessions in `~/.dvalincode/`.
1086
1148
  | **Agent** | LLM-based context compaction | `/compact` summarises into Goal / Completed / Decisions / Pending |
1087
1149
  | | Persistent undo stack | `/undo [N]` reverses the last N tool calls |
1088
1150
  | | Run Report | Markdown summary per run (files, commands, decisions, test result) — GUI card + `dvalincode report` |
1089
- | | Git awareness | Branch name in topbar; `git_status` tool; git context auto-injected into prompt |
1151
+ | | Git awareness | Branch name in topbar; git context auto-injected into prompt; read-only `git_status`, `git_diff`, `git_log`, `git_show` and `git_blame` tools, also in Ask and Plan |
1152
+ | | Code search and edits | `search_text` takes regular expressions, shows context lines, and skips `.gitignore`d paths; `edit_file` makes several edits or a replace-all in one call; `read_file` reads line ranges of files over 256 KB |
1153
+ | | Task checklist | `update_plan` keeps a step checklist that the desktop app shows as a card; in Code mode the agent is sent back if it stops with steps still open |
1090
1154
  | | `AGENTS.md` project memory | Per-repo persistent instructions, auto-loaded each turn |
1155
+ | | Web search + fetch | `web_search` uses a Tavily or Brave Search key (Settings → LLM Providers → Web search, or `TAVILY_API_KEY` / `BRAVE_API_KEY`); `web_fetch` needs no key and reads public pages as text, asking once per site per turn. Both obey the policy `network` level and are audited by origin only |
1091
1156
  | **Security** | Tamper-evident audit trail | Hash-chained JSONL per run in `~/.dvalincode/audit/`; `dvalincode report verify` detects edits |
1092
1157
  | | macOS shell sandbox | `sandbox-exec` denies network; allows writes only inside cwd + `/tmp` |
1093
1158
  | | `.dvalincodeignore` | gitignore-style exclusion; blocks `read_file` / `list_files` / `search_text` |
@@ -1146,6 +1211,8 @@ Both share the same config and sessions in `~/.dvalincode/`.
1146
1211
  │ + audit taps: tool_call · file_* · shell_exec │
1147
1212
  │ read_file · list_files · search_text · git_status · │
1148
1213
  │ write_file · edit_file · delete_file · shell │
1214
+ │ web_search · web_fetch │
1215
+ │ git_log · git_show · git_blame · update_plan │
1149
1216
  └─────────────────────────────────────────────────────────┘
1150
1217
  ```
1151
1218
 
@@ -1172,7 +1239,7 @@ RESTORE → COMPACT → COMMAND → BUILD → RUN → SAVE → RESPOND → DONE
1172
1239
  npm test
1173
1240
  ```
1174
1241
 
1175
- **584 core tests · 74 files · all green.** The VS Code extension has a separate
1242
+ **819 core tests · 95 files · all green.** The VS Code extension has a separate
1176
1243
  37-test suite plus one opt-in published-package integration test.
1177
1244
 
1178
1245
  ---
@@ -1222,6 +1289,7 @@ DvalinCode supports any OpenAI-compatible endpoint. Built-in presets, sorted by
1222
1289
  | **OpenRouter** | `google/gemini-2.0-flash-001` | $0.10 / $0.40 per 1M | 200+ models including Claude, Gemini, Llama |
1223
1290
  | **OpenAI** | `gpt-4o-mini` | $0.15 / $0.60 per 1M | Reliable; `o1` available for deep reasoning |
1224
1291
  | **Custom** | — | depends | Any OpenAI-compatible base URL |
1292
+ | **CC Switch** | — | depends | `provider set cc-switch`: requests go through CC Switch's local routing (`127.0.0.1:15721`) to whichever provider its Codex app uses; CC Switch holds the key |
1225
1293
 
1226
1294
  DvalinCode shows the per-session cost live in the topbar — flip between providers in the **LLM Configuration** modal, save named profiles, and compare on the fly.
1227
1295
 
@@ -1294,7 +1362,7 @@ Contributions welcome. The codebase is intentionally small and surgical — see
1294
1362
  ```sh
1295
1363
  git clone https://github.com/arthurpanhku/dvalincode
1296
1364
  cd dvalincode && npm install
1297
- npm test # 584/584 core tests ✅
1365
+ npm test # 819/819 core tests ✅
1298
1366
  npm run typecheck
1299
1367
  ```
1300
1368
 
package/README.zh-CN.md CHANGED
@@ -9,7 +9,7 @@
9
9
  <p align="center">
10
10
  <a href="https://github.com/arthurpanhku/dvalincode/releases/latest"><img src="https://img.shields.io/github/v/release/arthurpanhku/dvalincode?style=for-the-badge&color=818cf8&label=Release" alt="Release"></a>
11
11
  <a href="https://github.com/arthurpanhku/dvalincode/releases"><img src="https://img.shields.io/github/downloads/arthurpanhku/dvalincode/total?style=for-the-badge&color=blue&label=Downloads" alt="Downloads"></a>
12
- <a href="#-测试"><img src="https://img.shields.io/badge/Tests-584%20%2F%20584%20%E2%9C%93-success?style=for-the-badge" alt="Tests"></a>
12
+ <a href="#-测试"><img src="https://img.shields.io/badge/Tests-819%20%2F%20819%20%E2%9C%93-success?style=for-the-badge" alt="Tests"></a>
13
13
  <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-green?style=for-the-badge" alt="License"></a>
14
14
  <a href="https://scorecard.dev/viewer/?uri=github.com/arthurpanhku/dvalincode"><img src="https://api.scorecard.dev/projects/github.com/arthurpanhku/dvalincode/badge" alt="OpenSSF Scorecard"></a>
15
15
  <a href="#-一行安装"><img src="https://img.shields.io/badge/Platforms-macOS%20·%20Windows%20·%20Linux-blue?style=for-the-badge" alt="Platforms"></a>
@@ -57,7 +57,7 @@ Fix record 2c9d71ac03e0 · VERIFIED · scan-and-checks
57
57
 
58
58
  Dvalin 是放在“代码生成”和“允许合并”之间的独立安全运行时。人类开发者、Coding
59
59
  Agent 和 CI 调用同一套版本化协议完成发现、修复与验证。它既可以独立运行,也可以通过
60
- 可移植的 SARIF 与 Codex Security 等专业系统互操作。内置 Coding 能力只负责可靠地执行
60
+ 密封扫描工件或可移植 SARIF 与 Codex Security 等专业系统互操作。内置 Coding 能力只负责可靠地执行
61
61
  聚焦修复,不是安全结论的信任边界,也不以打败所有通用 Coding Agent 为目标。
62
62
  详见[安全 Agent 战略](docs/SECURITY-AGENT-STRATEGY.md)。
63
63
 
@@ -99,7 +99,7 @@ finding 记录为可接受的存量(`.dvalin/baseline.json`),并为 GitHub
99
99
  # .pre-commit-config.yaml
100
100
  repos:
101
101
  - repo: https://github.com/arthurpanhku/dvalincode
102
- rev: v0.22.0 # hook 随 v0.22.0 发布
102
+ rev: v0.23.0 # hook 自 v0.22.0 起提供
103
103
  hooks:
104
104
  - id: dvalin-scan # PATH 上已有 dvalin 时用 dvalin-scan-installed
105
105
  ```
@@ -213,7 +213,7 @@ steps:
213
213
  - uses: actions/checkout@v5
214
214
  with:
215
215
  fetch-depth: 0 # 让扫描能取到 base commit
216
- - uses: arthurpanhku/dvalincode@v0.21.0
216
+ - uses: arthurpanhku/dvalincode@v0.23.0
217
217
  with:
218
218
  fail-on: high
219
219
  diff: true # 只报告这个 PR 改动的部分
@@ -236,7 +236,7 @@ steps:
236
236
  如果你的流水线产出了 fix record,把它交给同一个 action:
237
237
 
238
238
  ```yaml
239
- - uses: arthurpanhku/dvalincode@v0.21.0
239
+ - uses: arthurpanhku/dvalincode@v0.23.0
240
240
  with:
241
241
  fix-record: fix-record.json
242
242
  ```
@@ -276,7 +276,7 @@ runner 会仅凭这个文件本身重新推导它 —— 重算哈希,并从
276
276
  with:
277
277
  fetch-depth: 0 # 需要能拿到 base commit
278
278
  - run: npm ci # 项目自己的检查会在 runner 上执行
279
- - uses: arthurpanhku/dvalincode@v0.22.0 # reverify 随 v0.22.0 发布;打 tag 之前请固定到 main 的某个 commit SHA
279
+ - uses: arthurpanhku/dvalincode@v0.23.0 # reverify 需要 v0.22.0 或更高版本
280
280
  with:
281
281
  fix-record: fix-record.json
282
282
  reverify: true
@@ -320,15 +320,32 @@ claude mcp add dvalin -- npx -y dvalincode mcp-serve --workspace .
320
320
  一条命令配好你实际在用的编辑器:
321
321
 
322
322
  ```sh
323
+ npx dvalincode mcp-install codex # 通过 `codex mcp add` 更新 ~/.codex/config.toml
323
324
  npx dvalincode mcp-install cursor # .cursor/mcp.json
324
325
  npx dvalincode mcp-install vscode # .vscode/mcp.json
325
326
  npx dvalincode mcp-install claude-code # .mcp.json
327
+ npx dvalincode mcp-install gemini # .gemini/settings.json
328
+ npx dvalincode mcp-install opencode # opencode.json
326
329
  ```
327
330
 
328
- 这几家的格式不一样,而且写错不会报错——VS Code 的 key 是 `servers`,Cursor 是
331
+ 对于 Codex,Dvalin 会委托官方 `codex mcp add` 命令安全更新 TOML,无需手改用户配置。
332
+ 其他客户端的格式也不一样,而且写错不会报错——VS Code 的 key 是 `servers`,Cursor 是
329
333
  `mcpServers`,填反了编辑器会照单全收然后当没看见。这条命令会写对,并且合并进已有
330
334
  配置而不是覆盖。[编辑器与 MCP →](integrations/mcp/)
331
335
 
336
+ 也可以让 Dvalin 自己去找。`agents` 列出这台机器上装了哪些 coding agent,以及哪些已经
337
+ 接入 Dvalin;`agents connect` 给剩下的列出接入计划,不加 `--yes` 就什么都不写:
338
+
339
+ ```sh
340
+ npx dvalincode agents # 装了哪些 agent,哪些已经接入 Dvalin
341
+ npx dvalincode agents connect # 接入计划:每个 agent 会写什么
342
+ npx dvalincode agents connect --yes # 执行
343
+ ```
344
+
345
+ 如果你用 [CC Switch](https://github.com/farion1231/cc-switch) 管理 MCP server,
346
+ `agents connect cc-switch --yes` 会把 Dvalin 交给它:CC Switch 先展示导入内容、征得你
347
+ 确认,再把 Dvalin 同步进 Claude Code、Codex、Gemini CLI 和 OpenCode。
348
+
332
349
  `dvalin_scan` 支持 `diff: "uncommitted"`,只报告 agent 刚写的部分,而不是仓库里的全部存量问题。它不跑模型、不修改目标 workspace、也不持久化 Dvalin 状态,因此客户端可以默认允许这次预览。确认要修复某条发现后,Agent 再显式调用
333
350
  `dvalin_begin_verification` 创建精简的本地安全 workflow,用 fingerprint 精确读取单条发现,再通过 `dvalin_get_finding` 和
334
351
  `dvalin_verify_findings` 请求独立复扫。响应包含 MCP `structuredContent`,并可通过
@@ -339,9 +356,11 @@ npx dvalincode mcp-install claude-code # .mcp.json
339
356
  哪个版本、哪一天验的,写成了表格而不是一句话,因为手写的版本号会悄无声息地过期。
340
357
  [集成支持 ↓](#-集成支持) · [Agent 集成 →](integrations/)
341
358
 
342
- 仓库还提供一份 [Codex/Claude 双兼容插件](integrations/dvalin-security/):同时包含两套
343
- 原生 manifest、共享安全门禁 skill 和本地 MCP server 配置。安装后,agent 可根据任务
344
- 上下文自动发现门禁,不再依赖每位开发者记住扫描提示词。
359
+ 仓库还提供一份 [Codex/Claude 可移植插件](integrations/dvalin-security/):包含当前根目录
360
+ Agent Plugins manifest、兼容 manifest、共享安全门禁 skill 和 Claude 兼容 MCP 配置。
361
+ 仓库内 marketplace 让 Codex desktop 可以直接发现它;安装后,agent 可根据任务
362
+ 上下文自动发现门禁,不再依赖每位开发者记住扫描提示词。Codex 的 MCP server 由
363
+ `mcp-install codex` 单独绑定到当前项目,避免插件进程误扫自身的安装缓存目录。
345
364
  Codex 会采纳扫描工具的只读 MCP 标注;Claude Code 按其安全设计仍需显式授权一次。
346
365
  插件给出精确到只读扫描工具的 allow 规则,不要求用户绕过所有权限。
347
366
 
@@ -351,10 +370,13 @@ Codex 会采纳扫描工具的只读 MCP 标注;Claude Code 按其安全设计
351
370
 
352
371
  | Harness | 怎么接 |
353
372
  |---|---|
354
- | **Claude Code** | [双兼容插件](integrations/dvalin-security/),或 `claude mcp add` · [独立 skill](integrations/claude-code/) |
355
- | **Codex** | [双兼容插件](integrations/dvalin-security/),或 `codex mcp add` · 与 Codex Security 的 [SARIF 互操作](integrations/codex-security/) |
373
+ | **Claude Code** | [可移植插件](integrations/dvalin-security/),或 `claude mcp add` · [独立 skill](integrations/claude-code/) |
374
+ | **Codex** | `dvalincode mcp-install codex` · [可移植插件](integrations/dvalin-security/) · 与 Codex Security 的 [密封扫描 + SARIF 互操作](integrations/codex-security/) |
356
375
  | **Cursor** | `dvalincode mcp-install cursor` |
357
376
  | **VS Code** | `dvalincode mcp-install vscode` · 在 Problems、coverage/gate 状态和离线 VFR 校验中展示结果的[扩展](editors/vscode/) —— *已构建,尚未发布* |
377
+ | **Gemini CLI** | `dvalincode mcp-install gemini` |
378
+ | **OpenCode** | `dvalincode mcp-install opencode` |
379
+ | **CC Switch** | `dvalin agents connect cc-switch` —— 导入一次,同步进 CC Switch 管理的每个 agent |
358
380
  | **Windsurf · Zed** | 在各自设置里配 stdio MCP —— [server 命令](integrations/mcp/) |
359
381
  | **任意 MCP 客户端** | [MCP registry](https://registry.modelcontextprotocol.io/):`io.github.arthurpanhku/dvalincode` |
360
382
  | **GitHub Actions** | [Marketplace action](https://github.com/marketplace/actions/dvalin-security-scan) —— 结果直接标在 PR diff 上 |
@@ -362,28 +384,26 @@ Codex 会采纳扫描工具的只读 MCP 标注;Claude Code 按其安全设计
362
384
  | **pre-commit** | [`dvalin-scan` hook](.pre-commit-hooks.yaml) —— 每次提交前跑同一套策略门禁 |
363
385
  | **任意 CI** | `dvalin scan . --fail-on high`,输出 SARIF 供 code scanning 用 |
364
386
 
365
- 各家的 MCP 配置格式并不通用——VS Code 的 key 是 `servers`,Cursor 是 `mcpServers`,
387
+ 各家的 MCP 配置格式并不通用——Codex 通过自己的 CLI 管理 TOML,VS Code 的 key 是
388
+ `servers`,Cursor 是 `mcpServers`,OpenCode 是 `mcp` 且整条命令写在一个数组里,
366
389
  填错了不会报错只会静默失效——所以 `mcp-install` 会写对格式,并合并进已有配置。
367
390
  [编辑器与 MCP →](integrations/mcp/)
368
391
 
369
392
  ### 或者和 Codex Security 互操作
370
393
 
371
- [Codex Security](https://github.com/openai/codex-security) 可以把已完成且密封的扫描
372
- 导出为 SARIF。Dvalin 只导入这个可移植投影,不耦合 Codex Security 的私有状态目录:
394
+ [Codex Security](https://github.com/openai/codex-security) 会为已完成扫描保存 manifest、
395
+ 结构化 findings 与 coverage。Dvalin 只读取这些可移植工件,不耦合其私有应用状态:
373
396
 
374
397
  ```sh
375
398
  DVALIN_CODEX_SCAN_DIR=/tmp/codex-security-results
376
399
  npx @openai/codex-security scan . --output-dir "$DVALIN_CODEX_SCAN_DIR"
377
- npx @openai/codex-security export "$DVALIN_CODEX_SCAN_DIR" \
378
- --export-format sarif --source-root "$PWD" --output /tmp/codex-security.sarif
379
-
380
- dvalin import /tmp/codex-security.sarif .
400
+ dvalin import "$DVALIN_CODEX_SCAN_DIR" .
381
401
  dvalin scan . --fail-on high
382
402
  ```
383
403
 
384
- 导入会生成稳定的 Dvalin remediation case;`--no-persist` 可以只校验交接件而不修改
385
- backlog。请继续保存 Codex Security 原始的 manifest、findings 和 coverage 工件——Dvalin
386
- 只导入 SARIF finding 投影,不会改写其密封 bundle,也不会重新解释其覆盖率。
404
+ 导入会校验 manifest 记录的工件哈希、生成稳定的 remediation case,并把排除项和延期
405
+ 工作明确报告为 complete、partial 或 unknown coverage;`--no-persist` 可以只校验交接件
406
+ 而不修改 backlog。SARIF 继续作为只包含 findings 的兼容路径。
387
407
  [集成指南 →](integrations/codex-security/)
388
408
 
389
409
  ### 然后让它把找到的问题修掉
@@ -449,9 +469,11 @@ Dvalin 在这四处背后是同一个 MCP server、同一次确定性扫描 —
449
469
 
450
470
  | 开发环节 | 你在哪儿 | Dvalin 怎么接进去 | 状态 |
451
471
  |---|---|---|---|
452
- | **写代码** | Claude Code | [双兼容插件](integrations/dvalin-security/) · `claude mcp add` · `mcp-install claude-code` | ✅ 会话已验证 |
453
- | | Codex | [双兼容插件](integrations/dvalin-security/) · `codex mcp add` · [SARIF 互操作](integrations/codex-security/) | ✅ 会话已验证 · 见下方截图 |
472
+ | **写代码** | Claude Code | [可移植插件](integrations/dvalin-security/) · `claude mcp add` · `mcp-install claude-code` | ✅ 会话已验证 |
473
+ | | Codex | `mcp-install codex` · [可移植插件](integrations/dvalin-security/) · [密封扫描 + SARIF 互操作](integrations/codex-security/) | ✅ 会话已验证 · 见下方截图 |
454
474
  | | Cursor | `dvalincode mcp-install cursor` | ⚙️ 配置已验证 |
475
+ | | Gemini CLI · OpenCode | `mcp-install gemini\|opencode` · `dvalin agents connect` | ⚙️ 配置已验证 |
476
+ | | CC Switch | `dvalin agents connect cc-switch` | ⚙️ 链接格式已测试,尚未实际导入 |
455
477
  | | Windsurf · Zed | 通过它们自己的设置接 stdio MCP | ⚙️ 已文档化,未验证 |
456
478
  | | 任意 MCP 客户端 | registry `io.github.arthurpanhku/dvalincode` | ⚙️ 已发布 |
457
479
  | **回头读代码** | VS Code | `mcp-install vscode` · [扩展](editors/vscode/):Problems、覆盖度与门禁状态 | ✅ 编辑器内已验证 |
@@ -474,6 +496,8 @@ Dvalin 在这四处背后是同一个 MCP server、同一次确定性扫描 —
474
496
  | Codex | CLI 0.151.0 | 2026-08-31 | 每周的 `harness-interop`:server 配置被接受并按 stdio 存下。**这不是握手** —— 在设置 `CODEX_API_KEY` 之前,调用工具那一步一直是 skipped |
475
497
  | VS Code | 1.134.0 · 扩展 0.18.0 | 2026-09-03 | 干净 profile 里安装打包好的 VSIX;finding、门禁和覆盖度都出现在编辑器里 —— 见下方截图 |
476
498
  | Cursor | — | 2026-09-04 | `mcp-install cursor` 会把 `.cursor/mcp.json` 写成 `mcpServers` 结构;但还没有抓到会话记录 |
499
+ | Gemini CLI · OpenCode | — | 2026-11-11 | `mcp-install` 按它们自己文档规定的结构写入(Gemini:`settings.json` 里的 `mcpServers`;OpenCode:V1 的 `mcp` 条目,V2 仍然读取);还没有抓到会话记录 |
500
+ | CC Switch | — | 2026-11-11 | `ccswitch://` 链接按 CC Switch 的 deep link 指南和导入器源码生成;还没有在运行中的 CC Switch 里实际打开过 |
477
501
 
478
502
  那个每周任务之所以存在,是因为这段话的早期版本手写了两个 CLI 版本号,两个都在几周内
479
503
  过期,而没有任何东西提醒过。现在它每周对着这些工具的当周版本重跑一次 —— 上面这些日期
@@ -601,6 +625,29 @@ DvalinCode 维护项目级治理证据,便于开源用户和企业安全评审
601
625
 
602
626
  ---
603
627
 
628
+ ## ⭐ v0.23.0 新功能 —— 把 Dvalin 接进你已经在用的 agent
629
+
630
+ - **`dvalin agents` 找出本机的 coding agent** —— Claude Code、Codex、Cursor、
631
+ VS Code、Gemini CLI 和 OpenCode,以及 Dvalin 已经接在了哪里。它只看不动:看
632
+ `PATH` 上的命令、agent 创建的目录或 macOS 应用,不运行也不写入任何东西。
633
+ - **`dvalin agents connect` 一键接入** —— 为还没有 Dvalin 的 agent 列出 MCP 接入
634
+ 计划,加 `--yes` 才写入,写入逻辑和 `mcp-install` 相同。`mcp-install` 现在也支持
635
+ Codex(通过 `codex mcp add`)、Gemini CLI 和 OpenCode。[编辑器与 MCP →](integrations/mcp/)
636
+ - **支持 CC Switch** —— `dvalin agents connect cc-switch` 通过 CC Switch 自己的导入
637
+ 链接把 Dvalin 交给它,再由它同步进所管理的每个 agent。`provider set cc-switch`
638
+ 现在指向 CC Switch 的本地路由 `127.0.0.1:15721`;原来的 3456 其实是
639
+ claude-code-router 的端口。
640
+ - **导入 Codex Security 扫描结果** —— `dvalin import` 读取密封的 Codex Security
641
+ 扫描目录(校验 manifest、哈希和覆盖范围)或 SARIF 交接文件,转成 remediation
642
+ case;同时提供可移植的 Codex 安全 skill 和仓库内插件 marketplace。
643
+ [Codex Security 互操作 →](integrations/codex-security/)
644
+ - **MCP 客户端一连上就知道流程** —— server 在初始化时告诉 agent:先扫描未提交的
645
+ 改动,把零发现当作干净之前先确认覆盖范围,再查看单条发现并请求独立验证。
646
+ - **失败的回合不再丢工作** —— 中途失败的回合会保存已完成的部分,会话可以接着
647
+ 继续;审计日志也会记录它的迭代次数和 token。
648
+
649
+ ---
650
+
604
651
  ## ⭐ v0.14.0 新功能 —— Dvalin 安全工程
605
652
 
606
653
  - **Home 合并 Chat 与 Cowork** —— Home 统一提供只读 Ask 与审批式 Collaborate,
@@ -820,7 +867,7 @@ dvalincode # 交互式终端代理
820
867
  dvalincode dvalin . # 白盒安全扫描
821
868
  dvalincode dvalin . --fix --verify --draft-pr # 隔离修复、验证并创建草稿 PR
822
869
  dvalincode serve # 启动 Web GUI 并打开浏览器
823
- dvalincode serve --host 0.0.0.0 --no-open # 部署到服务器,供远程/浏览器访问
870
+ dvalincode serve --host 0.0.0.0 --no-open # 部署到服务器;打开打印出的 ?token= 链接
824
871
  echo "检查 src 并总结" | dvalincode run - --output-format stream-json
825
872
  dvalincode mcp-serve # 供外部 Agent 调用的任务级 stdio MCP 服务
826
873
  ```
@@ -889,11 +936,13 @@ dvalincode update # 下载、校验并安装最新版本
889
936
 
890
937
  **Web GUI:** 运行 `dvalincode serve`:
891
938
 
892
- 1. 服务在 `http://localhost:3000` 启动,浏览器自动打开。
893
- 2. 点击侧边栏底部的 **LLM Configuration**。
939
+ 1. 服务在 `http://localhost:3000` 启动,并用它打印出的链接自动打开浏览器。
940
+ 2. 打开侧边栏底部的 **Settings** → **LLM Providers** → **Configure**。
894
941
  3. 选择 Provider、粘贴 API Key、选择模型、保存。
895
942
  4. 可选:将当前配置保存为命名 Profile(如 `fast`、`cheap`、`local-ollama`),日后一键切换。
896
943
 
944
+ **访问令牌:** 服务端驱动的 Agent 能改文件、跑命令,所以没有访问令牌的 `/api` 和 `/ws` 请求一律拒绝。每次启动都会生成新令牌,放在打印出的启动链接里(`http://localhost:3000/?token=…`),页面会把它换成 HttpOnly cookie。这个链接请勿外传。没有令牌的浏览器会看到解锁页,可以粘贴链接或令牌;脚本用 `Authorization: Bearer <token>`。设置 `DVALINCODE_SERVER_TOKEN`(至少 16 个字符,仅限 `A–Z a–z 0–9 - _`)可在重启后沿用同一令牌。桌面应用会自动处理令牌。若要从另一台机器使用 GUI(`--host 0.0.0.0`),还需把 `DVALINCODE_ALLOWED_ORIGINS` 设为你在浏览器中打开的地址。
945
+
897
946
  两种方式共享 `~/.dvalincode/` 下的同一份配置与 Session。
898
947
 
899
948
  ---
@@ -907,6 +956,7 @@ dvalincode update # 下载、校验并安装最新版本
907
956
  | **工作区** | 打开文件夹 / 导入 Git / 添加 worktree | Home、Code 与 Dvalin 可使用本地文件夹、Git 项目和隔离 remediation worktree |
908
957
  | **治理** | OpenSSF Scorecard / ISO 42001 AIMS 对齐 | Scorecard、CodeQL、Dependabot、固定 SHA 的 Actions、AI 影响评估、风险登记和审查节奏记录在 `docs/security/` 与 `docs/governance/` |
909
958
  | **安全修复** | 内置 + Semgrep CE + Trivy + OSV-Scanner / SARIF / 测试 / Draft PR | Dvalin 检测已安装引擎、统一 SARIF、风险评分、驱动证据化修复、验证变更,并只在用户显式操作后发布 Draft PR |
959
+ | **Agent 集成** | `dvalin agents` / MCP server | 找出这台机器上的 Claude Code、Codex、Cursor、VS Code、Gemini CLI 和 OpenCode,把 Dvalin 的 MCP server 接进每一个,加 `--yes` 才写入;也可以交给 CC Switch 同步。[编辑器与 MCP →](integrations/mcp/) |
910
960
  | **Skills** | 上传 / 下载 / 内置安全 skills | Skills 保存在 `~/.dvalincode/skills`;内置 skills 用专门的 agent tools 引导安全扫描与修复。[格式 →](docs/SKILLS.md) |
911
961
  | **输入框** | `@` 文件引用 | 输入 `@` 触发模糊文件搜索,选中文件自动插入到 prompt |
912
962
  | | `/` 斜杠命令 | `/clear` `/compact` `/git` `/plan` `/undo` `/help` |
@@ -917,8 +967,11 @@ dvalincode update # 下载、校验并安装最新版本
917
967
  | **Agent** | LLM 上下文压缩 | `/compact` 将历史压缩为 目标/已完成/决策/待办 结构化摘要 |
918
968
  | | 持久化 Undo 栈 | `/undo [N]` 撤销最近 N 个工具调用 |
919
969
  | | Run Report | 每次运行的 Markdown 摘要(文件、命令、决策、测试结果)—— GUI 卡片 + `dvalincode report` |
920
- | | Git 感知 | 顶栏显示分支名;`git_status` 工具;Git 上下文自动注入 prompt |
970
+ | | Git 感知 | 顶栏显示分支名;Git 上下文自动注入 prompt;只读的 `git_status`、`git_diff`、`git_log`、`git_show`、`git_blame` 工具,在 Ask 和 Plan 中同样可用 |
971
+ | | 代码搜索与编辑 | `search_text` 支持正则表达式、显示上下文行,并跳过 `.gitignore` 忽略的路径;`edit_file` 一次调用即可完成多处编辑或全部替换;`read_file` 可按行范围读取超过 256 KB 的文件 |
972
+ | | 任务清单 | `update_plan` 维护一份步骤清单,桌面应用以卡片形式展示;在 Code 模式下,若 Agent 在仍有未完成步骤时停下,会被要求继续 |
921
973
  | | `AGENTS.md` 项目记忆 | 每个仓库的持久指令,每轮对话自动加载 |
974
+ | | 联网搜索 + 网页读取 | `web_search` 使用 Tavily 或 Brave Search 密钥(设置 → LLM Providers → Web search,或 `TAVILY_API_KEY` / `BRAVE_API_KEY`);`web_fetch` 无需密钥,把公开网页读取为文本,每轮首次访问某个站点时请求批准。两者都遵守策略的 `network` 级别,审计只记录来源(origin) |
922
975
  | **安全** | 防篡改审计日志 | 每次运行在 `~/.dvalincode/audit/` 生成哈希链 JSONL;`dvalincode report verify` 可检测修改 |
923
976
  | | macOS Shell 沙箱 | `sandbox-exec` 拒绝网络;写入仅限 cwd 与 `/tmp` |
924
977
  | | `.dvalincodeignore` | 类 gitignore 排除;阻止 `read_file` / `list_files` / `search_text` |
@@ -979,6 +1032,8 @@ dvalincode update # 下载、校验并安装最新版本
979
1032
  │ + 审计埋点:tool_call · file_* · shell_exec │
980
1033
  │ read_file · list_files · search_text · git_status · │
981
1034
  │ write_file · edit_file · delete_file · shell │
1035
+ │ web_search · web_fetch │
1036
+ │ git_log · git_show · git_blame · update_plan │
982
1037
  └─────────────────────────────────────────────────────────┘
983
1038
  ```
984
1039
 
@@ -1005,7 +1060,7 @@ RESTORE → COMPACT → COMMAND → BUILD → RUN → SAVE → RESPOND → DONE
1005
1060
  npm test
1006
1061
  ```
1007
1062
 
1008
- **584 个核心测试 · 74 个文件 · 全部通过。** VS Code 扩展另有 37 个测试,
1063
+ **819 个核心测试 · 95 个文件 · 全部通过。** VS Code 扩展另有 37 个测试,
1009
1064
  以及一个可选的已发布包集成测试。
1010
1065
 
1011
1066
  ---
@@ -1055,6 +1110,7 @@ DvalinCode 支持任意 OpenAI 兼容端点。内置预设,按价格排序:
1055
1110
  | **OpenRouter** | `google/gemini-2.0-flash-001` | $0.10 / $0.40 每 1M | 200+ 模型,包括 Claude、Gemini、Llama |
1056
1111
  | **OpenAI** | `gpt-4o-mini` | $0.15 / $0.60 每 1M | 可靠;`o1` 用于深度推理 |
1057
1112
  | **Custom** | — | 取决于服务方 | 任意 OpenAI 兼容 base URL |
1113
+ | **CC Switch** | — | 取决于服务方 | `provider set cc-switch`:请求经 CC Switch 的本地路由(`127.0.0.1:15721`)转给它的 Codex 当前使用的服务商;key 由 CC Switch 保管 |
1058
1114
 
1059
1115
  DvalinCode 顶栏实时显示本 session 的费用 —— 在 **LLM Configuration** 中切换 Provider、保存命名 Profile、实时比较。
1060
1116
 
@@ -1133,7 +1189,7 @@ Linux 与 macOS 命令通过 <code>/bin/sh</code> 执行;Windows 命令通过
1133
1189
  ```sh
1134
1190
  git clone https://github.com/arthurpanhku/dvalincode
1135
1191
  cd dvalincode && npm install
1136
- npm test # 584/584 核心测试 ✅
1192
+ npm test # 819/819 核心测试 ✅
1137
1193
  npm run typecheck
1138
1194
  ```
1139
1195
 
@@ -1,3 +1,4 @@
1
+ import { redactToolText } from '../core/redactSecrets.js';
1
2
  export function estimateTokens(messages) {
2
3
  const total = messages.reduce((acc, m) => acc + roughTokens(m.content ?? '') + roughTokens(JSON.stringify(m.tool_calls ?? [])), 0);
3
4
  return Math.ceil(total);
@@ -35,7 +36,14 @@ const COMPACT_PROMPT = `Summarize this coding session using exactly this format:
35
36
 
36
37
  Be concise. Each bullet is one line. Omit sections with no content.`;
37
38
  export async function summarizeWithLLM(messages, provider, runtime, signal) {
38
- const transcript = compactTranscript(messages);
39
+ const transcript = compactTranscript(messages.map(message => {
40
+ if (message.role !== 'tool')
41
+ return message;
42
+ const redacted = redactToolText(message.content);
43
+ if (redacted.count)
44
+ runtime?.audit?.append({ type: 'tool_redaction', tool: message.name ?? 'history', count: redacted.count });
45
+ return { ...message, content: redacted.text };
46
+ }));
39
47
  const resp = await provider.chat({
40
48
  messages: [{ role: 'user', content: `${COMPACT_PROMPT}\n\n---\n${transcript}` }],
41
49
  maxTokens: 1_500,