dvalincode 0.12.0 → 0.15.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 (152) hide show
  1. package/README.md +278 -81
  2. package/README.zh-CN.md +219 -74
  3. package/THIRD_PARTY_NOTICES.md +295 -147
  4. package/dist/agent/compact.d.ts +4 -2
  5. package/dist/agent/compact.js +41 -7
  6. package/dist/agent/compact.js.map +1 -1
  7. package/dist/agent/loop.d.ts +8 -0
  8. package/dist/agent/loop.js +38 -32
  9. package/dist/agent/loop.js.map +1 -1
  10. package/dist/agent/modes.d.ts +2 -2
  11. package/dist/agent/modes.js +6 -3
  12. package/dist/agent/modes.js.map +1 -1
  13. package/dist/agent/runner.d.ts +15 -6
  14. package/dist/agent/runner.js +379 -75
  15. package/dist/agent/runner.js.map +1 -1
  16. package/dist/agent/session.d.ts +26 -2
  17. package/dist/agent/session.js +85 -12
  18. package/dist/agent/session.js.map +1 -1
  19. package/dist/agent/types.d.ts +12 -5
  20. package/dist/agent/types.js +12 -2
  21. package/dist/agent/types.js.map +1 -1
  22. package/dist/audit/log.d.ts +7 -1
  23. package/dist/audit/log.js.map +1 -1
  24. package/dist/audit/report.js +7 -0
  25. package/dist/audit/report.js.map +1 -1
  26. package/dist/cli.js +30 -3
  27. package/dist/cli.js.map +1 -1
  28. package/dist/commands/chat.js +1 -1
  29. package/dist/commands/chat.js.map +1 -1
  30. package/dist/commands/dvalin.d.ts +9 -0
  31. package/dist/commands/dvalin.js +234 -0
  32. package/dist/commands/dvalin.js.map +1 -0
  33. package/dist/commands/mcpServe.d.ts +2 -0
  34. package/dist/commands/mcpServe.js +36 -0
  35. package/dist/commands/mcpServe.js.map +1 -0
  36. package/dist/commands/policy.js +12 -0
  37. package/dist/commands/policy.js.map +1 -1
  38. package/dist/commands/provider.js +3 -3
  39. package/dist/commands/provider.js.map +1 -1
  40. package/dist/commands/run.d.ts +30 -0
  41. package/dist/commands/run.js +229 -0
  42. package/dist/commands/run.js.map +1 -0
  43. package/dist/commands/tui.js +2 -2
  44. package/dist/commands/tui.js.map +1 -1
  45. package/dist/commands/update.d.ts +2 -0
  46. package/dist/commands/update.js +238 -0
  47. package/dist/commands/update.js.map +1 -0
  48. package/dist/core/context.d.ts +4 -0
  49. package/dist/core/context.js +8 -1
  50. package/dist/core/context.js.map +1 -1
  51. package/dist/core/guiUpdate.d.ts +27 -0
  52. package/dist/core/guiUpdate.js +65 -0
  53. package/dist/core/guiUpdate.js.map +1 -0
  54. package/dist/core/policy.d.ts +27 -3
  55. package/dist/core/policy.js +40 -1
  56. package/dist/core/policy.js.map +1 -1
  57. package/dist/core/selfUpdate.d.ts +108 -0
  58. package/dist/core/selfUpdate.js +180 -0
  59. package/dist/core/selfUpdate.js.map +1 -0
  60. package/dist/core/subprocessSandbox.d.ts +59 -0
  61. package/dist/core/subprocessSandbox.js +274 -23
  62. package/dist/core/subprocessSandbox.js.map +1 -1
  63. package/dist/core/trust.d.ts +8 -0
  64. package/dist/core/trust.js +13 -10
  65. package/dist/core/trust.js.map +1 -1
  66. package/dist/core/workspace.js +2 -1
  67. package/dist/core/workspace.js.map +1 -1
  68. package/dist/harness/run.d.ts +70 -0
  69. package/dist/harness/run.js +185 -0
  70. package/dist/harness/run.js.map +1 -0
  71. package/dist/mcp/client.d.ts +12 -0
  72. package/dist/mcp/client.js +2 -2
  73. package/dist/mcp/client.js.map +1 -1
  74. package/dist/mcp/config.d.ts +33 -3
  75. package/dist/mcp/config.js +32 -3
  76. package/dist/mcp/config.js.map +1 -1
  77. package/dist/mcp/register.d.ts +23 -6
  78. package/dist/mcp/register.js +42 -8
  79. package/dist/mcp/register.js.map +1 -1
  80. package/dist/mcp/server.d.ts +35 -0
  81. package/dist/mcp/server.js +230 -0
  82. package/dist/mcp/server.js.map +1 -0
  83. package/dist/mcp/stdio.d.ts +34 -0
  84. package/dist/mcp/stdio.js +183 -0
  85. package/dist/mcp/stdio.js.map +1 -0
  86. package/dist/providers/anthropic.d.ts +14 -0
  87. package/dist/providers/anthropic.js +244 -0
  88. package/dist/providers/anthropic.js.map +1 -0
  89. package/dist/providers/manager.d.ts +3 -0
  90. package/dist/providers/manager.js +13 -2
  91. package/dist/providers/manager.js.map +1 -1
  92. package/dist/providers/openaiCompatible.d.ts +12 -1
  93. package/dist/providers/openaiCompatible.js +21 -6
  94. package/dist/providers/openaiCompatible.js.map +1 -1
  95. package/dist/providers/pool.js +3 -4
  96. package/dist/providers/pool.js.map +1 -1
  97. package/dist/providers/trustedBaseUrls.js +1 -0
  98. package/dist/providers/trustedBaseUrls.js.map +1 -1
  99. package/dist/providers/types.d.ts +20 -4
  100. package/dist/remediation/automate.d.ts +18 -0
  101. package/dist/remediation/automate.js +78 -0
  102. package/dist/remediation/automate.js.map +1 -0
  103. package/dist/remediation/localScan.js +9 -1
  104. package/dist/remediation/localScan.js.map +1 -1
  105. package/dist/remediation/sarif.js +18 -4
  106. package/dist/remediation/sarif.js.map +1 -1
  107. package/dist/remediation/sarifExport.d.ts +7 -0
  108. package/dist/remediation/sarifExport.js +102 -0
  109. package/dist/remediation/sarifExport.js.map +1 -0
  110. package/dist/remediation/scannerSuite.d.ts +43 -0
  111. package/dist/remediation/scannerSuite.js +258 -0
  112. package/dist/remediation/scannerSuite.js.map +1 -0
  113. package/dist/server/configStore.d.ts +2 -8
  114. package/dist/server/configStore.js +12 -7
  115. package/dist/server/configStore.js.map +1 -1
  116. package/dist/server/routes/config.js +2 -3
  117. package/dist/server/routes/config.js.map +1 -1
  118. package/dist/server/routes/remediation.js +34 -0
  119. package/dist/server/routes/remediation.js.map +1 -1
  120. package/dist/server/scannerWorkspaceGrants.d.ts +7 -0
  121. package/dist/server/scannerWorkspaceGrants.js +48 -0
  122. package/dist/server/scannerWorkspaceGrants.js.map +1 -0
  123. package/dist/server/security.js +20 -6
  124. package/dist/server/security.js.map +1 -1
  125. package/dist/server/wsHandler.js +8 -0
  126. package/dist/server/wsHandler.js.map +1 -1
  127. package/dist/skills/store.js +28 -0
  128. package/dist/skills/store.js.map +1 -1
  129. package/dist/tools/registry.d.ts +7 -0
  130. package/dist/tools/registry.js +30 -0
  131. package/dist/tools/registry.js.map +1 -1
  132. package/dist/tools/runCheck.js +1 -0
  133. package/dist/tools/runCheck.js.map +1 -1
  134. package/dist/tools/runSecuritySuite.d.ts +14 -0
  135. package/dist/tools/runSecuritySuite.js +35 -0
  136. package/dist/tools/runSecuritySuite.js.map +1 -0
  137. package/dist/tools/shell.d.ts +3 -1
  138. package/dist/tools/shell.js +16 -6
  139. package/dist/tools/shell.js.map +1 -1
  140. package/dist/tui/app.d.ts +1 -0
  141. package/dist/tui/app.js +114 -17
  142. package/dist/tui/app.js.map +1 -1
  143. package/dist/tui/presets.d.ts +2 -2
  144. package/dist/tui/presets.js +1 -0
  145. package/dist/tui/presets.js.map +1 -1
  146. package/dist/tui/render.d.ts +1 -0
  147. package/dist/tui/render.js +13 -1
  148. package/dist/tui/render.js.map +1 -1
  149. package/dist/version.d.ts +8 -0
  150. package/dist/version.js +9 -0
  151. package/dist/version.js.map +1 -0
  152. package/package.json +7 -5
