brass-runtime 1.15.0 → 1.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +673 -136
  3. package/dist/agent/cli/main.cjs +40 -35
  4. package/dist/agent/cli/main.js +9 -4
  5. package/dist/agent/cli/main.mjs +9 -4
  6. package/dist/agent/index.cjs +8 -4
  7. package/dist/agent/index.d.ts +1 -1
  8. package/dist/agent/index.js +7 -3
  9. package/dist/agent/index.mjs +7 -3
  10. package/dist/chunk-2HQTDLHF.mjs +683 -0
  11. package/dist/chunk-36I3M4UC.mjs +370 -0
  12. package/dist/chunk-3AYM6WPJ.js +1629 -0
  13. package/dist/chunk-3LOYJFRR.cjs +300 -0
  14. package/dist/chunk-3RG5ZIWI.js +10 -0
  15. package/dist/chunk-3Y2RIUMM.js +300 -0
  16. package/dist/{chunk-VEZNF5GZ.cjs → chunk-4ROBZFL6.cjs} +130 -126
  17. package/dist/{chunk-3QMOKAS5.js → chunk-52OB2ROS.js} +9 -5
  18. package/dist/chunk-52PPNNI4.cjs +416 -0
  19. package/dist/chunk-5EC274J5.cjs +2874 -0
  20. package/dist/chunk-5QC7LRZ3.js +229 -0
  21. package/dist/chunk-5VRJNBLZ.mjs +2874 -0
  22. package/dist/chunk-62AZW6UT.cjs +313 -0
  23. package/dist/chunk-6IXXWIUM.js +683 -0
  24. package/dist/chunk-74ZTY6CP.js +2871 -0
  25. package/dist/chunk-76YMRMH2.cjs +777 -0
  26. package/dist/chunk-7CMJS3QE.mjs +2871 -0
  27. package/dist/{chunk-4NHES7VK.mjs → chunk-7JIJOVCT.js} +27 -13
  28. package/dist/chunk-A2OM6NEH.mjs +194 -0
  29. package/dist/chunk-AGR5B2BC.cjs +683 -0
  30. package/dist/chunk-AVNQLJ5V.js +777 -0
  31. package/dist/chunk-B33ICAKP.js +313 -0
  32. package/dist/{chunk-ELOOF35R.mjs → chunk-B5JD23U7.mjs} +1 -1
  33. package/dist/chunk-BABBZK4Y.js +2024 -0
  34. package/dist/chunk-C3MDXTRZ.js +354 -0
  35. package/dist/chunk-CIZFIMK5.js +2193 -0
  36. package/dist/chunk-CZIVE6NT.cjs +354 -0
  37. package/dist/chunk-DNFJLJMW.mjs +354 -0
  38. package/dist/chunk-DNFO2EIZ.mjs +777 -0
  39. package/dist/chunk-EJ6BPYVR.mjs +416 -0
  40. package/dist/chunk-ENKODRU3.cjs +2193 -0
  41. package/dist/chunk-EOC4UHBS.mjs +229 -0
  42. package/dist/{chunk-BMH5AV44.js → chunk-FH2X7BVP.js} +756 -440
  43. package/dist/{chunk-PPUXIH5R.js → chunk-FHQGHPMO.mjs} +27 -13
  44. package/dist/{chunk-TGIFUAK4.cjs → chunk-GLE2WY7Z.cjs} +951 -635
  45. package/dist/{chunk-BDF4AMWX.mjs → chunk-GYM3LLGS.mjs} +756 -440
  46. package/dist/chunk-HLWLMW2F.mjs +2024 -0
  47. package/dist/chunk-JF5WGYJJ.cjs +194 -0
  48. package/dist/chunk-KH4SYAOS.mjs +1629 -0
  49. package/dist/chunk-KN32XNTH.mjs +313 -0
  50. package/dist/chunk-KQLYONSE.cjs +2871 -0
  51. package/dist/{chunk-STVLQ3XD.cjs → chunk-KZJQ723N.cjs} +92 -78
  52. package/dist/chunk-L2SYFEBS.js +194 -0
  53. package/dist/chunk-L6VB5N7Q.cjs +104 -0
  54. package/dist/{chunk-K6M7MDZ4.mjs → chunk-MBEJI5HF.mjs} +9 -5
  55. package/dist/chunk-MIIYDLGM.js +2874 -0
  56. package/dist/chunk-MOO4L7F4.mjs +104 -0
  57. package/dist/chunk-MT3OWDPC.mjs +2193 -0
  58. package/dist/chunk-MVGUEJ5Z.cjs +370 -0
  59. package/dist/chunk-OBGZSXTJ.cjs +10 -0
  60. package/dist/chunk-PD4EJTQC.cjs +229 -0
  61. package/dist/chunk-PWC3RBQE.mjs +300 -0
  62. package/dist/chunk-Q2I37RP3.cjs +1629 -0
  63. package/dist/chunk-RKGKFN2A.js +416 -0
  64. package/dist/{chunk-R3R2FVLG.cjs → chunk-SA6HUJVI.cjs} +5 -5
  65. package/dist/chunk-TRM4JUZQ.js +104 -0
  66. package/dist/chunk-UB4B6OFY.js +370 -0
  67. package/dist/{chunk-TO7IKXYT.js → chunk-UCUBNWM2.js} +1 -1
  68. package/dist/chunk-VN44DYYT.cjs +2024 -0
  69. package/dist/chunk-Y6FXYEAI.mjs +10 -0
  70. package/dist/client-CZHU674n.d.ts +820 -0
  71. package/dist/core/index.cjs +198 -4
  72. package/dist/core/index.d.ts +311 -212
  73. package/dist/core/index.js +237 -43
  74. package/dist/core/index.mjs +237 -43
  75. package/dist/{effect-CMOQKX8y.d.ts → effect-DIUHZ9IN.d.ts} +195 -1
  76. package/dist/effectRunner-CFLC32IK.cjs +8 -0
  77. package/dist/effectRunner-L4S7IPT3.js +8 -0
  78. package/dist/effectRunner-NNGG75QA.mjs +8 -0
  79. package/dist/http/index.cjs +1227 -2971
  80. package/dist/http/index.d.ts +826 -280
  81. package/dist/http/index.js +1089 -2833
  82. package/dist/http/index.mjs +1089 -2833
  83. package/dist/http/testing.cjs +161 -0
  84. package/dist/http/testing.d.ts +43 -0
  85. package/dist/http/testing.js +161 -0
  86. package/dist/http/testing.mjs +161 -0
  87. package/dist/index.cjs +486 -250
  88. package/dist/index.d.ts +87 -95
  89. package/dist/index.js +391 -155
  90. package/dist/index.mjs +391 -155
  91. package/dist/observability/index.cjs +162 -0
  92. package/dist/observability/index.d.ts +152 -0
  93. package/dist/observability/index.js +162 -0
  94. package/dist/observability/index.mjs +162 -0
  95. package/dist/perf/cli.cjs +401 -0
  96. package/dist/perf/cli.d.ts +1 -0
  97. package/dist/perf/cli.js +401 -0
  98. package/dist/perf/cli.mjs +401 -0
  99. package/dist/perf/index.cjs +141 -0
  100. package/dist/perf/index.d.ts +483 -0
  101. package/dist/perf/index.js +141 -0
  102. package/dist/perf/index.mjs +141 -0
  103. package/dist/schedule-CK3Ml_7p.d.ts +259 -0
  104. package/dist/schema/index.cjs +29 -0
  105. package/dist/schema/index.d.ts +179 -0
  106. package/dist/schema/index.js +29 -0
  107. package/dist/schema/index.mjs +29 -0
  108. package/dist/server-GJPg8ZSG.d.ts +675 -0
  109. package/dist/{stream-FQm9h4Mg.d.ts → stream-B4oK9JFP.d.ts} +1 -1
  110. package/dist/tracer-Hwt1cl7h.d.ts +189 -0
  111. package/dist/tracing-DqbTKGcf.d.ts +148 -0
  112. package/docs/ARCHITECTURE.md +292 -0
  113. package/docs/README.md +63 -0
  114. package/docs/adr/0001-ai-context-pack.md +32 -0
  115. package/docs/agent-apply-mode.md +104 -0
  116. package/docs/agent-approvals.md +110 -0
  117. package/docs/agent-batch.md +185 -0
  118. package/docs/agent-boundaries.md +112 -0
  119. package/docs/agent-chat-sessions.md +160 -0
  120. package/docs/agent-ci.md +17 -0
  121. package/docs/agent-cli.md +405 -0
  122. package/docs/agent-config.md +480 -0
  123. package/docs/agent-context-discovery.md +159 -0
  124. package/docs/agent-copilot-like-dx.md +126 -0
  125. package/docs/agent-declarative-optimized-planning.md +138 -0
  126. package/docs/agent-dx.md +224 -0
  127. package/docs/agent-env-files.md +126 -0
  128. package/docs/agent-follow-up-context.md +43 -0
  129. package/docs/agent-global-usage.md +180 -0
  130. package/docs/agent-init.md +109 -0
  131. package/docs/agent-install-and-configure.md +516 -0
  132. package/docs/agent-language-workspace-ux.md +99 -0
  133. package/docs/agent-llm-adapters.md +123 -0
  134. package/docs/agent-local-install.md +190 -0
  135. package/docs/agent-local-tests.md +51 -0
  136. package/docs/agent-observability.md +155 -0
  137. package/docs/agent-patch-quality-loop.md +162 -0
  138. package/docs/agent-presets.md +22 -0
  139. package/docs/agent-project-commands.md +237 -0
  140. package/docs/agent-project-intelligence.md +156 -0
  141. package/docs/agent-redaction.md +18 -0
  142. package/docs/agent-release-readiness.md +76 -0
  143. package/docs/agent-rollback-safety.md +162 -0
  144. package/docs/agent-rollback.md +23 -0
  145. package/docs/agent-run-artifacts.md +16 -0
  146. package/docs/agent-vscode-auto-discovery.md +137 -0
  147. package/docs/agent-vscode-batch-runner.md +100 -0
  148. package/docs/agent-vscode-chat-layout.md +90 -0
  149. package/docs/agent-vscode-clean-install.md +147 -0
  150. package/docs/agent-vscode-code-actions.md +70 -0
  151. package/docs/agent-vscode-diff-preview.md +45 -0
  152. package/docs/agent-vscode-inline-assist.md +56 -0
  153. package/docs/agent-vscode-install.md +186 -0
  154. package/docs/agent-vscode-model-setup.md +97 -0
  155. package/docs/agent-vscode-patch-preview.md +92 -0
  156. package/docs/agent-vscode-problems.md +79 -0
  157. package/docs/agent-vscode-project-dashboard.md +106 -0
  158. package/docs/agent-vscode-run-history.md +92 -0
  159. package/docs/agent-vscode-ux.md +73 -0
  160. package/docs/ai/INVARIANTS.md +84 -0
  161. package/docs/ai/PROJECT_MAP.md +338 -0
  162. package/docs/ai/PUBLIC_API.md +336 -0
  163. package/docs/ai/VALIDATION_MATRIX.md +67 -0
  164. package/docs/api-polish.md +37 -0
  165. package/docs/cancellation.md +162 -0
  166. package/docs/coverage.md +46 -0
  167. package/docs/getting-started.md +159 -0
  168. package/docs/guides/README.md +40 -0
  169. package/docs/guides/circuit-breaker.md +89 -0
  170. package/docs/guides/error-handling.md +91 -0
  171. package/docs/guides/getting-started.md +107 -0
  172. package/docs/guides/layers.md +189 -0
  173. package/docs/guides/metrics.md +101 -0
  174. package/docs/guides/resource-management.md +141 -0
  175. package/docs/guides/retry.md +215 -0
  176. package/docs/guides/semaphore.md +66 -0
  177. package/docs/guides/streams.md +117 -0
  178. package/docs/guides/supervisors.md +98 -0
  179. package/docs/guides/testing.md +162 -0
  180. package/docs/guides/tracing.md +71 -0
  181. package/docs/http-recipes.md +399 -0
  182. package/docs/http.md +749 -0
  183. package/docs/modules.md +285 -0
  184. package/docs/observability-collector-smoke.md +31 -0
  185. package/docs/observability-framework-examples.md +98 -0
  186. package/docs/observability.md +542 -0
  187. package/docs/otel-collector-smoke.yaml +27 -0
  188. package/docs/performance-profiler.md +199 -0
  189. package/docs/production-readiness.md +73 -0
  190. package/docs/recipes/README.md +12 -0
  191. package/docs/recipes/http-server.md +45 -0
  192. package/docs/recipes/layers.md +44 -0
  193. package/docs/recipes/performance.md +47 -0
  194. package/docs/recipes/runtime.md +41 -0
  195. package/docs/recipes/testing.md +41 -0
  196. package/docs/release.md +53 -0
  197. package/docs/wasm-bounded-queues.md +44 -0
  198. package/docs/wasm-engine-observability-benchmarks.md +85 -0
  199. package/docs/wasm-fiber-engine.md +117 -0
  200. package/docs/wasm-scheduler-state-machine.md +122 -0
  201. package/docs/wasm-stream-chunks.md +54 -0
  202. package/package.json +48 -2
  203. package/dist/chunk-AR22SXML.js +0 -1043
  204. package/dist/chunk-BDYEENHT.js +0 -224
  205. package/dist/chunk-JFPU5GQI.mjs +0 -1043
  206. package/dist/chunk-MS34J5LY.cjs +0 -224
  207. package/dist/chunk-UMAZLXAB.mjs +0 -224
  208. package/dist/chunk-XPZNXSVN.cjs +0 -1043
  209. package/dist/tracing-DNT9jEbr.d.ts +0 -106
