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.
- package/CHANGELOG.md +17 -0
- package/README.md +673 -136
- package/dist/agent/cli/main.cjs +40 -35
- package/dist/agent/cli/main.js +9 -4
- package/dist/agent/cli/main.mjs +9 -4
- package/dist/agent/index.cjs +8 -4
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +7 -3
- package/dist/agent/index.mjs +7 -3
- package/dist/chunk-2HQTDLHF.mjs +683 -0
- package/dist/chunk-36I3M4UC.mjs +370 -0
- package/dist/chunk-3AYM6WPJ.js +1629 -0
- package/dist/chunk-3LOYJFRR.cjs +300 -0
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/chunk-3Y2RIUMM.js +300 -0
- package/dist/{chunk-VEZNF5GZ.cjs → chunk-4ROBZFL6.cjs} +130 -126
- package/dist/{chunk-3QMOKAS5.js → chunk-52OB2ROS.js} +9 -5
- package/dist/chunk-52PPNNI4.cjs +416 -0
- package/dist/chunk-5EC274J5.cjs +2874 -0
- package/dist/chunk-5QC7LRZ3.js +229 -0
- package/dist/chunk-5VRJNBLZ.mjs +2874 -0
- package/dist/chunk-62AZW6UT.cjs +313 -0
- package/dist/chunk-6IXXWIUM.js +683 -0
- package/dist/chunk-74ZTY6CP.js +2871 -0
- package/dist/chunk-76YMRMH2.cjs +777 -0
- package/dist/chunk-7CMJS3QE.mjs +2871 -0
- package/dist/{chunk-4NHES7VK.mjs → chunk-7JIJOVCT.js} +27 -13
- package/dist/chunk-A2OM6NEH.mjs +194 -0
- package/dist/chunk-AGR5B2BC.cjs +683 -0
- package/dist/chunk-AVNQLJ5V.js +777 -0
- package/dist/chunk-B33ICAKP.js +313 -0
- package/dist/{chunk-ELOOF35R.mjs → chunk-B5JD23U7.mjs} +1 -1
- package/dist/chunk-BABBZK4Y.js +2024 -0
- package/dist/chunk-C3MDXTRZ.js +354 -0
- package/dist/chunk-CIZFIMK5.js +2193 -0
- package/dist/chunk-CZIVE6NT.cjs +354 -0
- package/dist/chunk-DNFJLJMW.mjs +354 -0
- package/dist/chunk-DNFO2EIZ.mjs +777 -0
- package/dist/chunk-EJ6BPYVR.mjs +416 -0
- package/dist/chunk-ENKODRU3.cjs +2193 -0
- package/dist/chunk-EOC4UHBS.mjs +229 -0
- package/dist/{chunk-BMH5AV44.js → chunk-FH2X7BVP.js} +756 -440
- package/dist/{chunk-PPUXIH5R.js → chunk-FHQGHPMO.mjs} +27 -13
- package/dist/{chunk-TGIFUAK4.cjs → chunk-GLE2WY7Z.cjs} +951 -635
- package/dist/{chunk-BDF4AMWX.mjs → chunk-GYM3LLGS.mjs} +756 -440
- package/dist/chunk-HLWLMW2F.mjs +2024 -0
- package/dist/chunk-JF5WGYJJ.cjs +194 -0
- package/dist/chunk-KH4SYAOS.mjs +1629 -0
- package/dist/chunk-KN32XNTH.mjs +313 -0
- package/dist/chunk-KQLYONSE.cjs +2871 -0
- package/dist/{chunk-STVLQ3XD.cjs → chunk-KZJQ723N.cjs} +92 -78
- package/dist/chunk-L2SYFEBS.js +194 -0
- package/dist/chunk-L6VB5N7Q.cjs +104 -0
- package/dist/{chunk-K6M7MDZ4.mjs → chunk-MBEJI5HF.mjs} +9 -5
- package/dist/chunk-MIIYDLGM.js +2874 -0
- package/dist/chunk-MOO4L7F4.mjs +104 -0
- package/dist/chunk-MT3OWDPC.mjs +2193 -0
- package/dist/chunk-MVGUEJ5Z.cjs +370 -0
- package/dist/chunk-OBGZSXTJ.cjs +10 -0
- package/dist/chunk-PD4EJTQC.cjs +229 -0
- package/dist/chunk-PWC3RBQE.mjs +300 -0
- package/dist/chunk-Q2I37RP3.cjs +1629 -0
- package/dist/chunk-RKGKFN2A.js +416 -0
- package/dist/{chunk-R3R2FVLG.cjs → chunk-SA6HUJVI.cjs} +5 -5
- package/dist/chunk-TRM4JUZQ.js +104 -0
- package/dist/chunk-UB4B6OFY.js +370 -0
- package/dist/{chunk-TO7IKXYT.js → chunk-UCUBNWM2.js} +1 -1
- package/dist/chunk-VN44DYYT.cjs +2024 -0
- package/dist/chunk-Y6FXYEAI.mjs +10 -0
- package/dist/client-CZHU674n.d.ts +820 -0
- package/dist/core/index.cjs +198 -4
- package/dist/core/index.d.ts +311 -212
- package/dist/core/index.js +237 -43
- package/dist/core/index.mjs +237 -43
- package/dist/{effect-CMOQKX8y.d.ts → effect-DIUHZ9IN.d.ts} +195 -1
- package/dist/effectRunner-CFLC32IK.cjs +8 -0
- package/dist/effectRunner-L4S7IPT3.js +8 -0
- package/dist/effectRunner-NNGG75QA.mjs +8 -0
- package/dist/http/index.cjs +1227 -2971
- package/dist/http/index.d.ts +826 -280
- package/dist/http/index.js +1089 -2833
- package/dist/http/index.mjs +1089 -2833
- package/dist/http/testing.cjs +161 -0
- package/dist/http/testing.d.ts +43 -0
- package/dist/http/testing.js +161 -0
- package/dist/http/testing.mjs +161 -0
- package/dist/index.cjs +486 -250
- package/dist/index.d.ts +87 -95
- package/dist/index.js +391 -155
- package/dist/index.mjs +391 -155
- package/dist/observability/index.cjs +162 -0
- package/dist/observability/index.d.ts +152 -0
- package/dist/observability/index.js +162 -0
- package/dist/observability/index.mjs +162 -0
- package/dist/perf/cli.cjs +401 -0
- package/dist/perf/cli.d.ts +1 -0
- package/dist/perf/cli.js +401 -0
- package/dist/perf/cli.mjs +401 -0
- package/dist/perf/index.cjs +141 -0
- package/dist/perf/index.d.ts +483 -0
- package/dist/perf/index.js +141 -0
- package/dist/perf/index.mjs +141 -0
- package/dist/schedule-CK3Ml_7p.d.ts +259 -0
- package/dist/schema/index.cjs +29 -0
- package/dist/schema/index.d.ts +179 -0
- package/dist/schema/index.js +29 -0
- package/dist/schema/index.mjs +29 -0
- package/dist/server-GJPg8ZSG.d.ts +675 -0
- package/dist/{stream-FQm9h4Mg.d.ts → stream-B4oK9JFP.d.ts} +1 -1
- package/dist/tracer-Hwt1cl7h.d.ts +189 -0
- package/dist/tracing-DqbTKGcf.d.ts +148 -0
- package/docs/ARCHITECTURE.md +292 -0
- package/docs/README.md +63 -0
- package/docs/adr/0001-ai-context-pack.md +32 -0
- package/docs/agent-apply-mode.md +104 -0
- package/docs/agent-approvals.md +110 -0
- package/docs/agent-batch.md +185 -0
- package/docs/agent-boundaries.md +112 -0
- package/docs/agent-chat-sessions.md +160 -0
- package/docs/agent-ci.md +17 -0
- package/docs/agent-cli.md +405 -0
- package/docs/agent-config.md +480 -0
- package/docs/agent-context-discovery.md +159 -0
- package/docs/agent-copilot-like-dx.md +126 -0
- package/docs/agent-declarative-optimized-planning.md +138 -0
- package/docs/agent-dx.md +224 -0
- package/docs/agent-env-files.md +126 -0
- package/docs/agent-follow-up-context.md +43 -0
- package/docs/agent-global-usage.md +180 -0
- package/docs/agent-init.md +109 -0
- package/docs/agent-install-and-configure.md +516 -0
- package/docs/agent-language-workspace-ux.md +99 -0
- package/docs/agent-llm-adapters.md +123 -0
- package/docs/agent-local-install.md +190 -0
- package/docs/agent-local-tests.md +51 -0
- package/docs/agent-observability.md +155 -0
- package/docs/agent-patch-quality-loop.md +162 -0
- package/docs/agent-presets.md +22 -0
- package/docs/agent-project-commands.md +237 -0
- package/docs/agent-project-intelligence.md +156 -0
- package/docs/agent-redaction.md +18 -0
- package/docs/agent-release-readiness.md +76 -0
- package/docs/agent-rollback-safety.md +162 -0
- package/docs/agent-rollback.md +23 -0
- package/docs/agent-run-artifacts.md +16 -0
- package/docs/agent-vscode-auto-discovery.md +137 -0
- package/docs/agent-vscode-batch-runner.md +100 -0
- package/docs/agent-vscode-chat-layout.md +90 -0
- package/docs/agent-vscode-clean-install.md +147 -0
- package/docs/agent-vscode-code-actions.md +70 -0
- package/docs/agent-vscode-diff-preview.md +45 -0
- package/docs/agent-vscode-inline-assist.md +56 -0
- package/docs/agent-vscode-install.md +186 -0
- package/docs/agent-vscode-model-setup.md +97 -0
- package/docs/agent-vscode-patch-preview.md +92 -0
- package/docs/agent-vscode-problems.md +79 -0
- package/docs/agent-vscode-project-dashboard.md +106 -0
- package/docs/agent-vscode-run-history.md +92 -0
- package/docs/agent-vscode-ux.md +73 -0
- package/docs/ai/INVARIANTS.md +84 -0
- package/docs/ai/PROJECT_MAP.md +338 -0
- package/docs/ai/PUBLIC_API.md +336 -0
- package/docs/ai/VALIDATION_MATRIX.md +67 -0
- package/docs/api-polish.md +37 -0
- package/docs/cancellation.md +162 -0
- package/docs/coverage.md +46 -0
- package/docs/getting-started.md +159 -0
- package/docs/guides/README.md +40 -0
- package/docs/guides/circuit-breaker.md +89 -0
- package/docs/guides/error-handling.md +91 -0
- package/docs/guides/getting-started.md +107 -0
- package/docs/guides/layers.md +189 -0
- package/docs/guides/metrics.md +101 -0
- package/docs/guides/resource-management.md +141 -0
- package/docs/guides/retry.md +215 -0
- package/docs/guides/semaphore.md +66 -0
- package/docs/guides/streams.md +117 -0
- package/docs/guides/supervisors.md +98 -0
- package/docs/guides/testing.md +162 -0
- package/docs/guides/tracing.md +71 -0
- package/docs/http-recipes.md +399 -0
- package/docs/http.md +749 -0
- package/docs/modules.md +285 -0
- package/docs/observability-collector-smoke.md +31 -0
- package/docs/observability-framework-examples.md +98 -0
- package/docs/observability.md +542 -0
- package/docs/otel-collector-smoke.yaml +27 -0
- package/docs/performance-profiler.md +199 -0
- package/docs/production-readiness.md +73 -0
- package/docs/recipes/README.md +12 -0
- package/docs/recipes/http-server.md +45 -0
- package/docs/recipes/layers.md +44 -0
- package/docs/recipes/performance.md +47 -0
- package/docs/recipes/runtime.md +41 -0
- package/docs/recipes/testing.md +41 -0
- package/docs/release.md +53 -0
- package/docs/wasm-bounded-queues.md +44 -0
- package/docs/wasm-engine-observability-benchmarks.md +85 -0
- package/docs/wasm-fiber-engine.md +117 -0
- package/docs/wasm-scheduler-state-machine.md +122 -0
- package/docs/wasm-stream-chunks.md +54 -0
- package/package.json +48 -2
- package/dist/chunk-AR22SXML.js +0 -1043
- package/dist/chunk-BDYEENHT.js +0 -224
- package/dist/chunk-JFPU5GQI.mjs +0 -1043
- package/dist/chunk-MS34J5LY.cjs +0 -224
- package/dist/chunk-UMAZLXAB.mjs +0 -224
- package/dist/chunk-XPZNXSVN.cjs +0 -1043
- package/dist/tracing-DNT9jEbr.d.ts +0 -106
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
# Agent configuration and policy files
|
|
2
|
+
|
|
3
|
+
> For the end-to-end setup flow, see [Brass Agent install and configure](./agent-install-and-configure.md).
|
|
4
|
+
|
|
5
|
+
P7 adds a small JSON configuration file for the experimental `brass-agent` CLI.
|
|
6
|
+
The goal is to keep policy out of hardcoded TypeScript while preserving the
|
|
7
|
+
runtime boundary:
|
|
8
|
+
|
|
9
|
+
```txt
|
|
10
|
+
src/core
|
|
11
|
+
↑
|
|
12
|
+
src/agent policy/config
|
|
13
|
+
↑
|
|
14
|
+
src/agent/cli loads .brass-agent.json
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`src/core` still does not know that the agent exists. The CLI loads config as a
|
|
18
|
+
Node setup step, then passes the resolved policy into `AgentEnv`.
|
|
19
|
+
|
|
20
|
+
## Discovery
|
|
21
|
+
|
|
22
|
+
By default, the CLI searches upward from `--cwd` for either file:
|
|
23
|
+
|
|
24
|
+
```txt
|
|
25
|
+
.brass-agent.json
|
|
26
|
+
brass-agent.config.json
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
You can force a specific file:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
brass-agent --config ./agent.policy.json "fix the failing tests"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Or disable config loading entirely:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
brass-agent --no-config "fix the failing tests"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Precedence
|
|
42
|
+
|
|
43
|
+
Configuration is intentionally lower precedence than explicit execution knobs:
|
|
44
|
+
|
|
45
|
+
```txt
|
|
46
|
+
CLI flags > environment variables > .brass-agent.json > built-in defaults
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Examples:
|
|
50
|
+
|
|
51
|
+
```txt
|
|
52
|
+
--mode write beats config.mode
|
|
53
|
+
--approval deny beats config.approval
|
|
54
|
+
BRASS_LLM_PROVIDER beats config.llm.provider
|
|
55
|
+
BRASS_LLM_MODEL beats config.llm.model
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Minimal config
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"mode": "propose",
|
|
63
|
+
"approval": "auto",
|
|
64
|
+
"llm": {
|
|
65
|
+
"provider": "google",
|
|
66
|
+
"model": "gemini-2.5-flash",
|
|
67
|
+
"apiKeyEnv": "GEMINI_API_KEY"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Do not store API keys in the config file. Use `apiKeyEnv` and keep the secret in
|
|
73
|
+
the environment.
|
|
74
|
+
|
|
75
|
+
## LLM config
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"llm": {
|
|
80
|
+
"provider": "google",
|
|
81
|
+
"model": "gemini-2.5-flash",
|
|
82
|
+
"apiKeyEnv": "GEMINI_API_KEY",
|
|
83
|
+
"temperature": 0.2,
|
|
84
|
+
"maxOutputTokens": 4096
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
OpenAI-compatible example:
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"llm": {
|
|
94
|
+
"provider": "openai-compatible",
|
|
95
|
+
"endpoint": "https://api.openai.com/v1/chat/completions",
|
|
96
|
+
"model": "gpt-4.1",
|
|
97
|
+
"apiKeyEnv": "BRASS_LLM_API_KEY"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Offline/fake example:
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"llm": {
|
|
107
|
+
"provider": "fake",
|
|
108
|
+
"fakeResponse": "Fake plan from config"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Project command discovery
|
|
114
|
+
|
|
115
|
+
P8 adds project-aware command discovery. The agent reads `package.json`, checks
|
|
116
|
+
common lockfiles, infers npm/pnpm/yarn/bun, and selects validation commands from
|
|
117
|
+
scripts instead of assuming `npm test`.
|
|
118
|
+
|
|
119
|
+
Basic example:
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"project": {
|
|
124
|
+
"packageManager": "auto",
|
|
125
|
+
"testScriptNames": ["test", "test:ci", "test:unit"],
|
|
126
|
+
"includeTypecheck": true,
|
|
127
|
+
"maxValidationCommands": 2
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Exact validation commands override discovery:
|
|
133
|
+
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"project": {
|
|
137
|
+
"validationCommands": [
|
|
138
|
+
"pnpm run test:unit",
|
|
139
|
+
"pnpm run typecheck"
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Use an empty array to disable shell validation:
|
|
146
|
+
|
|
147
|
+
```json
|
|
148
|
+
{
|
|
149
|
+
"project": {
|
|
150
|
+
"validationCommands": []
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Supported `project.packageManager` values are `auto`, `npm`, `pnpm`,
|
|
156
|
+
`yarn`, and `bun`.
|
|
157
|
+
|
|
158
|
+
See [Agent project command discovery](./agent-project-commands.md).
|
|
159
|
+
|
|
160
|
+
## Context discovery
|
|
161
|
+
|
|
162
|
+
P12 adds a bounded context discovery pass before planning. It reads direct files
|
|
163
|
+
mentioned by validation output, searches likely identifiers, and reads a small
|
|
164
|
+
number of matched files before calling the LLM.
|
|
165
|
+
|
|
166
|
+
```json
|
|
167
|
+
{
|
|
168
|
+
"context": {
|
|
169
|
+
"enabled": true,
|
|
170
|
+
"maxSearchQueries": 3,
|
|
171
|
+
"maxFiles": 4,
|
|
172
|
+
"maxSearchResults": 40,
|
|
173
|
+
"globs": ["*.ts", "*.tsx", "*.json"]
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Disable it when you want the old minimal context behavior:
|
|
179
|
+
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"context": {
|
|
183
|
+
"enabled": false
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
See [Agent context discovery](./agent-context-discovery.md).
|
|
189
|
+
|
|
190
|
+
## Patch quality loop
|
|
191
|
+
|
|
192
|
+
P13 adds a bounded repair loop for patches generated by the agent. If a generated patch fails to apply, or if validation still fails after `patch.applied`, the agent can ask the LLM for an incremental repair patch.
|
|
193
|
+
|
|
194
|
+
```json
|
|
195
|
+
{
|
|
196
|
+
"patchQuality": {
|
|
197
|
+
"enabled": true,
|
|
198
|
+
"maxRepairAttempts": 1
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Set `maxRepairAttempts` to `0` or `enabled` to `false` to keep one-shot apply behavior. Repairs are disabled for exact patch-file runs such as `--apply-patch-file` so the VS Code preview flow still applies exactly the patch the user approved.
|
|
204
|
+
|
|
205
|
+
See [Agent patch quality loop](./agent-patch-quality-loop.md).
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
## Automatic rollback safety
|
|
209
|
+
|
|
210
|
+
P14 adds automatic rollback safety for generated patches. After validation fails
|
|
211
|
+
and the patch quality repair budget is exhausted, the agent can reverse-apply
|
|
212
|
+
generated patches through `PatchService.rollback`.
|
|
213
|
+
|
|
214
|
+
```json
|
|
215
|
+
{
|
|
216
|
+
"rollback": {
|
|
217
|
+
"enabled": true,
|
|
218
|
+
"onFinalValidationFailure": true,
|
|
219
|
+
"strategy": "all",
|
|
220
|
+
"maxRollbackDepth": 8,
|
|
221
|
+
"runValidationAfterRollback": true,
|
|
222
|
+
"allowForSuppliedPatches": false
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
`strategy` can be `last` or `all`. Exact patch-file flows such as
|
|
228
|
+
`--apply-patch-file` are protected by default, so VS Code preview still applies
|
|
229
|
+
exactly the patch the user approved.
|
|
230
|
+
|
|
231
|
+
See [Agent automatic rollback safety](./agent-rollback-safety.md).
|
|
232
|
+
|
|
233
|
+
## Batch runs
|
|
234
|
+
|
|
235
|
+
P21 adds optional default batch goals. The CLI uses `config.batch.goals` only when no explicit goal, `--preset`, `--patch-file`, or `--batch-file` is provided.
|
|
236
|
+
|
|
237
|
+
```json
|
|
238
|
+
{
|
|
239
|
+
"batch": {
|
|
240
|
+
"stopOnFailure": true,
|
|
241
|
+
"goals": [
|
|
242
|
+
{ "preset": "inspect" },
|
|
243
|
+
{ "preset": "typecheck" },
|
|
244
|
+
{ "preset": "lint" }
|
|
245
|
+
]
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
See [Agent batch runs](./agent-batch.md).
|
|
251
|
+
|
|
252
|
+
## Permission config
|
|
253
|
+
|
|
254
|
+
Shell commands are matched against the command array joined with spaces. Patterns
|
|
255
|
+
support `*` as a simple wildcard.
|
|
256
|
+
|
|
257
|
+
Built-in safe validation commands remain allowed by default for npm, pnpm, yarn,
|
|
258
|
+
and bun, along with read-only git commands. Examples include:
|
|
259
|
+
|
|
260
|
+
```txt
|
|
261
|
+
npm test
|
|
262
|
+
npm run test*
|
|
263
|
+
npm run typecheck
|
|
264
|
+
pnpm test
|
|
265
|
+
pnpm run test*
|
|
266
|
+
yarn run lint*
|
|
267
|
+
bun run check
|
|
268
|
+
git status
|
|
269
|
+
git diff
|
|
270
|
+
git log
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
You can extend them:
|
|
274
|
+
|
|
275
|
+
```json
|
|
276
|
+
{
|
|
277
|
+
"permissions": {
|
|
278
|
+
"shell": {
|
|
279
|
+
"allow": [
|
|
280
|
+
"npm run typecheck",
|
|
281
|
+
"npm run lint",
|
|
282
|
+
"pnpm test *"
|
|
283
|
+
],
|
|
284
|
+
"ask": [
|
|
285
|
+
{
|
|
286
|
+
"pattern": "npm run build",
|
|
287
|
+
"reason": "Build can be slow; confirm before running it.",
|
|
288
|
+
"risk": "medium",
|
|
289
|
+
"defaultAnswer": "approve"
|
|
290
|
+
}
|
|
291
|
+
],
|
|
292
|
+
"deny": [
|
|
293
|
+
"rm *",
|
|
294
|
+
"git push *"
|
|
295
|
+
]
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
For a strict allowlist, disable inherited defaults:
|
|
302
|
+
|
|
303
|
+
```json
|
|
304
|
+
{
|
|
305
|
+
"permissions": {
|
|
306
|
+
"shell": {
|
|
307
|
+
"inheritDefaults": false,
|
|
308
|
+
"allow": ["npm test"]
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
Deny rules win over ask rules, and ask rules win over allow rules.
|
|
315
|
+
|
|
316
|
+
## Patch apply policy
|
|
317
|
+
|
|
318
|
+
`patch.apply` is still denied in `read-only` and `propose` modes. In `write` and
|
|
319
|
+
`autonomous` modes, you can configure the decision:
|
|
320
|
+
|
|
321
|
+
```json
|
|
322
|
+
{
|
|
323
|
+
"permissions": {
|
|
324
|
+
"patchApply": {
|
|
325
|
+
"decision": "ask",
|
|
326
|
+
"reason": "Apply the generated diff to the workspace.",
|
|
327
|
+
"risk": "high",
|
|
328
|
+
"defaultAnswer": "reject"
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
Short form:
|
|
335
|
+
|
|
336
|
+
```json
|
|
337
|
+
{
|
|
338
|
+
"permissions": {
|
|
339
|
+
"patchApply": "ask"
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
Supported values are `allow`, `ask`, and `deny`.
|
|
345
|
+
|
|
346
|
+
## Tool policy overrides
|
|
347
|
+
|
|
348
|
+
Tool policies let a project tune timeouts and retries without changing code.
|
|
349
|
+
Keys are `AgentAction.type` strings:
|
|
350
|
+
|
|
351
|
+
```json
|
|
352
|
+
{
|
|
353
|
+
"tools": {
|
|
354
|
+
"fs.readFile": {
|
|
355
|
+
"timeoutMs": 10000,
|
|
356
|
+
"retries": 1
|
|
357
|
+
},
|
|
358
|
+
"fs.exists": {
|
|
359
|
+
"timeoutMs": 5000,
|
|
360
|
+
"retries": 1
|
|
361
|
+
},
|
|
362
|
+
"llm.complete": {
|
|
363
|
+
"timeoutMs": 90000,
|
|
364
|
+
"retries": 3
|
|
365
|
+
},
|
|
366
|
+
"shell.exec": {
|
|
367
|
+
"timeoutMs": 180000,
|
|
368
|
+
"retries": 0
|
|
369
|
+
},
|
|
370
|
+
"patch.apply": {
|
|
371
|
+
"timeoutMs": 30000,
|
|
372
|
+
"retries": 0
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
Retryability is still controlled in code by error class. Config can tune counts
|
|
379
|
+
and timeouts, but it cannot make unsafe errors retryable.
|
|
380
|
+
|
|
381
|
+
## Full example
|
|
382
|
+
|
|
383
|
+
```json
|
|
384
|
+
{
|
|
385
|
+
"mode": "propose",
|
|
386
|
+
"approval": "auto",
|
|
387
|
+
"llm": {
|
|
388
|
+
"provider": "google",
|
|
389
|
+
"model": "gemini-2.5-flash",
|
|
390
|
+
"apiKeyEnv": "GEMINI_API_KEY",
|
|
391
|
+
"temperature": 0.2,
|
|
392
|
+
"maxOutputTokens": 4096
|
|
393
|
+
},
|
|
394
|
+
"project": {
|
|
395
|
+
"packageManager": "auto",
|
|
396
|
+
"testScriptNames": ["test", "test:ci", "test:unit"],
|
|
397
|
+
"includeTypecheck": true,
|
|
398
|
+
"maxValidationCommands": 2
|
|
399
|
+
},
|
|
400
|
+
"patchQuality": {
|
|
401
|
+
"enabled": true,
|
|
402
|
+
"maxRepairAttempts": 1
|
|
403
|
+
},
|
|
404
|
+
"rollback": {
|
|
405
|
+
"enabled": true,
|
|
406
|
+
"strategy": "all",
|
|
407
|
+
"maxRollbackDepth": 8
|
|
408
|
+
},
|
|
409
|
+
"permissions": {
|
|
410
|
+
"shell": {
|
|
411
|
+
"inheritDefaults": true,
|
|
412
|
+
"allow": [
|
|
413
|
+
"npm run typecheck",
|
|
414
|
+
"npm run lint"
|
|
415
|
+
],
|
|
416
|
+
"ask": [
|
|
417
|
+
{
|
|
418
|
+
"pattern": "npm run build",
|
|
419
|
+
"reason": "Build may take a while.",
|
|
420
|
+
"risk": "medium",
|
|
421
|
+
"defaultAnswer": "approve"
|
|
422
|
+
}
|
|
423
|
+
],
|
|
424
|
+
"deny": [
|
|
425
|
+
"git push *",
|
|
426
|
+
"rm *"
|
|
427
|
+
]
|
|
428
|
+
},
|
|
429
|
+
"patchApply": {
|
|
430
|
+
"decision": "ask",
|
|
431
|
+
"risk": "high",
|
|
432
|
+
"defaultAnswer": "reject"
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
"tools": {
|
|
436
|
+
"llm.complete": {
|
|
437
|
+
"timeoutMs": 90000,
|
|
438
|
+
"retries": 2
|
|
439
|
+
},
|
|
440
|
+
"shell.exec": {
|
|
441
|
+
"timeoutMs": 180000,
|
|
442
|
+
"retries": 0
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
## Context exclude globs
|
|
450
|
+
|
|
451
|
+
```json
|
|
452
|
+
{
|
|
453
|
+
"context": {
|
|
454
|
+
"excludeGlobs": [".env*", "secrets/**", "*.pem", "*.key"]
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
These globs reduce what context discovery reads or searches before prompting the LLM.
|
|
460
|
+
|
|
461
|
+
## Language config
|
|
462
|
+
|
|
463
|
+
Natural-language responses can match the user's prompt automatically, or be fixed per workspace:
|
|
464
|
+
|
|
465
|
+
```json
|
|
466
|
+
{
|
|
467
|
+
"language": {
|
|
468
|
+
"response": "es"
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
Supported values are `auto`, `match-user`, `en`, `es`, `pt`, `fr`, `de`, `it`, and `custom`.
|
|
474
|
+
Use `custom` with `language.custom` for a human-readable language name.
|
|
475
|
+
|
|
476
|
+
The language policy affects explanations and summaries only. Code, identifiers,
|
|
477
|
+
file paths, shell commands, logs, and unified diffs remain unchanged.
|
|
478
|
+
|
|
479
|
+
The VS Code extension can create or update this section through **Brass Agent:
|
|
480
|
+
Configure Workspace** or `/workspace` in the Chat view.
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# Agent context discovery
|
|
2
|
+
|
|
3
|
+
P12 adds a small context discovery pass before the first LLM planning call.
|
|
4
|
+
The goal is to give the model the files that are most likely connected to the
|
|
5
|
+
failure, instead of sending only `package.json` and validation output.
|
|
6
|
+
|
|
7
|
+
The boundary remains unchanged:
|
|
8
|
+
|
|
9
|
+
```txt
|
|
10
|
+
src/core
|
|
11
|
+
↑
|
|
12
|
+
src/agent context discovery
|
|
13
|
+
↑
|
|
14
|
+
src/agent/cli config loading
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Context discovery is pure agent logic. It inspects existing observations and
|
|
18
|
+
chooses normal `AgentAction` values:
|
|
19
|
+
|
|
20
|
+
```txt
|
|
21
|
+
fs.searchText
|
|
22
|
+
fs.readFile
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
It does not bypass `PermissionService`, does not run shell commands directly,
|
|
26
|
+
and does not require changes to the runtime core.
|
|
27
|
+
|
|
28
|
+
## Flow
|
|
29
|
+
|
|
30
|
+
Before `llm.complete`, the agent now does this:
|
|
31
|
+
|
|
32
|
+
```txt
|
|
33
|
+
read package.json
|
|
34
|
+
check package-manager lockfiles
|
|
35
|
+
discover validation commands
|
|
36
|
+
run allowed validation commands
|
|
37
|
+
extract path and identifier signals from goal + validation output
|
|
38
|
+
read direct files mentioned by failures
|
|
39
|
+
search likely identifiers with rg through fs.searchText
|
|
40
|
+
read top matched files
|
|
41
|
+
ask LLM with command + context discovery summary
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Examples of signals:
|
|
45
|
+
|
|
46
|
+
```txt
|
|
47
|
+
src/user/UserService.ts:12:3
|
|
48
|
+
Cannot find name AuthClient
|
|
49
|
+
Expected getUserById to return ...
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
From those, the agent may read `src/user/UserService.ts`, search for
|
|
53
|
+
`AuthClient`, and read the most relevant matches.
|
|
54
|
+
|
|
55
|
+
## Defaults
|
|
56
|
+
|
|
57
|
+
```txt
|
|
58
|
+
enabled: true
|
|
59
|
+
maxSearchQueries: 3
|
|
60
|
+
maxFiles: 4
|
|
61
|
+
maxSearchResults: 40
|
|
62
|
+
globs: TypeScript, JavaScript, JSON, Markdown, YAML files
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The step budget was raised to leave room for the extra discovery work.
|
|
66
|
+
|
|
67
|
+
## Config
|
|
68
|
+
|
|
69
|
+
You can tune or disable context discovery from `.brass-agent.json`:
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"context": {
|
|
74
|
+
"enabled": true,
|
|
75
|
+
"maxSearchQueries": 3,
|
|
76
|
+
"maxFiles": 4,
|
|
77
|
+
"maxSearchResults": 40,
|
|
78
|
+
"globs": ["*.ts", "*.tsx", "*.json"]
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Disable it entirely:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"context": {
|
|
88
|
+
"enabled": false
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Use smaller budgets for very large repositories:
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"context": {
|
|
98
|
+
"maxSearchQueries": 1,
|
|
99
|
+
"maxFiles": 2
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Search semantics
|
|
105
|
+
|
|
106
|
+
The Node filesystem adapter uses ripgrep in fixed-string mode:
|
|
107
|
+
|
|
108
|
+
```txt
|
|
109
|
+
rg --fixed-strings --line-number --no-heading --max-count 5 ...
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
This keeps generated searches safe and predictable. Query strings are derived
|
|
113
|
+
from simple path and identifier signals; they are not treated as regexes.
|
|
114
|
+
|
|
115
|
+
## Prompting
|
|
116
|
+
|
|
117
|
+
The planning prompt now includes a context summary alongside the project command
|
|
118
|
+
summary:
|
|
119
|
+
|
|
120
|
+
```txt
|
|
121
|
+
Project commands: ...
|
|
122
|
+
Context discovery: searched queries: ...
|
|
123
|
+
Discovered paths: ...
|
|
124
|
+
Read context files: ...
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Large observations are compacted before prompting. Search results are capped in
|
|
128
|
+
prompt context so a broad query cannot flood the model.
|
|
129
|
+
|
|
130
|
+
## Safety
|
|
131
|
+
|
|
132
|
+
Context discovery is intentionally bounded:
|
|
133
|
+
|
|
134
|
+
```txt
|
|
135
|
+
- fixed number of searches
|
|
136
|
+
- fixed number of files read
|
|
137
|
+
- ignored generated/vendor directories
|
|
138
|
+
- workspace-relative paths only
|
|
139
|
+
- no direct shell execution from discovery logic
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`fs.searchText` is still interpreted by the configured `FileSystem` service, and
|
|
143
|
+
`fs.readFile` still goes through the same workspace path validation used by other
|
|
144
|
+
agent actions.
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
## Excluding sensitive paths
|
|
148
|
+
|
|
149
|
+
P17 adds `context.excludeGlobs`. Excluded paths are filtered from direct error-path reads and are also passed to `rg` as negative globs.
|
|
150
|
+
|
|
151
|
+
```json
|
|
152
|
+
{
|
|
153
|
+
"context": {
|
|
154
|
+
"excludeGlobs": [".env*", "secrets/**", "*.pem", "*.key"]
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
This is a context-discovery guard. It does not replace redaction, shell permissions, or workspace path validation.
|