package/README.md CHANGED
@@ -9,48 +9,103 @@
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-203%20%2F%20203%20%E2%9C%93-success?style=for-the-badge" alt="Tests"></a>
12
+ <a href="#-tests"><img src="https://img.shields.io/badge/Tests-323%20%2F%20323%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
- <a href="docs/governance/ISO-42001-AIMS.md"><img src="https://img.shields.io/badge/ISO%2FIEC%2042001-AIMS%20Aligned-0F766E?style=for-the-badge" alt="ISO/IEC 42001 AIMS aligned"></a>
16
- <a href="docs/EVIDENCE-PACK.md"><img src="https://img.shields.io/badge/Compliance-Evidence%20Pack-2563EB?style=for-the-badge" alt="Compliance evidence pack"></a>
17
- <a href="docs/security/OPENSSF-SCORECARD.md"><img src="https://img.shields.io/badge/DevSecOps-Native-B91C1C?style=for-the-badge" alt="DevSecOps native"></a>
18
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>
19
16
  <a href="#-providers"><img src="https://img.shields.io/badge/LLM-OpenAI%20·%20Claude%20·%20DeepSeek%20·%20Ollama%20·%20Groq-7C3AED?style=for-the-badge" alt="LLM Support"></a>
20
17
  <a href="README.zh-CN.md"><img src="https://img.shields.io/badge/i18n-EN%20·%20中文-orange?style=for-the-badge" alt="English / 中文"></a>
21
18
  </p>
22
19
 
23
20
  <p align="center">
24
- <b>The approvable coding agent for regulated teams.</b><br>
25
- <b>Built for finance, healthcare, and security-sensitive engineering where AI coding must be controllable, transparent, and auditable.</b>
21
+ <b>Find the security holes in your repo, fix them, and prove the fix — in one command.</b><br>
22
+ Every fix is diffed, tested, re-scanned, and recorded in a tamper-evident audit log before it can become a PR.
26
23
  </p>
27
24
 
28
- <p align="center">
29
- <b>🔑 Any model · local-first · policy-bound · audit-ready — the agent your security team can actually approve.</b>
30
- </p>
25
+ ---
31
26
 
32
- <p align="center">
33
- Bring your own model — DeepSeek, OpenAI, Claude (via OpenRouter), Groq, Ollama, or any OpenAI-compatible endpoint. Switch with one click, no code changes, no lock-in.
34
- </p>
27
+ ## ⏱️ 30 seconds, no install, no API key
35
28
 
