brass-runtime 1.16.0 → 1.17.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.
- package/CHANGELOG.md +17 -0
- package/README.md +287 -23
- package/dist/agent/cli/main.cjs +38 -38
- package/dist/agent/cli/main.js +6 -6
- package/dist/agent/cli/main.mjs +6 -6
- package/dist/agent/index.cjs +7 -7
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +6 -6
- package/dist/agent/index.mjs +6 -6
- package/dist/chunk-2HQTDLHF.mjs +683 -0
- package/dist/chunk-36I3M4UC.mjs +370 -0
- package/dist/{chunk-QY5FKYEQ.js → chunk-3AYM6WPJ.js} +570 -51
- package/dist/chunk-3LOYJFRR.cjs +300 -0
- package/dist/chunk-3Y2RIUMM.js +300 -0
- package/dist/{chunk-7XOPAB5Q.js → chunk-4P2HHGAX.mjs} +83 -5
- package/dist/{chunk-N6VHMOWB.cjs → chunk-4ROBZFL6.cjs} +128 -128
- package/dist/{chunk-NC5SDRYE.js → chunk-52OB2ROS.js} +4 -4
- package/dist/{chunk-JX3LZQJH.cjs → chunk-52PPNNI4.cjs} +82 -20
- package/dist/{chunk-5YOQOXEQ.cjs → chunk-5EC274J5.cjs} +676 -293
- package/dist/chunk-5QC7LRZ3.js +229 -0
- package/dist/{chunk-7TL2LHQJ.js → chunk-5VRJNBLZ.mjs} +524 -141
- package/dist/chunk-62AZW6UT.cjs +313 -0
- package/dist/chunk-6IXXWIUM.js +683 -0
- package/dist/chunk-6RY2FFN4.mjs +2024 -0
- package/dist/chunk-74ZTY6CP.js +2871 -0
- package/dist/chunk-7CMJS3QE.mjs +2871 -0
- package/dist/{chunk-2WC63LJK.mjs → chunk-7JIJOVCT.js} +20 -10
- package/dist/chunk-7X3K5RMS.js +2024 -0
- package/dist/chunk-7ZPEZ57L.cjs +2024 -0
- package/dist/{chunk-FM4W4QPL.js → chunk-A2OM6NEH.mjs} +5 -4
- package/dist/chunk-AGR5B2BC.cjs +683 -0
- package/dist/chunk-B33ICAKP.js +313 -0
- package/dist/{chunk-J3H54ZRV.mjs → chunk-B5JD23U7.mjs} +1 -1
- package/dist/{chunk-F5EUMJL7.mjs → chunk-BKK77SBA.js} +83 -5
- package/dist/{chunk-U5KWK3PX.mjs → chunk-C3MDXTRZ.js} +11 -0
- package/dist/{chunk-SPUEME2B.cjs → chunk-CZIVE6NT.cjs} +12 -1
- package/dist/{chunk-TDVMADDN.js → chunk-DNFJLJMW.mjs} +11 -0
- package/dist/{chunk-XDZOO4L5.js → chunk-EJ6BPYVR.mjs} +79 -17
- package/dist/chunk-EOC4UHBS.mjs +229 -0
- package/dist/chunk-F6XWZQY4.cjs +777 -0
- package/dist/{chunk-7LVI2GIN.js → chunk-FH2X7BVP.js} +507 -72
- package/dist/{chunk-OOGJ73B6.js → chunk-FHQGHPMO.mjs} +20 -10
- package/dist/{chunk-WQ5QNU5R.cjs → chunk-GLE2WY7Z.cjs} +652 -217
- package/dist/{chunk-G6IQOE4P.mjs → chunk-GYM3LLGS.mjs} +507 -72
- package/dist/{chunk-TVN5I4U6.cjs → chunk-JF5WGYJJ.cjs} +25 -24
- package/dist/{chunk-CY33PGEX.mjs → chunk-KH4SYAOS.mjs} +570 -51
- package/dist/chunk-KN32XNTH.mjs +313 -0
- package/dist/chunk-KQLYONSE.cjs +2871 -0
- package/dist/{chunk-7HUOJA4W.cjs → chunk-KZJQ723N.cjs} +90 -80
- package/dist/{chunk-CCKHV5BT.mjs → chunk-L2SYFEBS.js} +5 -4
- package/dist/{chunk-IJT6RRQ5.cjs → chunk-L6VB5N7Q.cjs} +20 -9
- package/dist/{chunk-ZGLD4TVZ.mjs → chunk-MBEJI5HF.mjs} +4 -4
- package/dist/{chunk-PRWCB3QL.mjs → chunk-MIIYDLGM.js} +524 -141
- package/dist/{chunk-H55LI6WY.js → chunk-MOO4L7F4.mjs} +15 -4
- package/dist/chunk-MVGUEJ5Z.cjs +370 -0
- package/dist/chunk-PD4EJTQC.cjs +229 -0
- package/dist/chunk-PWC3RBQE.mjs +300 -0
- package/dist/{chunk-MWXMNYJS.cjs → chunk-Q2I37RP3.cjs} +643 -124
- package/dist/{chunk-VFIUZG7J.mjs → chunk-RKGKFN2A.js} +79 -17
- package/dist/{chunk-NYL4D7SK.cjs → chunk-SA6HUJVI.cjs} +5 -5
- package/dist/chunk-SK7UZRNI.mjs +777 -0
- package/dist/{chunk-K2T3DV26.mjs → chunk-TRM4JUZQ.js} +15 -4
- package/dist/chunk-UB4B6OFY.js +370 -0
- package/dist/{chunk-G3XGCZDQ.js → chunk-UCUBNWM2.js} +1 -1
- package/dist/chunk-VWIPB6I5.js +777 -0
- package/dist/{chunk-JNFRRJYH.cjs → chunk-WBGRHGBP.cjs} +270 -192
- package/dist/{client-CtFmoDvM.d.ts → client-CZHU674n.d.ts} +211 -36
- package/dist/core/index.cjs +135 -9
- package/dist/core/index.d.ts +238 -33
- package/dist/core/index.js +155 -29
- package/dist/core/index.mjs +155 -29
- package/dist/{effect-CGNl5Rqp.d.ts → effect-DIUHZ9IN.d.ts} +89 -1
- package/dist/effectRunner-CFLC32IK.cjs +8 -0
- package/dist/{effectRunner-A4CHJXJI.js → effectRunner-L4S7IPT3.js} +2 -2
- package/dist/{effectRunner-OPUF6QRN.mjs → effectRunner-NNGG75QA.mjs} +2 -2
- package/dist/http/index.cjs +324 -2986
- package/dist/http/index.d.ts +54 -68
- package/dist/http/index.js +238 -2900
- package/dist/http/index.mjs +238 -2900
- package/dist/http/testing.cjs +14 -12
- package/dist/http/testing.d.ts +5 -4
- package/dist/http/testing.js +10 -8
- package/dist/http/testing.mjs +10 -8
- package/dist/index.cjs +423 -255
- package/dist/index.d.ts +87 -69
- package/dist/index.js +301 -133
- package/dist/index.mjs +301 -133
- package/dist/observability/index.cjs +18 -531
- package/dist/observability/index.d.ts +81 -8
- package/dist/observability/index.js +25 -538
- package/dist/observability/index.mjs +25 -538
- 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 +6 -2
- package/dist/schema/index.d.ts +3 -1
- package/dist/schema/index.js +5 -1
- package/dist/schema/index.mjs +5 -1
- package/dist/{server-C8hDXA74.d.ts → server-D6JZ15_e.d.ts} +16 -4
- package/dist/{stream-dvSs0QS5.d.ts → stream-B4oK9JFP.d.ts} +1 -1
- package/dist/{tracer-B5tRH9H7.d.ts → tracer-Hwt1cl7h.d.ts} +13 -54
- package/dist/{tracing-Dt9S_6V8.d.ts → tracing-DqbTKGcf.d.ts} +1 -1
- package/docs/ARCHITECTURE.md +292 -0
- package/docs/README.md +65 -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 +339 -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/framework-integrations.md +38 -0
- package/docs/frameworks/angular.md +153 -0
- package/docs/frameworks/express.md +125 -0
- package/docs/frameworks/fastify.md +124 -0
- package/docs/frameworks/nestjs.md +282 -0
- package/docs/frameworks/nextjs.md +147 -0
- package/docs/frameworks/react.md +139 -0
- package/docs/frameworks/vanilla.md +224 -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/nestjs.md +6 -0
- package/docs/observability-collector-smoke.md +31 -0
- package/docs/observability-framework-examples.md +110 -0
- package/docs/observability.md +649 -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 +22 -2
- package/dist/chunk-45F7OKGT.cjs +0 -104
- package/dist/chunk-7V4KY4RL.mjs +0 -104
- package/dist/chunk-DJQ7OMMB.cjs +0 -144
- package/dist/chunk-GOV47PPB.mjs +0 -552
- package/dist/chunk-JF4XXPZ5.cjs +0 -552
- package/dist/chunk-KCPT2D6G.js +0 -552
- package/dist/chunk-NOYZIMUJ.mjs +0 -144
- package/dist/chunk-PNVFW245.js +0 -144
- package/dist/chunk-ROJC3NBJ.js +0 -104
- package/dist/effectRunner-3ZHAD3LE.cjs +0 -8
- package/dist/schedule-Fque9Abz.d.ts +0 -70
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Brass Agent Copilot-like DX
|
|
2
|
+
|
|
3
|
+
Brass Agent started as a CLI-first coding agent. That is still the canonical execution surface, but VS Code users should not need to remember flags or switch to a terminal for normal usage.
|
|
4
|
+
|
|
5
|
+
P29 adds a Copilot-like VS Code surface around the existing CLI protocol.
|
|
6
|
+
|
|
7
|
+
## Mental model
|
|
8
|
+
|
|
9
|
+
Brass Agent is not an inline autocomplete engine yet.
|
|
10
|
+
|
|
11
|
+
It is a task agent:
|
|
12
|
+
|
|
13
|
+
```txt
|
|
14
|
+
you ask for a goal
|
|
15
|
+
-> brass-agent inspects the workspace
|
|
16
|
+
-> runs allowed validation commands
|
|
17
|
+
-> discovers context
|
|
18
|
+
-> calls the configured LLM
|
|
19
|
+
-> proposes a patch
|
|
20
|
+
-> VS Code previews the exact diff
|
|
21
|
+
-> you approve before writing
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The VS Code chat view makes that flow feel like a normal editor assistant.
|
|
25
|
+
|
|
26
|
+
## Chat view
|
|
27
|
+
|
|
28
|
+
Open the Brass Agent activity bar and use the **Chat** view.
|
|
29
|
+
|
|
30
|
+
You can ask things like:
|
|
31
|
+
|
|
32
|
+
```txt
|
|
33
|
+
inspect this workspace
|
|
34
|
+
fix the failing tests
|
|
35
|
+
explain the current type errors
|
|
36
|
+
refactor this module to reduce duplication
|
|
37
|
+
add tests for the selected function
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The chat has three modes:
|
|
41
|
+
|
|
42
|
+
| Mode | What it does |
|
|
43
|
+
| --- | --- |
|
|
44
|
+
| Ask | `read-only`; no shell writes, no patch apply |
|
|
45
|
+
| Propose patch | generates a plan and patch preview, but does not write |
|
|
46
|
+
| Apply after preview | still generates a proposal first; writes only after you approve the exact diff |
|
|
47
|
+
|
|
48
|
+
## Selection-aware commands
|
|
49
|
+
|
|
50
|
+
Select code in an editor and right-click. Brass Agent contributes:
|
|
51
|
+
|
|
52
|
+
```txt
|
|
53
|
+
Ask About Selection
|
|
54
|
+
Explain Selection
|
|
55
|
+
Fix Selection
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
These commands open the chat with a prefilled prompt containing:
|
|
59
|
+
|
|
60
|
+
```txt
|
|
61
|
+
file path
|
|
62
|
+
language id
|
|
63
|
+
selected code
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
They do not directly edit the selection. `Fix Selection` asks the agent to generate a workspace patch and then uses the normal patch preview / approval flow.
|
|
67
|
+
|
|
68
|
+
## Why not inline autocomplete first?
|
|
69
|
+
|
|
70
|
+
Inline autocomplete is useful for short completions while typing. Brass Agent's strongest path is different:
|
|
71
|
+
|
|
72
|
+
```txt
|
|
73
|
+
multi-file context
|
|
74
|
+
validation commands
|
|
75
|
+
typed permissions
|
|
76
|
+
patch preview
|
|
77
|
+
rollback safety
|
|
78
|
+
run history
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
That maps better to chat + code actions than to token-by-token inline completion.
|
|
82
|
+
|
|
83
|
+
A future inline completion provider can still be added, but it should be a separate lightweight layer for small edits, not the main agent loop.
|
|
84
|
+
|
|
85
|
+
## Architecture
|
|
86
|
+
|
|
87
|
+
The boundary remains unchanged:
|
|
88
|
+
|
|
89
|
+
```txt
|
|
90
|
+
src/core
|
|
91
|
+
↑
|
|
92
|
+
src/agent
|
|
93
|
+
↑
|
|
94
|
+
brass-agent CLI protocol
|
|
95
|
+
↑
|
|
96
|
+
VS Code Chat / TreeView / Webview clients
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The chat view does not reimplement agent planning, permissions, approvals, context discovery, patch apply, or rollback. It calls:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
brass-agent --protocol-json --protocol-full-patches --cwd <workspace> <goal>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
and renders protocol events.
|
|
106
|
+
|
|
107
|
+
## Recommended daily flow
|
|
108
|
+
|
|
109
|
+
1. Open the Brass Agent sidebar.
|
|
110
|
+
2. Use **Chat** for normal questions.
|
|
111
|
+
3. Select code and use **Ask About Selection** or **Fix Selection**.
|
|
112
|
+
4. Review patch previews before applying.
|
|
113
|
+
5. Check **Run History** for past runs, details, patches, and reruns.
|
|
114
|
+
|
|
115
|
+
## Safety notes
|
|
116
|
+
|
|
117
|
+
- `Apply after preview` still applies only after exact diff approval.
|
|
118
|
+
- Secrets should live in `.env`, `.env.local`, or `.brass-agent.env`; doctor verifies provider setup.
|
|
119
|
+
- Redaction and context exclude globs still run before LLM prompts.
|
|
120
|
+
- VS Code does not apply patches directly; it delegates back to `brass-agent`.
|
|
121
|
+
|
|
122
|
+
## P30: sessions and slash commands
|
|
123
|
+
|
|
124
|
+
The Chat view now stores a workspace-local conversation, supports slash commands such as `/inspect`, `/fix-tests`, `/explain-last`, and `/apply-last`, and composes follow-up goals using the previous run summary, latest validation output, and patch stats.
|
|
125
|
+
|
|
126
|
+
See [Chat sessions and slash commands](./agent-chat-sessions.md).
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Declarative optimized planning roadmap
|
|
2
|
+
|
|
3
|
+
This note tracks the design goal:
|
|
4
|
+
|
|
5
|
+
> Keep the user-facing layer declarative and flexible, but internally convert
|
|
6
|
+
> work into optimized plans that execute with batches, compact memory, and the
|
|
7
|
+
> least practical overhead.
|
|
8
|
+
|
|
9
|
+
## Does Brass Agent do this today?
|
|
10
|
+
|
|
11
|
+
Partially.
|
|
12
|
+
|
|
13
|
+
Brass Agent already has several pieces of the model:
|
|
14
|
+
|
|
15
|
+
- declarative user requests through CLI goals, VS Code chat, presets, and batch
|
|
16
|
+
files,
|
|
17
|
+
- `AgentAction -> Observation` execution through explicit capabilities,
|
|
18
|
+
- bounded context discovery before planning,
|
|
19
|
+
- compact protocol/events for editor integrations,
|
|
20
|
+
- sequential batch runs for multi-goal workflows,
|
|
21
|
+
- patch quality loops and rollback safety,
|
|
22
|
+
- project intelligence for mixed stacks.
|
|
23
|
+
|
|
24
|
+
However, the current agent still uses a mostly sequential decision loop. It does
|
|
25
|
+
not yet compile user intent into a first-class optimized plan IR, batch tool
|
|
26
|
+
calls aggressively, maintain a compact long-lived memory model, or minimize
|
|
27
|
+
runtime overhead through cost-aware scheduling.
|
|
28
|
+
|
|
29
|
+
## What is missing for the full design?
|
|
30
|
+
|
|
31
|
+
### 1. A first-class plan IR
|
|
32
|
+
|
|
33
|
+
Introduce an internal representation such as:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
type AgentPlan = {
|
|
37
|
+
readonly id: string;
|
|
38
|
+
readonly goal: string;
|
|
39
|
+
readonly steps: readonly PlanStep[];
|
|
40
|
+
readonly budgets: PlanBudgets;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
type PlanStep =
|
|
44
|
+
| { readonly type: "read"; readonly paths: readonly string[] }
|
|
45
|
+
| { readonly type: "search"; readonly queries: readonly string[] }
|
|
46
|
+
| { readonly type: "validate"; readonly commands: readonly string[][] }
|
|
47
|
+
| { readonly type: "llm"; readonly purpose: "plan" | "patch" | "explain" }
|
|
48
|
+
| { readonly type: "patch"; readonly mode: "propose" | "apply" | "rollback" };
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The user keeps writing natural requests, but the agent compiles them into a
|
|
52
|
+
small, inspectable, optimizable plan before execution.
|
|
53
|
+
|
|
54
|
+
### 2. Plan optimization passes
|
|
55
|
+
|
|
56
|
+
Before execution, run optimization passes:
|
|
57
|
+
|
|
58
|
+
- deduplicate repeated reads/searches,
|
|
59
|
+
- merge compatible searches,
|
|
60
|
+
- avoid reading files already in compact memory,
|
|
61
|
+
- skip validation commands that are irrelevant to the goal,
|
|
62
|
+
- cap expensive operations by budget,
|
|
63
|
+
- split independent work into parallel or batched groups.
|
|
64
|
+
|
|
65
|
+
### 3. Batched tool execution
|
|
66
|
+
|
|
67
|
+
Add tool-level batching:
|
|
68
|
+
|
|
69
|
+
- `fs.readFiles(paths)` instead of repeated single reads,
|
|
70
|
+
- `fs.existsMany(paths)` for marker discovery,
|
|
71
|
+
- `search.batch(queries)` with shared `rg` invocation when possible,
|
|
72
|
+
- validation command groups with explicit ordering and concurrency rules.
|
|
73
|
+
|
|
74
|
+
The public agent API can remain declarative while the executor runs fewer tool
|
|
75
|
+
calls internally.
|
|
76
|
+
|
|
77
|
+
### 4. Compact memory
|
|
78
|
+
|
|
79
|
+
Separate memory into layers:
|
|
80
|
+
|
|
81
|
+
```txt
|
|
82
|
+
working memory current run, exact observations
|
|
83
|
+
compact memory summaries, file digests, validation summaries
|
|
84
|
+
persistent memory optional workspace-local cache, never required
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The LLM should receive compact summaries first, exact contents only when needed.
|
|
88
|
+
This reduces token usage, repeated file reads, and noisy follow-up prompts.
|
|
89
|
+
|
|
90
|
+
### 5. Cost and overhead budgets
|
|
91
|
+
|
|
92
|
+
Every plan should carry budgets:
|
|
93
|
+
|
|
94
|
+
```txt
|
|
95
|
+
max tool calls
|
|
96
|
+
max files read
|
|
97
|
+
max bytes read
|
|
98
|
+
max search queries
|
|
99
|
+
max validation commands
|
|
100
|
+
max LLM calls
|
|
101
|
+
max wall-clock time
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The planner and executor can then prefer lower-overhead plans and explain when a
|
|
105
|
+
budget prevented more exploration.
|
|
106
|
+
|
|
107
|
+
### 6. Runtime lanes and scheduling
|
|
108
|
+
|
|
109
|
+
Use the runtime more directly for optimized execution lanes:
|
|
110
|
+
|
|
111
|
+
```txt
|
|
112
|
+
FS lane bounded concurrency
|
|
113
|
+
Search lane low concurrency, deduped
|
|
114
|
+
LLM lane strict concurrency, retry/backoff
|
|
115
|
+
Validation lane serial by default
|
|
116
|
+
Patch lane exclusive
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
This matches the original brass-runtime idea: a coding agent is a concurrent,
|
|
120
|
+
cancelable, observable effect program.
|
|
121
|
+
|
|
122
|
+
## Suggested implementation path
|
|
123
|
+
|
|
124
|
+
1. `P49`: introduce `AgentPlan` and log/preview plans without changing behavior.
|
|
125
|
+
2. `P50`: compile current `decideNextAction` flow into a simple sequential plan.
|
|
126
|
+
3. `P51`: add plan optimization passes for dedupe and budget caps.
|
|
127
|
+
4. `P52`: add batched FS/exists/search tools.
|
|
128
|
+
5. `P53`: add compact memory summaries for files, validation output, and patches.
|
|
129
|
+
6. `P54`: add lane-based executor with bounded concurrency.
|
|
130
|
+
7. `P55`: expose a VS Code “Plan Preview” so users can see what the agent is
|
|
131
|
+
about to do before it runs.
|
|
132
|
+
|
|
133
|
+
## Short answer
|
|
134
|
+
|
|
135
|
+
Brass Agent currently supports the declarative UX and some compact/batch pieces,
|
|
136
|
+
but it is not yet a fully optimized internal planner. To get there, the next big
|
|
137
|
+
step is to introduce a first-class `AgentPlan` IR and then optimize/execute that
|
|
138
|
+
plan with batching, compact memory, budgets, and runtime lanes.
|
package/docs/agent-dx.md
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# Brass Agent DX surfaces
|
|
2
|
+
|
|
3
|
+
This document defines how `brass-agent` should be exposed to developers without
|
|
4
|
+
letting UI concerns leak into the runtime or agent core.
|
|
5
|
+
|
|
6
|
+
## Decision
|
|
7
|
+
|
|
8
|
+
Start with a strong CLI and make editor integrations thin clients over a stable
|
|
9
|
+
machine protocol.
|
|
10
|
+
|
|
11
|
+
```txt
|
|
12
|
+
src/core
|
|
13
|
+
↑
|
|
14
|
+
src/agent
|
|
15
|
+
↑
|
|
16
|
+
brass-agent CLI
|
|
17
|
+
↑
|
|
18
|
+
VS Code / other IDE clients
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The VS Code extension should not reimplement the agent loop. It should call the
|
|
22
|
+
CLI with `--protocol-json`, parse JSON Lines, and render the run in editor UI.
|
|
23
|
+
|
|
24
|
+
## Why CLI-first
|
|
25
|
+
|
|
26
|
+
The CLI is the canonical developer surface because it is:
|
|
27
|
+
|
|
28
|
+
- easy to run in any repo
|
|
29
|
+
- easy to use in CI and smoke tests
|
|
30
|
+
- easy to debug with `--json` and `--protocol-json`
|
|
31
|
+
- independent of a particular editor
|
|
32
|
+
- the best place to stabilize permissions, approvals, config, and event output
|
|
33
|
+
|
|
34
|
+
The CLI remains thin. It wires Node capabilities, config, approvals, LLM adapters,
|
|
35
|
+
and output formatting around `runAgent(...)`.
|
|
36
|
+
|
|
37
|
+
## Why the VS Code extension is a thin client
|
|
38
|
+
|
|
39
|
+
The extension should use VS Code for editor-native UX:
|
|
40
|
+
|
|
41
|
+
- Command Palette commands
|
|
42
|
+
- workspace folder discovery
|
|
43
|
+
- input boxes for goals
|
|
44
|
+
- modal confirmation before write/apply runs
|
|
45
|
+
- output channel rendering
|
|
46
|
+
- cancellation from VS Code progress UI
|
|
47
|
+
- status bar updates
|
|
48
|
+
|
|
49
|
+
But the extension should not own:
|
|
50
|
+
|
|
51
|
+
- planning logic
|
|
52
|
+
- tool policy
|
|
53
|
+
- approvals semantics
|
|
54
|
+
- patch extraction/application
|
|
55
|
+
- project command discovery
|
|
56
|
+
- LLM adapter behavior
|
|
57
|
+
|
|
58
|
+
Those stay in `src/agent` and the CLI.
|
|
59
|
+
|
|
60
|
+
## Protocol
|
|
61
|
+
|
|
62
|
+
Use:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
brass-agent --protocol-json "fix the failing tests"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The CLI prints newline-delimited protocol messages:
|
|
69
|
+
|
|
70
|
+
```jsonl
|
|
71
|
+
{"protocol":"brass-agent","version":1,"type":"event","event":{"type":"agent.run.started"}}
|
|
72
|
+
{"protocol":"brass-agent","version":1,"type":"event","event":{"type":"agent.action.started"}}
|
|
73
|
+
{"protocol":"brass-agent","version":1,"type":"final-state","state":{"phase":"done"}}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`--events-json` remains useful for quick event-only streams. Integrations should
|
|
77
|
+
prefer `--protocol-json` because it includes both events and the final compact
|
|
78
|
+
state.
|
|
79
|
+
|
|
80
|
+
## Current VS Code scaffold
|
|
81
|
+
|
|
82
|
+
The first extension scaffold lives in:
|
|
83
|
+
|
|
84
|
+
```txt
|
|
85
|
+
extensions/vscode-brass-agent/
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
It contributes commands:
|
|
89
|
+
|
|
90
|
+
```txt
|
|
91
|
+
Brass Agent: Propose Fix
|
|
92
|
+
Brass Agent: Apply Fix
|
|
93
|
+
Brass Agent: Inspect Workspace
|
|
94
|
+
Brass Agent: Show Output
|
|
95
|
+
Brass Agent: Cancel Current Run
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The extension invokes the configured CLI command, defaulting to:
|
|
99
|
+
|
|
100
|
+
```txt
|
|
101
|
+
brass-agent
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Settings:
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"brassAgent.command": "brass-agent",
|
|
109
|
+
"brassAgent.extraArgs": [],
|
|
110
|
+
"brassAgent.environment": {}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Development:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
cd extensions/vscode-brass-agent
|
|
118
|
+
npm install
|
|
119
|
+
npm run compile
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Then open the extension folder in VS Code and run the Extension Development Host.
|
|
123
|
+
|
|
124
|
+
## Apply behavior
|
|
125
|
+
|
|
126
|
+
The VS Code `Apply Fix` command intentionally asks for one editor-level
|
|
127
|
+
confirmation before launching the CLI with:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
brass-agent --protocol-json --apply --yes ...
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
That means the agent can apply a valid patch only after the user confirms in VS
|
|
134
|
+
Code. Deeper per-action approvals can be added later by extending the protocol
|
|
135
|
+
with request/response messages, but the first scaffold keeps the extension simple
|
|
136
|
+
and safe.
|
|
137
|
+
|
|
138
|
+
## Future DX slices
|
|
139
|
+
|
|
140
|
+
Recommended next DX slices:
|
|
141
|
+
|
|
142
|
+
1. Rich sidebar TreeView for run history and current actions.
|
|
143
|
+
2. Webview panel for patch preview and approval.
|
|
144
|
+
3. Chat Participant integration so users can invoke `@brass` from VS Code chat.
|
|
145
|
+
4. Language Model Tool integration so VS Code/Copilot agent mode can call Brass tools.
|
|
146
|
+
5. Import-mode extension that calls `runAgent(...)` directly with VS Code-native
|
|
147
|
+
file system, terminal, and approval services.
|
|
148
|
+
|
|
149
|
+
The invariant stays the same: editor integrations are consumers of the agent,
|
|
150
|
+
not owners of the agent semantics.
|
|
151
|
+
|
|
152
|
+
## P10: VS Code patch preview
|
|
153
|
+
|
|
154
|
+
The VS Code extension now previews proposed diffs in a webview before applying
|
|
155
|
+
anything. The apply path uses a second CLI invocation with `--apply-patch-file`,
|
|
156
|
+
so the extension never applies patches itself. P13 patch repair is disabled for this exact apply path, preserving preview approval semantics.
|
|
157
|
+
|
|
158
|
+
```txt
|
|
159
|
+
propose run -> patch.proposed -> webview preview -> approve -> apply supplied patch
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
For trusted local clients, `--protocol-full-patches` keeps only patch payloads
|
|
163
|
+
untruncated in protocol output.
|
|
164
|
+
|
|
165
|
+
## P11: VS Code run history
|
|
166
|
+
|
|
167
|
+
The VS Code extension now contributes a `Brass Agent` activity-bar view with a
|
|
168
|
+
persistent `Runs` TreeView. The view stores compact run metadata in VS Code
|
|
169
|
+
`workspaceState`, can reopen stored patch previews, can rerun previous goals,
|
|
170
|
+
and can clear history for the current workspace.
|
|
171
|
+
|
|
172
|
+
This remains client-side UX over the CLI protocol. The runtime and agent core do
|
|
173
|
+
not know about VS Code, TreeViews, or editor persistence.
|
|
174
|
+
|
|
175
|
+
## VS Code batch runner
|
|
176
|
+
|
|
177
|
+
The VS Code extension can run batch files through the same CLI protocol boundary:
|
|
178
|
+
|
|
179
|
+
```txt
|
|
180
|
+
VS Code
|
|
181
|
+
-> brass-agent --protocol-json --protocol-full-patches --batch-file <file>
|
|
182
|
+
-> protocol events / final states / batch summary
|
|
183
|
+
-> sidebar history parent with child runs
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
This keeps batching in the CLI and keeps the extension as a UI client. See
|
|
187
|
+
[VS Code batch runner](./agent-vscode-batch-runner.md).
|
|
188
|
+
|
|
189
|
+
## P23: local install and doctor
|
|
190
|
+
|
|
191
|
+
CI/release automation is intentionally deferred. The current DX path is local:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
npm run agent:vscode:install
|
|
195
|
+
npm run agent:doctor
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
The VS Code extension also exposes:
|
|
199
|
+
|
|
200
|
+
```txt
|
|
201
|
+
Brass Agent: Doctor
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
This keeps the workflow human-driven while the CLI, protocol, VS Code client,
|
|
205
|
+
configuration, and safety model continue to stabilize.
|
|
206
|
+
|
|
207
|
+
## Initialize a workspace first
|
|
208
|
+
|
|
209
|
+
For a new project, bootstrap local config before deeper DX setup:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
brass-agent --init
|
|
213
|
+
brass-agent --doctor
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
The VS Code extension also contributes `Brass Agent: Initialize Workspace`, which runs the same init flow from the command palette.
|
|
217
|
+
|
|
218
|
+
## Copilot-like chat surface
|
|
219
|
+
|
|
220
|
+
See [Copilot-like VS Code DX](./agent-copilot-like-dx.md) for the chat view, selection-aware commands, and why Brass Agent uses chat/code actions before inline autocomplete.
|
|
221
|
+
|
|
222
|
+
## P30: chat sessions
|
|
223
|
+
|
|
224
|
+
The VS Code chat view now persists a lightweight workspace-local session, supports slash commands, and composes follow-up prompts from the last run summary, validation output, and patch stats. See [Chat sessions and slash commands](./agent-chat-sessions.md).
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Brass Agent env files
|
|
2
|
+
|
|
3
|
+
`brass-agent` can read local environment files for agent-specific variables.
|
|
4
|
+
This is useful for VS Code and local dogfooding because editor-launched commands do
|
|
5
|
+
not always inherit the same shell environment as your terminal.
|
|
6
|
+
|
|
7
|
+
## Load order
|
|
8
|
+
|
|
9
|
+
By default, the CLI checks these files in `--cwd`:
|
|
10
|
+
|
|
11
|
+
```txt
|
|
12
|
+
.brass-agent.env
|
|
13
|
+
.env.local
|
|
14
|
+
.env
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
All existing files are parsed in that order. Exported shell variables win: the
|
|
18
|
+
loader never overwrites keys that are already present in `process.env`.
|
|
19
|
+
|
|
20
|
+
To load a specific file:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
brass-agent --env-file .env --doctor
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
To disable env-file loading completely:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
brass-agent --no-env-file --doctor
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## What gets loaded
|
|
33
|
+
|
|
34
|
+
For safety, the loader only imports known Brass Agent keys, plus the custom
|
|
35
|
+
`config.llm.apiKeyEnv` key when configured. Other application secrets in `.env`
|
|
36
|
+
are ignored and are not copied into `process.env` by the loader.
|
|
37
|
+
|
|
38
|
+
Supported built-in keys include:
|
|
39
|
+
|
|
40
|
+
```txt
|
|
41
|
+
BRASS_LLM_PROVIDER
|
|
42
|
+
BRASS_FAKE_LLM_RESPONSE
|
|
43
|
+
|
|
44
|
+
GEMINI_API_KEY
|
|
45
|
+
GOOGLE_API_KEY
|
|
46
|
+
BRASS_GOOGLE_API_KEY
|
|
47
|
+
BRASS_GOOGLE_MODEL
|
|
48
|
+
BRASS_GOOGLE_API_VERSION
|
|
49
|
+
BRASS_GOOGLE_BASE_URL
|
|
50
|
+
BRASS_GOOGLE_ENDPOINT
|
|
51
|
+
BRASS_GOOGLE_SYSTEM_INSTRUCTION
|
|
52
|
+
BRASS_GOOGLE_TEMPERATURE
|
|
53
|
+
BRASS_GOOGLE_TOP_P
|
|
54
|
+
BRASS_GOOGLE_TOP_K
|
|
55
|
+
BRASS_GOOGLE_MAX_OUTPUT_TOKENS
|
|
56
|
+
|
|
57
|
+
BRASS_LLM_ENDPOINT
|
|
58
|
+
BRASS_LLM_API_KEY
|
|
59
|
+
BRASS_LLM_MODEL
|
|
60
|
+
|
|
61
|
+
BRASS_AGENT_APPROVAL
|
|
62
|
+
BRASS_AGENT_AUTO_APPROVE
|
|
63
|
+
BRASS_CODE_CMD
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The doctor prints key names only, never values.
|
|
67
|
+
|
|
68
|
+
## Google / Gemini example
|
|
69
|
+
|
|
70
|
+
`.brass-agent.json`:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"llm": {
|
|
75
|
+
"provider": "google",
|
|
76
|
+
"model": "gemini-2.5-flash",
|
|
77
|
+
"apiKeyEnv": "GEMINI_API_KEY"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`.env` or `.brass-agent.env`:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
BRASS_LLM_PROVIDER=google
|
|
86
|
+
GEMINI_API_KEY=...
|
|
87
|
+
BRASS_GOOGLE_MODEL=gemini-2.5-flash
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Then:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
brass-agent --doctor
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Expected doctor output includes:
|
|
97
|
+
|
|
98
|
+
```txt
|
|
99
|
+
✓ Agent env file: Loaded ... keys: BRASS_LLM_PROVIDER, GEMINI_API_KEY, BRASS_GOOGLE_MODEL
|
|
100
|
+
✓ LLM provider: Google/Gemini provider is configured (google).
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Why `.env` alone used to fail
|
|
104
|
+
|
|
105
|
+
A shell does not automatically export variables from a `.env` file. Before the
|
|
106
|
+
env-file loader, this worked only when you did something like:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
set -a
|
|
110
|
+
source .env
|
|
111
|
+
set +a
|
|
112
|
+
brass-agent --doctor
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
With the loader, keeping agent keys in `.env` or `.brass-agent.env` is enough for
|
|
116
|
+
the CLI and VS Code extension.
|
|
117
|
+
|
|
118
|
+
## Safety notes
|
|
119
|
+
|
|
120
|
+
- Do not commit real API keys.
|
|
121
|
+
- Prefer `.brass-agent.env` when you want to keep agent credentials separate from
|
|
122
|
+
app/runtime `.env` files.
|
|
123
|
+
- The loader ignores non-agent keys in `.env` so app secrets are not imported
|
|
124
|
+
just because the agent is running.
|
|
125
|
+
- If a key was exposed publicly or pasted into a chat/log, revoke it and create a
|
|
126
|
+
new one.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Brass Agent follow-up context
|
|
2
|
+
|
|
3
|
+
Brass Agent chat keeps a lightweight memory of the last run so the user can ask follow-up questions such as:
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
why did that fail?
|
|
7
|
+
try again but keep the public API unchanged
|
|
8
|
+
explain the last patch
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Follow-up context is intentionally gated. Slash commands such as `/inspect`, `/fix-tests`, `/typecheck`, and `/lint` start from a clean request instead of automatically embedding the previous run summary. This prevents a repeated `/inspect` from re-sending an old inspection summary as if it were the current request.
|
|
12
|
+
|
|
13
|
+
The chat only includes previous run context when one of these is true:
|
|
14
|
+
|
|
15
|
+
- the command explicitly asks for previous context, such as `/explain-last` or patch actions;
|
|
16
|
+
- the prompt looks like a follow-up, for example “why did that fail?” or “try again”;
|
|
17
|
+
- the caller explicitly forces context for a specific integration flow.
|
|
18
|
+
|
|
19
|
+
When context is included, the extension compactly sends:
|
|
20
|
+
|
|
21
|
+
- previous goal;
|
|
22
|
+
- previous mode/status;
|
|
23
|
+
- a truncated previous summary;
|
|
24
|
+
- a truncated error or validation output;
|
|
25
|
+
- patch stats, and optionally the last patch diff when requested.
|
|
26
|
+
|
|
27
|
+
This keeps model prompts smaller and avoids polluting context discovery with generic words from previous summaries.
|
|
28
|
+
|
|
29
|
+
## LLM errors
|
|
30
|
+
|
|
31
|
+
If the model call fails, Brass Agent now surfaces the underlying provider message when available. Instead of only showing:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
Agent stopped with LLMError.
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
it reports a more actionable summary such as:
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
Agent stopped because the model call failed: Google Gemini request failed with 429: ...
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Secrets are still passed through the agent redaction layer before appearing in summaries.
|