brass-runtime 1.12.1 → 1.13.3
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/README.md +55 -228
- package/dist/agent/cli/main.js +2021 -15
- package/dist/agent/cli/main.mjs +2022 -0
- package/dist/agent/index.d.mts +1 -1
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +153 -1
- package/dist/agent/index.mjs +153 -0
- package/dist/chunk-3IF374MG.js +407 -0
- package/dist/chunk-6ECUD4N3.mjs +2879 -0
- package/dist/chunk-HRVX2IYW.js +2879 -0
- package/dist/chunk-QRPYH5J7.mjs +407 -0
- package/dist/chunk-T5XJDGTQ.mjs +2556 -0
- package/dist/chunk-TGOMLZ65.js +2556 -0
- package/dist/effect-ISvXPLgc.d.mts +797 -0
- package/dist/effect-ISvXPLgc.d.ts +797 -0
- package/dist/http/index.d.mts +2 -2
- package/dist/http/index.d.ts +2 -2
- package/dist/http/index.js +453 -1
- package/dist/http/index.mjs +453 -0
- package/dist/index.d.mts +159 -41
- package/dist/index.d.ts +159 -41
- package/dist/index.js +855 -1
- package/dist/index.mjs +855 -0
- package/dist/{stream-DNTGNv-G.d.ts → stream-BvukHxCv.d.ts} +1 -1
- package/dist/{stream-FwtnWmgX.d.mts → stream-C0-LWnUP.d.mts} +1 -1
- package/package.json +25 -16
- package/dist/agent/cli/main.cjs +0 -16
- package/dist/agent/index.cjs +0 -1
- package/dist/chunk-63MXGA7P.js +0 -1
- package/dist/chunk-63ODH5W4.cjs +0 -25
- package/dist/chunk-7PHP7KQB.cjs +0 -1
- package/dist/chunk-MAR4TNUH.js +0 -1
- package/dist/chunk-P4IND5C3.js +0 -25
- package/dist/chunk-T3QEEHK6.cjs +0 -1
- package/dist/effect-NSaHksNl.d.mts +0 -367
- package/dist/effect-NSaHksNl.d.ts +0 -367
- package/dist/http/index.cjs +0 -1
- package/dist/index.cjs +0 -1
package/README.md
CHANGED
|
@@ -1,231 +1,58 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
A small experimental runtime inspired by **ZIO 2**, implemented in vanilla TypeScript and intentionally built without using `Promise` / `async`/`await` as the **primary semantic primitive**.
|
|
4
|
-
|
|
5
|
-
`brass-runtime` is the foundation: it provides an effect system, fibers, scheduler, scopes, and streams.
|
|
6
|
-
Higher-level modules (HTTP, streaming utilities, integrations) are built **on top of the runtime**, not baked into it.
|
|
7
|
-
|
|
8
|
-
> You can still interop with the outside world (timers, fetch, Node APIs) via explicit, cancellable bridges such as `fromPromiseAbortable`.
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## Philosophy
|
|
13
|
-
|
|
14
|
-
- **Effects are values** — lazy, composable, referentially transparent
|
|
15
|
-
- **Async is explicit** — no hidden Promise semantics
|
|
16
|
-
- **Concurrency is structured** — fibers, scopes, finalizers
|
|
17
|
-
- **Side effects are interpreted** — not executed eagerly
|
|
18
|
-
- **Higher-level APIs are libraries, not magic**
|
|
19
|
-
|
|
20
|
-
If you like ZIO’s separation between `zio-core`, `zio-streams`, and `zio-http`, this project follows the same spirit.
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## Core concepts
|
|
25
|
-
|
|
26
|
-
- Sync core effect: `Effect<R, E, A>` and `Exit<E, A>`
|
|
27
|
-
- Algebraic async representation: `Async<R, E, A>`
|
|
28
|
-
- Cooperative `Scheduler` (observable / testable)
|
|
29
|
-
- Lightweight `Fiber`s with interruption & finalizers
|
|
30
|
-
- Structured `Scope`s for resource safety
|
|
31
|
-
- ZStream-style streams with backpressure
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## Install
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
npm i brass-runtime
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
## Quick start
|
|
44
|
-
|
|
45
|
-
### Run an effect
|
|
46
|
-
|
|
47
|
-
```ts
|
|
48
|
-
import { Runtime, succeed, toPromise } from "brass-runtime";
|
|
49
|
-
|
|
50
|
-
const runtime = new Runtime({ env: {} });
|
|
51
|
-
|
|
52
|
-
const value = await toPromise(succeed(123), runtime.env);
|
|
53
|
-
console.log(value); // 123
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### Structured concurrency with Scope
|
|
57
|
-
|
|
58
|
-
```ts
|
|
59
|
-
import { Runtime, withScope } from "brass-runtime";
|
|
60
|
-
|
|
61
|
-
const runtime = new Runtime({ env: {} });
|
|
62
|
-
|
|
63
|
-
withScope(runtime, (scope) => {
|
|
64
|
-
const f = scope.fork(/* Async effect */);
|
|
65
|
-
// later...
|
|
66
|
-
scope.close(); // interrupts child fibers + runs finalizers
|
|
67
|
-
});
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
> `toPromise` is just a convenience bridge for examples/DX. The runtime semantics remain explicit.
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## Modules built on top of brass-runtime
|
|
75
|
-
|
|
76
|
-
These are optional layers, implemented using the runtime primitives.
|
|
77
|
-
|
|
78
|
-
### 🌐 HTTP client (brass-http layer)
|
|
79
|
-
|
|
80
|
-
A ZIO-style HTTP client built on top of fibers and `Async`.
|
|
81
|
-
|
|
82
|
-
- Lazy & cancelable HTTP requests
|
|
83
|
-
- Explicit wire/content separation
|
|
84
|
-
- Middleware-friendly (logging, retry, timeout, etc.)
|
|
85
|
-
- Integrated with fiber interruption via `AbortController`
|
|
86
|
-
|
|
87
|
-
👉 **Docs:** [HTTP module](./docs/http.md)
|
|
88
|
-
|
|
89
|
-
Example:
|
|
90
|
-
|
|
91
|
-
```ts
|
|
92
|
-
import { Runtime, toPromise } from "brass-runtime";
|
|
93
|
-
import { httpClientStream } from "brass-runtime/http";
|
|
94
|
-
|
|
95
|
-
type Post = { id: number; title: string; body: string };
|
|
96
|
-
|
|
97
|
-
const runtime = new Runtime({ env: {} });
|
|
98
|
-
|
|
99
|
-
const client = httpClientStream({ baseUrl: "https://jsonplaceholder.typicode.com" });
|
|
100
|
-
|
|
101
|
-
const res = await toPromise(client.getJson<Post>("/posts/1"), runtime.env);
|
|
102
|
-
console.log(res.status, res.value.title);
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
107
|
-
### 🤖 Brass Agent (experimental)
|
|
108
|
-
|
|
109
|
-
A CLI-first coding agent built on top of the runtime. Brass Agent is currently experimental: it can inspect a workspace, discover validation commands, gather bounded context, ask an LLM for a patch, apply/rollback patches through explicit policies, and expose a thin VS Code extension over the CLI protocol.
|
|
1
|
+
# Documentation
|
|
110
2
|
|
|
111
3
|
Start here:
|
|
112
4
|
|
|
113
|
-
- [
|
|
114
|
-
- [
|
|
115
|
-
- [
|
|
116
|
-
- [
|
|
117
|
-
- [
|
|
118
|
-
- [
|
|
119
|
-
- [
|
|
120
|
-
- [
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
-
|
|
148
|
-
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
- [
|
|
155
|
-
- [
|
|
156
|
-
- [
|
|
157
|
-
- [
|
|
158
|
-
|
|
159
|
-
- [
|
|
160
|
-
- [
|
|
161
|
-
- [
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
- Stream buffering with backpressure (`buffer`)
|
|
168
|
-
- Abortable async integration (`fromPromiseAbortable`)
|
|
169
|
-
- Fiber-safe `toPromise` for examples & DX
|
|
170
|
-
- HTTP client module built on top of the runtime
|
|
171
|
-
|
|
172
|
-
---
|
|
173
|
-
|
|
174
|
-
## Features (status)
|
|
175
|
-
|
|
176
|
-
### Runtime (core)
|
|
177
|
-
- [x] Sync core: `Effect`
|
|
178
|
-
- [x] Async algebra: `Async`
|
|
179
|
-
- [x] Cooperative `Scheduler`
|
|
180
|
-
- [x] Fibers with interruption & finalizers
|
|
181
|
-
- [x] Structured `Scope`
|
|
182
|
-
- [x] Resource safety (`acquireRelease`)
|
|
183
|
-
|
|
184
|
-
### Concurrency & Streams
|
|
185
|
-
- [x] `race`, `zipPar`, `collectAllPar`
|
|
186
|
-
- [x] ZStream-like core
|
|
187
|
-
- [x] Bounded buffers & backpressure
|
|
188
|
-
- [x] Stream merge / zip
|
|
189
|
-
- [x] Hubs / Broadcast
|
|
190
|
-
- [x] Pipelines (`ZPipeline`-style)
|
|
191
|
-
|
|
192
|
-
### Libraries
|
|
193
|
-
- [x] HTTP client
|
|
194
|
-
- [ ] Retry / timeout middleware
|
|
195
|
-
- [ ] Logging / metrics layers
|
|
196
|
-
|
|
197
|
-
---
|
|
198
|
-
|
|
199
|
-
## Design notes
|
|
200
|
-
|
|
201
|
-
- **No hidden Promises**: async is always modeled explicitly
|
|
202
|
-
- **Deterministic execution**: scheduler is observable & testable
|
|
203
|
-
- **Resource safety is structural**: scopes guarantee cleanup
|
|
204
|
-
- **Libraries compose via functions**: middleware, not inheritance
|
|
205
|
-
|
|
206
|
-
---
|
|
207
|
-
|
|
208
|
-
## Contributing
|
|
209
|
-
|
|
210
|
-
- Runtime invariants matter — avoid sneaking Promises into semantics
|
|
211
|
-
- Prefer libraries on top of the runtime over changes in the core
|
|
212
|
-
- Small, focused PRs are welcome (your repo may enforce PR-only changes)
|
|
213
|
-
|
|
214
|
-
---
|
|
215
|
-
|
|
216
|
-
## License
|
|
217
|
-
|
|
218
|
-
MIT License © 2025
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
## Brass Agent local smoke tests
|
|
222
|
-
|
|
223
|
-
Run local smoke tests without CI or a real LLM provider:
|
|
224
|
-
|
|
225
|
-
```bash
|
|
226
|
-
npm run agent:test:local
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
This builds the project and runs a fake-LLM smoke test against the `brass-agent` CLI.
|
|
230
|
-
|
|
231
|
-
See also: [Agent language and workspace setup UX](docs/agent-language-workspace-ux.md).
|
|
5
|
+
- **[Getting started](./getting-started.md)** — installation, first effects, and running examples
|
|
6
|
+
- **[Architecture](./ARCHITECTURE.md)** — how the runtime is structured
|
|
7
|
+
- **[Cancellation & interruption](./cancellation.md)** — interruption semantics, scopes, and cancellable `Async`
|
|
8
|
+
- **[Observability](./observability.md)** — hooks, events, sinks, and tracing
|
|
9
|
+
- **[HTTP client](./http.md)** — ZIO-style HTTP built on brass-runtime
|
|
10
|
+
- **[Modules overview](./modules.md)** — map of core modules and where things live
|
|
11
|
+
- **[Agent module boundaries](./agent-boundaries.md)** — rules for keeping `brass-agent` isolated from the core runtime
|
|
12
|
+
- **[Brass Agent install and configure](./agent-install-and-configure.md)** — end-to-end local setup for CLI, config, providers, and VS Code
|
|
13
|
+
|
|
14
|
+
- [Agent LLM adapters](./agent-llm-adapters.md)
|
|
15
|
+
- [Agent env files](./agent-env-files.md)
|
|
16
|
+
- [Agent global usage and workspace discovery](./agent-global-usage.md)
|
|
17
|
+
- [Agent apply mode](./agent-apply-mode.md)
|
|
18
|
+
- [Brass Agent CLI](./agent-cli.md)
|
|
19
|
+
- [Agent init](./agent-init.md)
|
|
20
|
+
- [Agent observability](./agent-observability.md)
|
|
21
|
+
- [Agent approvals](./agent-approvals.md)
|
|
22
|
+
- [Agent config and policy files](./agent-config.md)
|
|
23
|
+
- [Agent project command discovery](./agent-project-commands.md)
|
|
24
|
+
- [Agent project intelligence](./agent-project-intelligence.md)
|
|
25
|
+
- [Declarative optimized planning roadmap](./agent-declarative-optimized-planning.md)
|
|
26
|
+
- [Agent context discovery](./agent-context-discovery.md)
|
|
27
|
+
- [Agent patch quality loop](./agent-patch-quality-loop.md)
|
|
28
|
+
- [Agent automatic rollback safety](./agent-rollback-safety.md)
|
|
29
|
+
- [Agent DX surfaces](./agent-dx.md)
|
|
30
|
+
|
|
31
|
+
- [VS Code patch preview](./agent-vscode-patch-preview.md)
|
|
32
|
+
- [VS Code enhanced diff preview](./agent-vscode-diff-preview.md)
|
|
33
|
+
- [VS Code run history](./agent-vscode-run-history.md)
|
|
34
|
+
- [VS Code batch runner](./agent-vscode-batch-runner.md)
|
|
35
|
+
- [VS Code UX](./agent-vscode-ux.md)
|
|
36
|
+
- [VS Code Project dashboard](./agent-vscode-project-dashboard.md)
|
|
37
|
+
- [VS Code Chat layout / focus mode](./agent-vscode-chat-layout.md)
|
|
38
|
+
- [Copilot-like VS Code DX](./agent-copilot-like-dx.md)
|
|
39
|
+
- [Chat sessions and slash commands](./agent-chat-sessions.md)
|
|
40
|
+
- [Agent follow-up context](./agent-follow-up-context.md)
|
|
41
|
+
- [VS Code code actions](./agent-vscode-code-actions.md)
|
|
42
|
+
- [VS Code problems-aware chat](./agent-vscode-problems.md)
|
|
43
|
+
- [VS Code inline assist](./agent-vscode-inline-assist.md)
|
|
44
|
+
- [Agent release readiness](./agent-release-readiness.md)
|
|
45
|
+
- [VS Code local install](./agent-vscode-install.md)
|
|
46
|
+
- [VS Code auto-discovery](./agent-vscode-auto-discovery.md)
|
|
47
|
+
- [VS Code model setup](./agent-vscode-model-setup.md)
|
|
48
|
+
- [Agent local install and doctor](./agent-local-install.md)
|
|
49
|
+
- [Agent local tests](./agent-local-tests.md)
|
|
50
|
+
|
|
51
|
+
- [Agent rollback patches](./agent-rollback.md)
|
|
52
|
+
- [Agent redaction](./agent-redaction.md)
|
|
53
|
+
- [Agent run artifacts](./agent-run-artifacts.md)
|
|
54
|
+
- [Agent CI mode](./agent-ci.md)
|
|
55
|
+
- [Agent presets](./agent-presets.md)
|
|
56
|
+
- [Agent batch runs](./agent-batch.md)
|
|
57
|
+
- [VS Code full clean and reinstall](./agent-vscode-clean-install.md)
|
|
58
|
+
- [Agent language and workspace setup UX](agent-language-workspace-ux.md)
|