36
- ---
29
+ ```sh
30
+ npx dvalincode dvalin .
31
+ ```
32
+
33
+ That is the whole thing. It runs the built-in rules for injection, hardcoded
34
+ secrets, XSS, `eval`, and unsafe shell use against the current directory and
35
+ prints what it found. No account, no model, no config, no code leaves your
36
+ machine. Add `--scanners builtin,semgrep,trivy,osv-scanner` to pull in whichever
37
+ of those engines you already have on `PATH`.
38
+
39
+ ### Or put it on every pull request — nothing to install at all
40
+
41
+ ```yaml
42
+ # .github/workflows/security.yml
43
+ permissions:
44
+ contents: read
45
+ security-events: write
46
+ steps:
47
+ - uses: actions/checkout@v5
48
+ - uses: arthurpanhku/dvalincode@v0.15.0
49
+ with:
50
+ fail-on: high
51
+ ```
37
52
 
38
- ## ⏱️ 60 seconds to proof
53
+ Findings land inline on the pull request diff and in your Security tab.
54
+ No API key, no secrets, no model — the scan is deterministic and local to the
55
+ runner. [Full example →](docs/examples/dvalin-scan.yml)
39
56
 
40
- Don't take the claims on trust — verify them on your own machine:
57
+ ### Then let it fix what it found
41
58
 
42
59
  ```sh
43
- curl -fsSL https://raw.githubusercontent.com/arthurpanhku/dvalincode/main/scripts/install.sh | bash
44
- dvalincode trust
60
+ dvalincode dvalin . --fix --verify --draft-pr
45
61
  ```
46
62
 
47
- `trust` prints this install's **live security posture**: the resolved org policy and its hash, per-boundary network enforcement (provider · shell · MCP), and the tamper-evident audit status — the exact evidence a security reviewer needs, straight from the tool itself.
63
+ This step *does* use a model — your model, any OpenAI-compatible endpoint. It
64
+ prepares focused repairs in an isolated worktree, runs your tests, and requires
65
+ a clean re-scan before anything can proceed to a draft PR. It never auto-merges,
66
+ and a clean scan is never treated as proof that the code is safe.
48
67
 
49
68
  <p align="center">
50
- <img src="assets/cli-trust.gif" alt="dvalincode trust — live security posture under an org policy" width="100%">
69
+ <img src="assets/dvalin-remediation.gif" alt="Dvalin scanning a vulnerable OWASP NodeGoat example at 22/100 F with 10 findings, then showing a clean verified re-scan at 100/100 A" width="100%">
51
70
  </p>
52
71
 