@@ -0,0 +1,237 @@
1
+ # Agent project command discovery
2
+
3
+ P8 makes the experimental `brass-agent` project-aware enough to stop assuming
4
+ `npm test` for every workspace.
5
+
6
+ The agent still follows the same boundary rule:
7
+
8
+ ```txt
9
+ src/core
10
+
11
+ src/agent project command discovery
12
+
13
+ src/agent/cli config loading
14
+ ```
15
+
16
+ Command discovery is pure agent logic. It reads observations such as
17
+ `package.json` and lockfile existence, then chooses `AgentAction` values. The
18
+ runtime core does not know about JavaScript package managers.
19
+
20
+ ## Discovery flow
21
+
22
+ Before planning, the agent now does this:
23
+
24
+ ```txt
25
+ read package.json
26
+ check pnpm-lock.yaml
27
+ check yarn.lock
28
+ check bun.lockb
29
+ check bun.lock
30
+ check package-lock.json
31
+ check npm-shrinkwrap.json
32
+ discover validation commands
33
+ run discovered validation commands when allowed
34
+ run bounded context discovery
35
+ ask LLM with command-discovery and context-discovery summaries
36
+ ```
37
+
38
+ In `read-only` mode, it still reads/checks files and asks the LLM, but it does
39
+ not run shell validation.
40
+
41
+ ## Package manager inference
42
+
43
+ The package manager is selected in this order:
44
+
45
+ ```txt
46
+ config.project.packageManager, when set to npm/pnpm/yarn/bun
47
+ package.json packageManager field
48
+ lockfiles
49
+ npm fallback
50
+ ```
51
+
52
+ Lockfiles map as follows:
53
+
54
+ ```txt
55
+ pnpm-lock.yaml -> pnpm
56
+ yarn.lock -> yarn
57
+ bun.lockb / bun.lock -> bun
58
+ package-lock.json -> npm
59
+ npm-shrinkwrap.json -> npm
60
+ ```
61
+
62
+ ## Validation command discovery
63
+
64
+ If `config.project.validationCommands` is present, the agent uses those exact
65
+ commands and skips script discovery.
66
+
67
+ Otherwise, it parses `package.json.scripts` and selects up to two validation
68
+ commands by default:
69
+
70
+ ```txt
71
+ 1. first usable test script from test, test:ci, test:unit
72
+ 2. typecheck/check script when the goal mentions types, or when no test exists
73
+ 3. lint script when the goal mentions lint, or when no other validation exists
74
+ ```
75
+
76
+ The default `test` script generated by `npm init` is skipped:
77
+
78
+ ```json
79
+ {
80
+ "scripts": {
81
+ "test": "echo \"Error: no test specified\" && exit 1"
82
+ }
83
+ }
84
+ ```
85
+
86
+ ## Package-manager-specific commands
87
+
88
+ Script names are converted to command arrays:
89
+
90
+ ```txt
91
+ npm test -> npm test
92
+ npm typecheck -> npm run typecheck
93
+ pnpm test -> pnpm test
94
+ pnpm typecheck -> pnpm run typecheck
95
+ yarn test -> yarn test
96
+ yarn typecheck -> yarn run typecheck
97
+ bun test -> bun run test
98
+ bun typecheck -> bun run typecheck
99
+ ```
100
+
101
+ The shell still executes command arrays with `shell: false`; this avoids
102
+ smuggling arbitrary shell syntax through discovered commands.
103
+
104
+ ## Config examples
105
+
106
+ Force a package manager:
107
+
108
+ ```json
109
+ {
110
+ "project": {
111
+ "packageManager": "pnpm"
112
+ }
113
+ }
114
+ ```
115
+
116
+ Use exact validation commands:
117
+
118
+ ```json
119
+ {
120
+ "project": {
121
+ "validationCommands": [
122
+ "pnpm run test:unit",
123
+ "pnpm run typecheck"
124
+ ]
125
+ }
126
+ }
127
+ ```
128
+
129
+ Prefer custom test script names:
130
+
131
+ ```json
132
+ {
133
+ "project": {
134
+ "testScriptNames": ["test:unit", "test:ci", "test"],
135
+ "includeTypecheck": true,
136
+ "maxValidationCommands": 2
137
+ }
138
+ }
139
+ ```
140
+
141
+ Disable validation commands explicitly:
142
+
143
+ ```json
144
+ {
145
+ "project": {
146
+ "validationCommands": []
147
+ }
148
+ }
149
+ ```
150
+
151
+ That lets the agent read context and ask the LLM without running package scripts.
152
+
153
+ ## Permission interaction
154
+
155
+ Discovery does not bypass `PermissionService`.
156
+
157
+ Every discovered command still goes through:
158
+
159
+ ```txt
160
+ AgentAction(shell.exec)
161
+ -> PermissionService
162
+ -> ApprovalService when ask
163
+ -> ToolPolicy
164
+ -> Async shell tool
165
+ -> Observation(shell.result)
166
+ ```
167
+
168
+ P8 expands the built-in safe shell patterns to cover common validation scripts
169
+ for npm, pnpm, yarn, and bun, such as:
170
+
171
+ ```txt
172
+ npm run test*
173
+ pnpm run typecheck
174
+ yarn run lint*
175
+ bun run check
176
+ ```
177
+
178
+ Projects can still tighten this with:
179
+
180
+ ```json
181
+ {
182
+ "permissions": {
183
+ "shell": {
184
+ "inheritDefaults": false,
185
+ "allow": ["pnpm run test:unit"]
186
+ }
187
+ }
188
+ }
189
+ ```
190
+
191
+ ## After apply
192
+
193
+ When `--apply` / `write` mode successfully applies a patch, the agent reruns the
194
+ same discovered validation commands after `patch.applied`.
195
+
196
+ The completion summary includes the package manager, selected commands, and the
197
+ post-apply exit codes.
198
+
199
+ ## P43 health/check script discovery
200
+
201
+ P43 extends this beyond conventional `test` / `typecheck` / `lint` scripts.
202
+ When no usable test script exists, the agent also considers project-health script names such as:
203
+
204
+ ```txt
205
+ repo:check
206
+ check
207
+ *:check
208
+ *:doctor
209
+ *:health
210
+ *:verify
211
+ *:validate
212
+ *:ci
213
+ ```
214
+
215
+ For example, this package no longer looks like it has no validation command:
216
+
217
+ ```json
218
+ {
219
+ "scripts": {
220
+ "repo:check": "npm run desktop:build && npm run bridge:doctor"
221
+ }
222
+ }
223
+ ```
224
+
225
+ The discovered command becomes:
226
+
227
+ ```bash
228
+ npm run repo:check
229
+ ```
230
+
231
+ If a root `Cargo.toml` is detected and no package script is useful, the agent can fall back to:
232
+
233
+ ```bash
234
+ cargo check
235
+ ```
236
+
237
+ The project profile summary is included in the planning prompt so the model can reason about mixed workspaces such as npm + Rust + Tauri.
@@ -0,0 +1,156 @@
1
+ # Brass Agent project intelligence
2
+
3
+ Brass Agent tries to understand the shape of the workspace before asking the LLM for a plan.
4
+
5
+ This is separate from VS Code UI. It runs in the agent core and works from CLI, VS Code, batch runs, and any future client.
6
+
7
+ ## What it detects
8
+
9
+ The agent now probes common project markers after reading `package.json` and lockfiles:
10
+
11
+ - Node package markers: `package.json`, npm/pnpm/yarn/bun lockfiles
12
+ - Rust markers: `Cargo.toml`, `Cargo.lock`
13
+ - Tauri markers: `src-tauri/tauri.conf.json`, `apps/desktop/src-tauri/tauri.conf.json`
14
+ - Workspace markers: `apps/`, `packages/`, `bridges/`, `pnpm-workspace.yaml`, `turbo.json`, `nx.json`
15
+ - Bridge markers: `bridges/whatsmeow-bridge/Cargo.toml`, `bridges/whatsmeow-bridge/package.json`
16
+
17
+ From those markers it builds a compact profile such as:
18
+
19
+ ```text
20
+ Project profile: tauri; workspace: mixed; stacks: node, rust, tauri, desktop, bridge, monorepo
21
+ ```
22
+
23
+ The profile is included in planning and patch-repair prompts, so the model can reason about real workspaces instead of assuming a single npm package.
24
+
25
+ ## Better validation discovery
26
+
27
+ Before this change, validation discovery was mostly based on scripts like:
28
+
29
+ ```text
30
+ test
31
+ typecheck
32
+ lint
33
+ ```
34
+
35
+ Real repos often use names like:
36
+
37
+ ```text
38
+ repo:check
39
+ bridge:doctor
40
+ health
41
+ verify
42
+ validate
43
+ ci
44
+ ```
45
+
46
+ The agent now classifies these as health/check scripts and can pick them as validation commands when no usable test script exists.
47
+
48
+ Example:
49
+
50
+ ```json
51
+ {
52
+ "scripts": {
53
+ "repo:check": "npm run desktop:build && npm run bridge:doctor"
54
+ }
55
+ }
56
+ ```
57
+
58
+ Can produce:
59
+
60
+ ```text
61
+ Validation commands: npm run repo:check
62
+ ```
63
+
64
+ If a Rust root is detected and no package scripts are useful, the agent can fall back to:
65
+
66
+ ```bash
67
+ cargo check
68
+ ```
69
+
70
+ ## Permissions
71
+
72
+ The built-in safe validation allowlist now includes common health checks:
73
+
74
+ ```text
75
+ npm run *check*
76
+ npm run *doctor*
77
+ npm run *health*
78
+ npm run *verify*
79
+ npm run *validate*
80
+ npm run repo:check
81
+ cargo check
82
+ cargo test
83
+ cargo fmt --check
84
+ cargo clippy
85
+ ```
86
+
87
+ The same patterns exist for `pnpm`, `yarn`, and `bun` where applicable.
88
+
89
+ Projects can still override this with `.brass-agent.json`:
90
+
91
+ ```json
92
+ {
93
+ "permissions": {
94
+ "shell": {
95
+ "inheritDefaults": false,
96
+ "allow": ["npm run repo:check"]
97
+ }
98
+ }
99
+ }
100
+ ```
101
+
102
+ ## Recommended config for mixed repos
103
+
104
+ For a workspace with Node + Rust + Tauri, a good starting point is:
105
+
106
+ ```json
107
+ {
108
+ "language": {
109
+ "response": "es"
110
+ },
111
+ "project": {
112
+ "packageManager": "npm",
113
+ "validationCommands": ["npm run repo:check"],
114
+ "maxValidationCommands": 1
115
+ },
116
+ "permissions": {
117
+ "shell": {
118
+ "inheritDefaults": true,
119
+ "allow": [
120
+ "npm run repo:check",
121
+ "npm run bridge:doctor",
122
+ "cargo check"
123
+ ]
124
+ },
125
+ "patchApply": {
126
+ "decision": "ask",
127
+ "risk": "high",
128
+ "defaultAnswer": "reject"
129
+ }
130
+ }
131
+ }
132
+ ```
133
+
134
+ ## Why this matters
135
+
136
+ For a repo like:
137
+
138
+ ```text
139
+ apps/desktop/
140
+ bridges/whatsmeow-bridge/
141
+ Cargo.toml
142
+ package.json
143
+ package-lock.json
144
+ ```
145
+
146
+ The agent should not blindly say “no test script found”. It should understand that the repo may be validated through a repo-level check, bridge doctor, Tauri build, or Cargo check.
147
+
148
+ Project intelligence keeps that knowledge in the agent core so every surface benefits:
149
+
150
+ ```text
151
+ CLI
152
+ VS Code Chat
153
+ Code Actions
154
+ Batch runs
155
+ Run History
156
+ ```
@@ -0,0 +1,18 @@
1
+ # Brass Agent redaction
2
+
3
+ P16 adds a prompt-safety redaction pass. The agent redacts likely secrets before building LLM prompts and before summaries derived from LLM observations.
4
+
5
+ Default redaction covers common token shapes such as API keys, bearer tokens, GitHub tokens, Slack tokens, JWTs, and `key=value`-style secrets.
6
+
7
+ Project config:
8
+
9
+ ```json
10
+ {
11
+ "redaction": {
12
+ "enabled": true,
13
+ "additionalPatterns": ["ACME_[A-Z0-9]{24}"]
14
+ }
15
+ }
16
+ ```
17
+
18
+ Set `enabled` to `false` only in tightly controlled local debugging sessions.
@@ -0,0 +1,76 @@
1
+ # Agent release readiness
2
+
3
+ The current Brass Agent work is suitable for an experimental branch or alpha
4
+ release. It is not yet a stable release candidate. CI/release automation is intentionally deferred until the end; local install and doctor commands are the current readiness path.
5
+
6
+ ## Good enough to publish to a repo
7
+
8
+ The code is organized around stable boundaries:
9
+
10
+ ```txt
11
+ src/core
12
+
13
+ src/agent
14
+
15
+ brass-agent CLI protocol
16
+
17
+ VS Code extension
18
+ ```
19
+
20
+ It is reasonable to push it to a repository as an experimental feature branch,
21
+ for example:
22
+
23
+ ```txt
24
+ feat/brass-agent-alpha
25
+ ```
26
+
27
+ or tag it as:
28
+
29
+ ```txt
30
+ 0.1.0-alpha.0
31
+ ```
32
+
33
+
34
+ ## GitHub source checklist
35
+
36
+ Before the first public push, keep the repository source-first:
37
+
38
+ - commit `.gitignore`, `README.md`, `SECURITY.md`, docs, `src/`, `scripts/`, and extension source,
39
+ - do not commit `node_modules/`, root `dist/`, extension `out/`, extension `bundled/`, or generated `.vsix` files,
40
+ - keep real secrets out of `.env`; commit only `.env.example`,
41
+ - package VSIX artifacts from a release process or local packaging command, not from source control,
42
+ - use an explicit preview version such as `0.1.0-alpha.0` for the VS Code extension.
43
+
44
+ ## Stable release checklist
45
+
46
+ Before calling it stable, the project should have:
47
+
48
+ - boring local install via `npm run agent:vscode:install`
49
+ - clean local diagnostics via `npm run agent:doctor`
50
+ - clean, repeatable `npm ci && npm run build` in CI, added later
51
+ - unit tests for `src/agent/core` decisions, patch extraction, rollback, config,
52
+ redaction, batch parsing, and CI exit codes
53
+ - integration tests for CLI flows with fake LLM and temporary git workspaces
54
+ - extension compile/package CI for `extensions/vscode-brass-agent`
55
+ - `.vsix` artifact generation in GitHub Releases
56
+ - documented security model for command allowlists, approvals, redaction,
57
+ context exclusions, patch storage, and rollback
58
+ - config schema validation with helpful errors
59
+ - a public compatibility statement for Node.js, VS Code, package managers, and
60
+ model providers
61
+ - a release workflow for runtime package, CLI, and VS Code extension versioning
62
+ - marketplace readiness only after local `.vsix` installs are boring and reliable
63
+
64
+ ## Recommended versioning
65
+
66
+ Suggested path:
67
+
68
+ ```txt
69
+ 0.1.0-alpha.0 internal alpha / local VSIX
70
+ 0.1.0-alpha.1 dogfood in real repos
71
+ 0.1.0-beta.0 CI + tests + release artifacts
72
+ 0.1.0 first stable CLI + VSIX release
73
+ ```
74
+
75
+ Stable should mean the tool fails safely, can be installed repeatedly, has docs
76
+ for the happy path and recovery path, and has tests covering the risky flows.
@@ -0,0 +1,162 @@
1
+ # Agent automatic rollback safety
2
+
3
+ P14 adds automatic rollback safety for generated patches.
4
+
5
+ This is different from the manual exact rollback command from P15:
6
+
7
+ ```bash
8
+ brass-agent --rollback-patch-file ./approved.diff --yes "rollback approved patch"
9
+ ```
10
+
11
+ P14 is part of the normal generated-patch loop:
12
+
13
+ ```txt
14
+ llm.plan
15
+ -> patch.apply
16
+ -> validation commands
17
+ -> optional llm.patch repair attempts
18
+ -> if validation still fails: patch.rollback
19
+ -> optional validation after rollback
20
+ ```
21
+
22
+ ## Boundary rule
23
+
24
+ Rollback safety lives in `src/agent`, not in `src/core`:
25
+
26
+ ```txt
27
+ src/core
28
+
29
+ src/agent rollback policy / patch ledger
30
+
31
+ src/agent/cli config
32
+ ```
33
+
34
+ The core runtime still only owns effects, fibers, scopes, cancellation, and
35
+ resource safety. The agent owns policy and workspace semantics.
36
+
37
+ ## What is rolled back
38
+
39
+ When `patch.apply` succeeds, the resulting `patch.applied` observation now keeps
40
+ an internal copy of the exact unified diff that was applied. If the final
41
+ validation still fails and the repair budget is exhausted, the agent can schedule
42
+ `patch.rollback` with that same diff.
43
+
44
+ Rollback uses the existing `PatchService.rollback(...)` primitive, which runs:
45
+
46
+ ```txt
47
+ git apply --reverse --check
48
+ git apply --reverse
49
+ ```
50
+
51
+ So rollback still uses the same path checks, approval flow, policy flow, and
52
+ cancellable shell execution as normal patch application.
53
+
54
+ ## Defaults
55
+
56
+ Rollback safety is enabled by default for generated patches:
57
+
58
+ ```json
59
+ {
60
+ "rollback": {
61
+ "enabled": true,
62
+ "onFinalValidationFailure": true,
63
+ "strategy": "all",
64
+ "maxRollbackDepth": 8,
65
+ "runValidationAfterRollback": true,
66
+ "allowForSuppliedPatches": false
67
+ }
68
+ }
69
+ ```
70
+
71
+ The default strategy is `all`, meaning the agent restores the generated patch
72
+ stack in reverse order. For a more conservative single-step rollback:
73
+
74
+ ```json
75
+ {
76
+ "rollback": {
77
+ "strategy": "last"
78
+ }
79
+ }
80
+ ```
81
+
82
+ To disable automatic rollback:
83
+
84
+ ```json
85
+ {
86
+ "rollback": {
87
+ "enabled": false
88
+ }
89
+ }
90
+ ```
91
+
92
+ ## Exact supplied patches
93
+
94
+ Automatic rollback is disabled by default for exact patch-file flows:
95
+
96
+ ```bash
97
+ brass-agent --apply-patch-file ./approved.diff --yes "apply approved patch"
98
+ ```
99
+
100
+ That preserves the VS Code patch-preview guarantee:
101
+
102
+ ```txt
103
+ preview patch A
104
+ -> user approves patch A
105
+ -> brass-agent applies exactly patch A
106
+ ```
107
+
108
+ The agent will not silently generate a new patch or automatically reverse the
109
+ approved patch unless the project explicitly opts in:
110
+
111
+ ```json
112
+ {
113
+ "rollback": {
114
+ "allowForSuppliedPatches": true
115
+ }
116
+ }
117
+ ```
118
+
119
+ ## Approvals still apply
120
+
121
+ Automatic rollback schedules a `patch.rollback` action. It does not bypass
122
+ permissions or approvals:
123
+
124
+ ```txt
125
+ patch.rollback
126
+ -> PermissionService
127
+ -> ApprovalService when policy asks
128
+ -> ToolPolicy timeout/retry
129
+ -> PatchService.rollback
130
+ ```
131
+
132
+ In an interactive terminal this can prompt. In CI/non-interactive output, the
133
+ approval strategy controls whether the rollback is allowed. For example:
134
+
135
+ ```bash
136
+ brass-agent --apply --yes "fix the failing tests"
137
+ ```
138
+
139
+ allows both apply and rollback prompts. Without `--yes`, non-interactive runs
140
+ will reject approval-required rollback actions by default.
141
+
142
+ ## Validation after rollback
143
+
144
+ By default, the agent re-runs discovered validation commands after rollback:
145
+
146
+ ```json
147
+ {
148
+ "rollback": {
149
+ "runValidationAfterRollback": true
150
+ }
151
+ }
152
+ ```
153
+
154
+ Disable it when rollback should be a pure restore step:
155
+
156
+ ```json
157
+ {
158
+ "rollback": {
159
+ "runValidationAfterRollback": false
160
+ }
161
+ }
162
+ ```
@@ -0,0 +1,23 @@
1
+ # Brass Agent rollback patches
2
+
3
+ P15 adds a manual rollback path for approved unified diffs.
4
+
5
+ ```bash
6
+ brass-agent --rollback-patch-file ./approved.diff --yes "rollback approved patch"
7
+ ```
8
+
9
+ The CLI does not edit files directly. It passes the supplied diff through the same `PatchService` boundary used by normal apply mode:
10
+
11
+ ```txt
12
+ initialPatch
13
+ -> patch.rollback
14
+ -> PermissionService
15
+ -> ApprovalService
16
+ -> PatchService.rollback
17
+ -> git apply --reverse --check
18
+ -> git apply --reverse
19
+ ```
20
+
21
+ This intentionally supports exact rollback of a patch that was previously previewed/applied.
22
+
23
+ P14 builds on the same primitive for automatic rollback safety when generated patches still fail validation after repair attempts are exhausted. See [Agent automatic rollback safety](./agent-rollback-safety.md).
@@ -0,0 +1,16 @@
1
+ # Brass Agent run artifacts
2
+
3
+ P18 adds a small persistence surface for local DX and CI debugging.
4
+
5
+ ```bash
6
+ brass-agent --save-run .brass-agent/runs "fix the failing tests"
7
+ ```
8
+
9
+ The CLI writes two files:
10
+
11
+ ```txt
12
+ .brass-agent/runs/<run-id>-<goal>.json
13
+ .brass-agent/runs/<run-id>-<goal>.md
14
+ ```
15
+
16
+ The JSON artifact uses the same compacted state representation used by protocol output, so large file contents, shell output, and patches are bounded unless a future trusted mode opts into full payloads.