53
- Then let the agent work, and prove what it did after the fact:
72
+ This animation is made from the real application, not a mock. The input is an
73
+ Apache-2.0-licensed example adapted from
74
+ [OWASP NodeGoat](https://github.com/OWASP/NodeGoat/tree/c5cb68a7084e4ae7dcc60e6a98768720a81841e8/app/routes),
75
+ whose contribution route evaluated user-controlled text.
76
+
77
+ ## 🛡️ What that run actually did
78
+
79
+ Dvalin turns open-source scanner evidence into a controlled scan → fix → test →
80
+ re-scan → draft-PR workflow. Here is the run in the animation above, measured:
81
+
82
+ | Real NodeGoat-derived run | Before | After Dvalin remediation |
83
+ |---|---:|---:|
84
+ | Security health (triage heuristic) | 22 / 100 · F | 100 / 100 · A |
85
+ | Findings | 10 (`eval` across 3 rules, 2 engines) | 0 |
86
+ | Tests | 2 passing | 3 passing, including an injection regression test |
87
+ | Scanner fleet | 4 / 4 completed | 4 / 4 completed |
88
+
89
+ The scanning and hardening **control plane** uses open-source components:
90
+
91
+ - [Semgrep CE](https://github.com/semgrep/semgrep) and its community rules for
92
+ semantic SAST.
93
+ - [Trivy](https://github.com/aquasecurity/trivy) for filesystem vulnerabilities,
94
+ secrets, and misconfiguration.
95
+ - [OSV-Scanner](https://github.com/google/osv-scanner) with the open
96
+ [OSV database](https://osv.dev/) for dependency vulnerabilities.
97
+ - DvalinCode's MIT-licensed built-in rules, remediation orchestration, test and
98
+ re-scan gates, plus [SARIF 2.1](https://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html)
99
+ import for other compatible scanners.
100
+
101
+ The scanners find and rank evidence. The configured model proposes source
102
+ changes; DvalinCode constrains that work, records the diff, runs project tests,
103
+ re-scans the changed tree, and keeps PR publication explicit. It does not
104
+ auto-merge and it does not claim that a clean scan proves the absence of bugs.
105
+ Choose an open-weight model through Ollama if the repair-proposal step must also
106
+ stay fully local and open; hosted model licensing depends on the provider.
107
+
108
+ You can still prove what the agent did after the fact:
54
109
 
55
110
  ```sh
56
111
  dvalincode report verify # re-derive the hash chain of the last run's audit log
@@ -58,18 +113,36 @@ dvalincode report verify # re-derive the hash chain of the last run's audit l
58
113
 
59
114
  ---
60
115
 
116
+ ## 🏛️ And it survives a security review
117
+
118
+ That last command is the part that matters once more than one person depends on
119
+ this. DvalinCode is a full coding agent — terminal, web GUI, and desktop app —
120
+ built so that an organization, not the developer, bounds what it may do: a
121
+ policy file constrains modes, commands, paths, tools, and models; every run is
122
+ hash-chained into a tamper-evident audit log; nothing reaches a provider that
123
+ the egress guard did not allow. A repo policy can only ever *narrow* the
124
+ machine-level one.
125
+
126
+ If you are the person who has to approve this class of tool, start at
127
+ [APPROVABILITY-PLAN.md](docs/APPROVABILITY-PLAN.md) and the
128
+ [Evidence Pack](docs/EVIDENCE-PACK.md) that every release ships of itself.
129
+
130
+ ---
131
+
61
132
  <table>
62
- <tr><td><b>🗨️ Chat mode</b></td><td>Read-only Q&A with one-click prompt templates — explain a codebase, find TODOs, review changes, write tests. The agent can read files and search, but never writes.</td></tr>
63
- <tr><td><b>👥 Cowork mode</b></td><td>Plan-then-execute. The agent drafts a numbered plan, you click <b>Proceed</b>, and every file write asks for explicit approval — with an inline red/green diff before you say yes.</td></tr>
64
- <tr><td><b>⚡ Code mode</b></td><td>Autonomous agent with full tool access. Run tests, type-check, build, lint — one click via the <b>Routines</b> panel. macOS shell calls run inside a <code>sandbox-exec</code> profile with network denied.</td></tr>
133
+ <tr><td><b>🏠 Home</b></td><td>One place for read-only <b>Ask</b> and approval-gated <b>Collaborate</b> workflows. Switch intent without leaving the project or conversation.</td></tr>
134
+ <tr><td><b>⚡ Code</b></td><td>Focused autonomous coding with full tool access and Ask / Plan / Auto / Bypass permission levels. Security and browser routines no longer compete with the core coding workflow.</td></tr>
135
+ <tr><td><b>🛡️ Dvalin</b></td><td>Dedicated white-box security engineering: orchestrate the built-in scanner plus installed Semgrep CE, Trivy, and OSV-Scanner; triage findings; create isolated fixes; run tests and re-scan; then explicitly publish a reviewable draft PR. <a href="docs/DVALIN.md">Dvalin guide →</a></td></tr>
65
136
  <tr><td><b>🏦 Regulated teams</b></td><td>Designed for finance, healthcare, security-sensitive SaaS, and internal platform teams that need AI coding under policy, audit, data minimization, and supply-chain review — not just developer convenience.</td></tr>
66
- <tr><td><b>🛡️ Secure remediation</b></td><td>Run a local security scan or import SARIF from CodeQL, GitHub Code Scanning, Semgrep, or compatible scanners, then create an isolated remediation worktree and turn findings into focused repair tasks with source context and PR-ready reporting. <a href="docs/SECURE-REMEDIATION.md">Workflow →</a></td></tr>
137
+ <tr><td><b>🛡️ Secure remediation</b></td><td>Run a multi-engine scan or import SARIF from CodeQL, GitHub Code Scanning, Semgrep, or compatible scanners, then create an isolated remediation worktree and turn findings into focused repair tasks with source context, verification evidence, and PR-ready reporting. <a href="docs/SECURE-REMEDIATION.md">Workflow →</a></td></tr>
67
138
  <tr><td><b>📚 Skills</b></td><td>Upload, download, and inspect local skill bundles. DvalinCode ships built-in secure-code-scan and secure-code-remediation skills, plus agent tools for listing skills, reading skill instructions, scanning, listing cases, and preparing remediation worktrees. <a href="docs/SKILLS.md">Format →</a></td></tr>
68
139
  <tr><td><b>🛡️ Audit trail</b></td><td>Every run emits a tamper-evident, hash-chained JSONL log — every file read/written, every command, every approval. A Run Report renders it as Markdown; <code>dvalincode report verify</code> proves the chain is intact. <a href="docs/AUDIT-TRAIL.md">Threat model →</a></td></tr>
69
140
  <tr><td><b>🔒 Org policy &amp; <code>trust</code></b></td><td>A company — not the developer — bounds the agent. A <code>dvalin.policy.json</code> constrains modes, shell commands, file paths, tools, and models; a repo policy can only ever <i>narrow</i> the machine-level one, never widen it. Each run records the governing policy's hash. <code>dvalincode trust</code> prints the install's live security posture — active policy + hashes, audit status, runtime — so a reviewer can verify it directly. <a href="docs/POLICY-REFERENCE.md">Policy reference →</a> · <a href="docs/APPROVABILITY-PLAN.md">Approvability plan →</a></td></tr>
70
- <tr><td><b>🏛️ Governance evidence</b></td><td>OpenSSF Scorecard, CodeQL, Dependabot, pinned GitHub Actions, CODEOWNERS, and ISO/IEC 42001 AIMS alignment docs are maintained as reviewable project evidence. <a href="docs/security/OPENSSF-SCORECARD.md">Scorecard map →</a> · <a href="docs/governance/ISO-42001-AIMS.md">ISO 42001 alignment →</a></td></tr>
141
+ <tr><td><b>🏛️ Governance evidence</b></td><td>OpenSSF Scorecard, CodeQL, Dependabot, pinned GitHub Actions, CODEOWNERS, and ISO/IEC 42001 AIMS alignment docs are maintained as reviewable project evidence, and every release ships an Evidence Pack the binary produced of itself. <a href="docs/security/OPENSSF-SCORECARD.md">Scorecard map →</a> · <a href="docs/governance/ISO-42001-AIMS.md">ISO 42001 alignment →</a> · <a href="docs/RELEASE-EVIDENCE.md">Release evidence →</a></td></tr>
142
+ <tr><td><b>📐 Open specs</b></td><td><b>PCP-1</b> — the provider-boundary contract (egress containment, credential containment, audit, policy binding) written as a vendor-neutral profile with test procedures, so any agent runtime can run it against its own adapters and publish the result. Not a DvalinCode test file; a checklist anyone can hold us to as well. <a href="docs/spec/PROVIDER-CONFORMANCE.md">Provider Conformance Profile →</a></td></tr>
71
143
  <tr><td><b>🖥️ First-class GUI</b></td><td>Modern web UI with code highlighting, file <code>@</code>-references, <code>/</code> slash commands, Git branch indicator, live token + cost counter, multi-profile LLM config, and a dark / light / system theme switcher.</td></tr>
72
144
  <tr><td><b>🖥️ Terminal or web — one binary</b></td><td>Run it bare for an interactive <b>terminal agent</b> with streaming output, inline approvals, and red/green diffs, or <code>dvalincode serve</code> to host the <b>web GUI</b> for browser/remote use. Both frontends drive the same agent core.</td></tr>
145
+ <tr><td><b>🖥️ Native desktop app</b></td><td><code>DvalinCode.app</code> — a real dock application (OS-native webview, no Electron) over the same engine. On macOS the one-line installer puts it in <code>/Applications</code> automatically; launch it straight from Launchpad.</td></tr>
73
146
  <tr><td><b>🪶 Zero-dependency binary</b></td><td>Single ~25MB executable per platform. No Node, no Python, no Docker.</td></tr>
74
147
  <tr><td><b>🔐 Local-first</b></td><td>Sessions, config, profiles, and audit logs live in <code>~/.dvalincode/</code>. <code>.dvalincodeignore</code> blocks the agent from reading sensitive files. <code>AGENTS.md</code> in your repo becomes persistent project instructions.</td></tr>
75
148
  <tr><td><b>💾 Portable & exportable</b></td><td>Export <b>all</b> local data (memory, sessions, config, audit) to one file and import it on another machine — your setup moves with you. Any conversation downloads as a clean <b>Markdown</b> transcript.</td></tr>
@@ -125,6 +198,12 @@ it can touch production repositories.
125
198
 
126
199
  ## 🛡️ Security & Governance
127
200
 
201
+ <p align="center">
202
+ <a href="docs/governance/ISO-42001-AIMS.md"><img src="https://img.shields.io/badge/ISO%2FIEC%2042001-AIMS%20Aligned-0F766E?style=for-the-badge" alt="ISO/IEC 42001 AIMS aligned"></a>
203
+ <a href="docs/EVIDENCE-PACK.md"><img src="https://img.shields.io/badge/Compliance-Evidence%20Pack-2563EB?style=for-the-badge" alt="Compliance evidence pack"></a>
204
+ <a href="docs/security/OPENSSF-SCORECARD.md"><img src="https://img.shields.io/badge/DevSecOps-Native-B91C1C?style=for-the-badge" alt="DevSecOps native"></a>
205
+ </p>
206
+
128
207
  DvalinCode maintains project-level governance evidence for open-source and
129
208
  enterprise review. This is the differentiator for teams where AI coding must
130
209
  pass security approval before it can reach production repositories:
@@ -145,10 +224,10 @@ pass security approval before it can reach production repositories:
145
224
  - **Regulated-use posture** — local-first data handling, policy-controlled
146
225
  autonomy, minimized audit records, and release supply-chain evidence for
147
226
  finance, healthcare, security-sensitive SaaS, and internal enterprise use.
148
- - **Secure remediation workflow** — local scan and SARIF import turn built-in,
149
- CodeQL, GitHub Code Scanning, Semgrep, and compatible scanner findings into
150
- local remediation cases and isolated worktree repair tasks with source
151
- context and verification/reporting instructions.
227
+ - **Dvalin security engineering** — the dedicated Dvalin workspace combines the
228
+ built-in scanner with installed Semgrep CE, Trivy, and OSV-Scanner, normalizes
229
+ SARIF findings, drives isolated test-backed fixes, and explicitly prepares a
230
+ reviewable draft PR without auto-merging it.
152
231
  [Workflow →](docs/SECURE-REMEDIATION.md)
153
232
 
154
233
  These documents are implementation evidence and operating procedures; they do
@@ -156,7 +235,86 @@ not claim third-party ISO certification.
156
235
 
157
236
  ---
158
237
 
159
- ## ⭐ What's New in v0.9.0 — 🛡️ Secure remediation · Skills · CodeQL hardening
238
+ ## ⭐ What's New in v0.14.0 — Dvalin security engineering
239
+
240
+ - **Home unifies Chat and Cowork** — the GUI now has a single Home workspace
241
+ with read-only Ask and approval-gated Collaborate intents, while keeping the
242
+ same project and conversation context.
243
+ - **Code is focused again** — the old Security and Routines panels have been
244
+ removed from Code so its sidebar is dedicated to projects and autonomous
245
+ implementation.
246
+ - **Dvalin is a first-class workspace** — orchestrate the built-in scanner plus
247
+ installed Semgrep CE, Trivy, and OSV-Scanner; import SARIF; score and triage
248
+ findings; persist remediation cases; and create isolated repair worktrees.
249
+ - **One flow from evidence to draft PR** — selected findings can launch an
250
+ evidence-backed Agent fix, run focused tests/typecheck/build and a fresh scan,
251
+ review the diff, and explicitly publish a draft PR without automatic merge.
252
+ - **Agent loops converge sooner and cost less** — investigation-before-edit and
253
+ stall detection reduce repeated failed actions, general tool output is
254
+ bounded, prompts remain append-only for cache reuse, and provider usage now
255
+ accounts for cache hits/misses.
256
+ - **Provider and evaluation upgrades** — native Anthropic prompt caching and
257
+ cache accounting are supported, and the SWE-bench Docker harness reports
258
+ official scores, policy violations, stalls, and token/cache metrics.
259
+
260
+ ---
261
+
262
+ ## ⭐ What's New in v0.12.4 — finish the task before stopping
263
+
264
+ - **Process narration no longer ends a task** — responses such as “let me
265
+ verify the file” are recognized as pending work, and the agent immediately
266
+ continues with the promised action instead of treating them as a final answer.
267
+ - **Truncated responses automatically recover** — provider finish reasons are
268
+ preserved, so output cut off by a token limit triggers another model step.
269
+ - **Normal coding turns get room to finish** — the per-turn action limit is now
270
+ an emergency 100-action guard rather than a routine 15-action stopping point;
271
+ stricter organization policy limits still take precedence.
272
+ - **Completion is explicit** — Code mode is instructed to return a tool-free
273
+ answer only after the requested work and focused validation are complete.
274
+
275
+ ---
276
+
277
+ ## ⭐ What's New in v0.12.3 — resilient long-running Code mode
278
+
279
+ - **Long coding turns keep going** — Code mode now compacts context during an
280
+ active tool loop, accounts for the full provider request when estimating
281
+ tokens, and raises the default iteration checkpoint from 10 to 40.
282
+ - **Interruptions are resumable** — completed tool state is persisted when a
283
+ turn is interrupted or its connection closes, so a follow-up `continue`
284
+ resumes from the actual workspace progress.
285
+ - **Visible, quieter agent activity** — running sessions show a sidebar loading
286
+ state, each response reports elapsed work time, and its Action timeline is
287
+ available on click while raw Tool Calls stay collapsed by default.
288
+ - **GitHub workflows from Code mode** — network-aware `git` and GitHub CLI
289
+ (`gh`) operations now support pull, push, PR creation, and Actions/repository
290
+ commands through the governed shell approval path.
291
+ - **Safer releases** — package and CLI versions are synchronized, and
292
+ `prepublishOnly` runs the build, typecheck, and test suite before publishing.
293
+ - **Simple tasks stay simple** — the Action budget is enforced across the whole
294
+ turn instead of resetting on every model iteration, and Code mode is prompted
295
+ to take the shortest direct path and stop when focused validation passes.
296
+
297
+ ---
298
+
299
+ ## ⭐ What's New in v0.12.2 — 🖥️ Desktop app milestone: it just works
300
+
301
+ - **🖥️ The native desktop app now works out of the box on macOS** — `DvalinCode.app`
302
+ opens a real dock window (WKWebView, no Electron) over the embedded engine.
303
+ Two threading bugs that shipped in every earlier desktop build are fixed:
304
+ the blocking webview loop no longer starves the embedded server (blank
305
+ window), and the webview runs on the main thread as macOS requires (no
306
+ window at all) — the server now lives in a child process of the same binary.
307
+ - **📦 The one-line installer installs the app** — on macOS,
308
+ `curl … install.sh | bash` now also puts `DvalinCode.app` (with the
309
+ DvalinCode icon) into `/Applications`, so the desktop window launches
310
+ straight from Launchpad after a CLI install. Opt out with
311
+ `DVALINCODE_NO_APP=1`; pin with `DVALINCODE_GUI_VERSION`.
312
+ - **✅ Desktop is no longer "experimental" on macOS** — the window and the
313
+ embedded server are verified working; Windows and Linux desktop builds are
314
+ cross-compiled and remain a preview.
315
+
316
+ <details>
317
+ <summary>v0.9.0 — 🛡️ Secure remediation · Skills · CodeQL hardening</summary>
160
318
 
161
319
  - **🛡️ Secure remediation workflow** — run a built-in local scan or import SARIF
162
320
  from CodeQL, GitHub Code Scanning, Semgrep, and compatible scanners; findings
@@ -172,6 +330,8 @@ not claim third-party ISO certification.
172
330
  - **🎨 App icons** — dark and light theme application icons now ship with the web
173
331
  bundle and desktop build inputs.
174
332
 
333
+ </details>
334
+
175
335
  <details>
176
336
  <summary>v0.8.0 — 🔒 Governance: controllable · transparent · auditable</summary>
177
337
 
@@ -239,53 +399,32 @@ not claim third-party ISO certification.
239
399
 
240
400
  ## 📸 Preview
241
401
 
242
- <p align="center">
243
- <img src="assets/hero.png" alt="DvalinCode UI" width="100%">
244
- </p>
245
-
246
- **Switching modes — each mode has its own sidebar:**
402
+ **A real Dvalin scan of vulnerable code — Security health 22/100 · F, with the
403
+ 10 findings the engines actually reported, located to the line:**
247
404
 
248
405
  <p align="center">
249
- <img src="assets/modes.gif" alt="Mode switching" width="100%">
406
+ <img src="assets/hero.png" alt="Dvalin Security health showing 22/100 F with 4 high and 6 medium findings, and a Findings list locating each eval to a line in the NodeGoat-derived route" width="100%">
250
407
  </p>
251
408
 
252
- **Slash commands & file references in the composer:**
409
+ **The verified result — the three `eval` call sites replaced by a constrained
410
+ numeric parser, one new injection regression test, all four open-source engines
411
+ complete, 0 findings, 100/100 · A:**
253
412
 
254
413
  <p align="center">
255
- <img src="assets/slash.gif" alt="Slash commands and @ file references" width="100%">
414
+ <img src="assets/dvalin-scan-after.jpg" alt="Dvalin verified re-scan showing 100/100 A, zero findings, and the remediation run that produced it" width="100%">
256
415
  </p>
257
416
 
258
- ### 🔒 Governance, from the command line
259
-
260
- **`dvalincode trust` — the install's live security posture (resolved policy, per-boundary enforcement, audit status) that a security review can read directly.** Field semantics and copy-paste recipes: [docs/POLICY-REFERENCE.md](docs/POLICY-REFERENCE.md).
417
+ **Home → Code → Dvalin — the current workspaces:**
261
418
 
262
419
  <p align="center">
263
- <img src="assets/cli-trust.gif" alt="dvalincode trust — live security posture under an org policy" width="100%">
420
+ <img src="assets/modes.gif" alt="DvalinCode switching between Home, Code, and Dvalin" width="100%">
264
421
  </p>
265
422
 
266
- **`dvalincode policy check` — validate `dvalin.policy.json` in CI: schema check, the resolved policy after machine-layer narrowing, and its canonical hash.**
267
-
268
- <p align="center">
269
- <img src="assets/cli-policy.gif" alt="dvalincode policy check — validate and inspect the resolved org policy" width="100%">
270
- </p>
271
-
272
- **Tamper-evident audit — every agent run is a hash-chained, minimized report you can verify offline:**
273
-
274
- <p align="center">
275
- <img src="assets/cli-audit.gif" alt="dvalincode report — run report, then report verify proving the chain intact" width="100%">
276
- </p>
277
-
278
- **Evidence Pack — one command bundles policy, posture, and audit proofs into a single file a reviewer can verify fully offline:**
279
-
280
- <p align="center">
281
- <img src="assets/cli-evidence.gif" alt="dvalincode evidence export and verify — offline-verifiable governance evidence" width="100%">
282
- </p>
283
-
284
- **Project intelligence — `dvalincode scan` maps the workspace before the agent touches it:**
285
-
286
- <p align="center">
287
- <img src="assets/cli-scan.gif" alt="dvalincode scan — project intelligence" width="100%">
288
- </p>
423
+ The scan images above are unedited captures of a real run against the documented
424
+ NodeGoat-derived case: the scanners were run, the model repaired the source, the
425
+ project's tests were run, and the tree was re-scanned. Nothing is staged, and a
426
+ 100/A means the configured engines found nothing — not that the code is proven
427
+ safe.
289
428
 
290
429
  ---
291
430
 
@@ -311,15 +450,22 @@ not claim third-party ISO certification.
311
450
  curl -fsSL https://raw.githubusercontent.com/arthurpanhku/dvalincode/main/scripts/install.sh | bash
312
451
  ```
313
452
 
314
- Detects your OS + arch, downloads the right binary, installs to `~/.dvalincode/`, and adds it to your `PATH`. After reload:
453
+ Detects your OS + arch, downloads the right binary, installs to `~/.dvalincode/`, and adds it to your `PATH`. On macOS it also installs the native **DvalinCode.app** into `/Applications` (skip with `DVALINCODE_NO_APP=1`), so the desktop window launches straight from Launchpad. After reload:
315
454
 
316
455
  ```sh
317
456
  source ~/.zshrc # or ~/.bashrc
318
457
  dvalincode # interactive terminal agent
458
+ dvalincode dvalin . # white-box security scan (GUI-independent)
319
459
  dvalincode serve # start the web GUI, open the browser
320
460
  dvalincode serve --host 0.0.0.0 --no-open # host it on a server for remote/browser use
461
+ echo "inspect src and summarize" | dvalincode run - --output-format stream-json
462
+ dvalincode mcp-serve # task-level stdio MCP server for external agents
321
463
  ```
322
464
 
465
+ Headless `run` and `mcp-serve` keep the same policy and audit chokepoint as
466
+ the interactive clients. See the [unattended recipes](docs/RECIPES-UNATTENDED.md)
467
+ for cron, CI, and external-agent examples.
468
+
323
469
  ### Windows
324
470
 
325
471
  Download `dvalincode-v*-windows-x64.zip` from [Releases](https://github.com/arthurpanhku/dvalincode/releases/latest), unzip, then double-click `start.bat`.
@@ -338,13 +484,46 @@ Grab the archive for your platform from the [Releases page](https://github.com/a
338
484
 
339
485
  Verify against `SHA256SUMS.txt` (included in each release).
340
486
 
487
+ Each release also ships **`dvalincode-v*-evidence.json`** — an Evidence Pack the
488
+ shipped binary produced of itself on the build machine: two real governed runs,
489
+ one allowed and one blocked by policy, with their hash chains. You can check the
490
+ claims on this page before installing anything:
491
+
492
+ ```sh
493
+ dvalincode evidence verify dvalincode-v0.14.0-evidence.json # offline, reads only the file
494
+ ```
495
+
496
+ The pack's checksum is inside `SHA256SUMS.txt`, which is the subject of the
497
+ release's build-provenance attestation. [How it is produced →](docs/RELEASE-EVIDENCE.md)
498
+
341
499
  > **macOS Gatekeeper:** binaries are unsigned. On first run, either clear the quarantine flag with `xattr -dr com.apple.quarantine ~/.dvalincode`, or right-click the binary in Finder → Open → confirm.
342
500
 
501
+ ### Staying up to date
502
+
503
+ DvalinCode updates itself — no need to re-run the installer:
504
+
505
+ ```sh
506
+ dvalincode update --check # is a newer release out? (read-only)
507
+ dvalincode update # download, verify, and install the latest
508
+ ```
509
+
510
+ It finds the newest release on GitHub, and for a binary install downloads the
511
+ matching archive, **verifies it against the release's `SHA256SUMS.txt` before
512
+ swapping anything in**, then replaces `~/.dvalincode/` in place. npm installs are
513
+ updated via `npm i -g`, and source checkouts are pointed at `git pull`. Add
514
+ `-y` to skip the prompt, `--prerelease` to track pre-releases, or `--json` for
515
+ scripting.
516
+
517
+ The macOS desktop app checks the separate `gui-v*` release track when it starts.
518
+ When a newer GUI is available, it asks before downloading, verifies the archive
519
+ against `SHA256SUMS-gui.txt`, validates the app version, then replaces and
520
+ restarts `DvalinCode.app`. A failed replacement rolls back to the previous app.
521
+
343
522
  ---
344
523
 
345
524
  ## 🎬 First-time setup
346
525
 
347
- **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, `/help` for commands.
526
+ **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**.
348
527
 
349
528
  **Web GUI:** run `dvalincode serve` and:
350
529
 
@@ -361,11 +540,11 @@ Both share the same config and sessions in `~/.dvalincode/`.
361
540
 
362
541
  | Category | Feature | Notes |
363
542
  |---|---|---|
364
- | **Modes** | Chat / Cowork / Code | Each with a distinct sidebar (Templates / Projects / Routines) and tool-access policy |
543
+ | **Modes** | Home / Code / Dvalin | Home contains read-only Ask and approval-gated Collaborate; Code is focused autonomous development; Dvalin is the scan-to-fix security workspace |
365
544
  | **Code permissions** | Ask Permissions / Plan Mode / Auto Mode / Bypass permissions | Verified behavior: Ask requests approval before writes/commands, Plan is read-only and does not write files, Auto runs operations automatically, Bypass runs without confirmation prompts |
366
545
  | **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 |
367
546
  | **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/` |
368
- | **Secure remediation** | Local scan / SARIF import / case queue / remediation worktree | Code mode can scan common local risks, import SARIF findings, persist local cases, and create isolated `dvalin/remediate/...` worktrees with repair prompts |
547
+ | **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 |
369
548
  | **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) |
370
549
  | **Composer** | `@` file references | Type `@` for a fuzzy file search; selected files get inlined into the prompt |
371
550
  | | `/` slash commands | `/clear` `/compact` `/git` `/plan` `/undo` `/help` |
@@ -462,7 +641,7 @@ RESTORE → COMPACT → COMMAND → BUILD → RUN → SAVE → RESPOND → DONE
462
641
  npm test
463
642
  ```
464
643
 
465
- **203 tests · 36 files · all green.**
644
+ **323 tests · 49 files · all green.**
466
645
 
467
646
  ---
468
647
 
@@ -531,15 +710,21 @@ Yes — use Ollama. Pull a model (<code>ollama pull qwen2.5-coder</code>), then
531
710
  </details>
532
711
 
533
712
  <details>
534
- <summary><b>Why three modes? Can't I just use one?</b></summary>
713
+ <summary><b>Why Home, Code, and Dvalin?</b></summary>
535
714
  <br>
536
- Each mode has different <b>tool access</b> and <b>safety</b> defaults: Chat is read-only, Cowork requires approval per write, Code is full-auto. Each also has a different sidebar (Templates / Projects / Routines) optimized for that workflow. You can switch any time — the conversation continues.
715
+ They represent different outcomes and safety defaults. <b>Home</b> groups read-only Ask and approval-gated Collaborate. <b>Code</b> is the focused software-development agent. <b>Dvalin</b> is a security pipeline with scanner evidence, remediation cases, isolated worktrees, verification, and explicit draft-PR publication. You can switch at any time while keeping project context.
537
716
  </details>
538
717
 
539
718
  <details>
540
719
  <summary><b>Is the shell tool sandboxed?</b></summary>
541
720
  <br>
542
- On macOS, yes — every <code>shell</code> tool invocation is wrapped in <code>sandbox-exec</code> with a profile that <i>denies network access</i> and allows file writes only inside <code>cwd</code>, <code>/tmp</code>, and <code>/var</code>. Linux and Windows sandboxing is planned.
721
+ On macOS, commands use <code>sandbox-exec</code>; on Linux, restrictive network policies use Bubblewrap when installed. Windows has no supported subprocess network sandbox yet, so restrictive policies fail closed instead of silently running unrestricted. The native command runner itself works on all three platforms.
722
+ </details>
723
+
724
+ <details>
725
+ <summary><b>Which operating-system shells are supported?</b></summary>
726
+ <br>
727
+ Linux and macOS commands run through <code>/bin/sh</code>; Windows commands run through the system <code>ComSpec</code> (<code>cmd.exe</code> by default). Full native command lines support pipes, redirects, and conditional operators. The split <code>command</code> + <code>args</code> form quotes executable paths and arguments for the host shell.
543
728
  </details>
544
729
 
545
730
  <details>
@@ -551,7 +736,7 @@ Every run writes a JSONL audit log to <code>~/.dvalincode/audit/run-&lt;timestam
551
736
  <details>
552
737
  <summary><b>Will it overwrite my files without asking?</b></summary>
553
738
  <br>
554
- Depends on the mode. <b>Chat</b> never writes. <b>Cowork</b> requires approval per file (with inline red/green diff before you click Allow). <b>Code</b> is full-auto — use it for trusted tasks or in a feature branch.
739
+ Depends on the mode. <b>Home → Ask</b> never writes. <b>Home → Collaborate</b> requires approval per file (with inline red/green diff before you click Allow). <b>Code</b> and <b>Dvalin</b> honor their selected permission level; use Auto only for trusted workspaces or isolated branches.
555
740
  </details>
556
741
 
557
742
  <details>
@@ -562,12 +747,6 @@ The binary is unsigned. Run this once to clear the quarantine flag:
562
747
  Or right-click the binary in Finder → Open → confirm once.
563
748
  </details>
564
749
 
565
- <details>
566
- <summary><b>How do I save a routine in Code mode?</b></summary>
567
- <br>
568
- Switch to Code mode, click the <b>+</b> next to "ROUTINES" in the sidebar. Enter a name (e.g. "Deploy preview") and a prompt or slash command (e.g. "<code>/git</code>" or "Build the project and deploy to staging"). Routines persist in your browser's <code>localStorage</code>.
569
- </details>
570
-
571
750
  <details>
572
751
  <summary><b>Does <code>AGENTS.md</code> get sent every turn?</b></summary>
573
752
  <br>
@@ -583,7 +762,7 @@ Contributions welcome. The codebase is intentionally small and surgical — see
583
762
  ```sh
584
763
  git clone https://github.com/arthurpanhku/dvalincode
585
764
  cd dvalincode && npm install
586
- npm test # 65/65 ✅
765
+ npm test # 323/323 ✅
587
766
  npm run typecheck
588
767
  ```
589
768
 
@@ -647,3 +826,21 @@ Full source references: [docs/REFERENCES.md](docs/REFERENCES.md)
647
826
  </picture>
648
827
  </a>
649
828
  </p>
829
+
830
+ ---
831
+
832
+ ## 💛 Thanks to Our Contributors
833
+
834
+ <p align="center">
835
+ Every issue, idea, documentation improvement, test, and code contribution helps make DvalinCode better.
836
+ </p>
837
+
838
+ <p align="center">
839
+ <a href="https://github.com/arthurpanhku/dvalincode/graphs/contributors">
840
+ <img src="https://contrib.rocks/image?repo=arthurpanhku/dvalincode" alt="DvalinCode contributors">
841
+ </a>
842
+ </p>
843
+
844
+ <p align="center">
845
+ <sub>Want to join them? Read the <a href="CONTRIBUTING.md">contribution guide</a> and send your first pull request.</sub>
846
+ </p>