@hachej/boring-agent 0.1.110 → 0.2.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/LICENSE +1 -1
- package/README.md +262 -51
- package/dist/agents.d.ts +75 -0
- package/dist/agents.js +91 -0
- package/dist/approval.d.ts +71 -0
- package/dist/approval.js +126 -0
- package/dist/artifacts.d.ts +53 -0
- package/dist/artifacts.js +129 -0
- package/dist/ask-user.d.ts +40 -0
- package/dist/ask-user.js +134 -0
- package/dist/attachment.d.ts +5 -0
- package/dist/attachment.js +4 -0
- package/dist/browser-task.d.ts +32 -0
- package/dist/browser-task.js +119 -0
- package/dist/chat-transport.d.ts +80 -0
- package/dist/chat-transport.js +306 -0
- package/dist/contracts.d.ts +40 -0
- package/dist/contracts.js +1 -0
- package/dist/conversations.d.ts +136 -0
- package/dist/conversations.js +366 -0
- package/dist/definitions.d.ts +37 -0
- package/dist/definitions.js +99 -0
- package/dist/delivery-input.d.ts +35 -0
- package/dist/delivery-input.js +56 -0
- package/dist/delivery.d.ts +33 -0
- package/dist/delivery.js +154 -0
- package/dist/durable-wait.d.ts +23 -0
- package/dist/durable-wait.js +79 -0
- package/dist/file-convert.d.ts +46 -0
- package/dist/file-convert.js +159 -0
- package/dist/file-guard.d.ts +50 -0
- package/dist/file-guard.js +171 -0
- package/dist/file-types.d.ts +17 -0
- package/dist/file-types.js +95 -0
- package/dist/gateway-provider.d.ts +24 -0
- package/dist/gateway-provider.js +42 -0
- package/dist/git.d.ts +34 -0
- package/dist/git.js +79 -0
- package/dist/harness-pool.d.ts +38 -0
- package/dist/harness-pool.js +134 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -0
- package/dist/json-schema-tool.d.ts +25 -0
- package/dist/json-schema-tool.js +19 -0
- package/dist/memory/optchat-core.d.ts +118 -0
- package/dist/memory/optchat-core.js +317 -0
- package/dist/memory/optchat.d.ts +156 -0
- package/dist/memory/optchat.js +432 -0
- package/dist/mentions.d.ts +56 -0
- package/dist/mentions.js +140 -0
- package/dist/metering.d.ts +183 -0
- package/dist/metering.js +443 -0
- package/dist/model-gateway.d.ts +86 -0
- package/dist/model-gateway.js +241 -0
- package/dist/native-version.d.ts +9 -0
- package/dist/native-version.js +7 -0
- package/dist/native.d.ts +4 -0
- package/dist/native.js +1 -0
- package/dist/presentation.d.ts +17 -0
- package/dist/presentation.js +39 -0
- package/dist/projection-format.d.ts +68 -0
- package/dist/projection-format.js +118 -0
- package/dist/projection-window.d.ts +9 -0
- package/dist/projection-window.js +93 -0
- package/dist/projection.d.ts +22 -0
- package/dist/projection.js +153 -0
- package/dist/question-response.d.ts +20 -0
- package/dist/question-response.js +75 -0
- package/dist/questions.d.ts +74 -0
- package/dist/questions.js +199 -0
- package/dist/self-evolving.d.ts +55 -0
- package/dist/self-evolving.js +239 -0
- package/dist/skills.d.ts +15 -0
- package/dist/skills.js +51 -0
- package/dist/tool-evidence.d.ts +14 -0
- package/dist/tool-evidence.js +54 -0
- package/dist/validation.d.ts +38 -0
- package/dist/validation.js +68 -0
- package/dist/workspaces.d.ts +107 -0
- package/dist/workspaces.js +212 -0
- package/package.json +145 -150
- package/dist/DebugDrawer-JNA43SVR.js +0 -8
- package/dist/admin-DORVQfLn.d.ts +0 -340
- package/dist/chunk-2BGLZZ7T.js +0 -10
- package/dist/chunk-42D6KAQV.js +0 -2882
- package/dist/chunk-4XOW57KJ.js +0 -343
- package/dist/chunk-72KT6VWV.js +0 -1338
- package/dist/chunk-7XAOVFSN.js +0 -28
- package/dist/chunk-KJIEMSQP.js +0 -198
- package/dist/chunk-KN72XWP7.js +0 -394
- package/dist/chunk-N6THTH7P.js +0 -110
- package/dist/chunk-V3H5A3BR.js +0 -22501
- package/dist/chunk-YGRQ4Q5P.js +0 -20
- package/dist/chunk-YTUZFKB3.js +0 -78
- package/dist/core/index.d.ts +0 -28
- package/dist/core/index.js +0 -617
- package/dist/createHarness-DOLOHA62.js +0 -18
- package/dist/eval/index.d.ts +0 -247
- package/dist/eval/index.js +0 -541
- package/dist/file-search-BUgMSKZE.d.ts +0 -289
- package/dist/front/artifacts.d.ts +0 -34
- package/dist/front/artifacts.js +0 -21
- package/dist/front/index.d.ts +0 -1082
- package/dist/front/index.js +0 -12912
- package/dist/front/styles.css +0 -5380
- package/dist/harness-qHlMJhZo.d.ts +0 -276
- package/dist/middleware-CaAEXpi5.d.ts +0 -115
- package/dist/piChatEvent-DpE0lIb9.d.ts +0 -450
- package/dist/piChatSessionService-CBct-hmz.d.ts +0 -86
- package/dist/sandbox-BMhut3kh.d.ts +0 -317
- package/dist/server/agent-host/testing/compositionRouteProof.d.ts +0 -8
- package/dist/server/agent-host/testing/compositionRouteProof.js +0 -78
- package/dist/server/agent-host/testing/gatewayConformance.d.ts +0 -43
- package/dist/server/agent-host/testing/gatewayConformance.js +0 -605
- package/dist/server/index.d.ts +0 -2278
- package/dist/server/index.js +0 -274
- package/dist/server/pi-session-readability.d.ts +0 -12
- package/dist/server/pi-session-readability.js +0 -23
- package/dist/server/worker/index.d.ts +0 -68
- package/dist/server/worker/index.js +0 -377
- package/dist/share-entry-CxS6UJ_L.d.ts +0 -330
- package/dist/shared/index.d.ts +0 -2111
- package/dist/shared/index.js +0 -262
- package/dist/types-DcWoQMn8.d.ts +0 -1377
- package/docs/ACCESSIBILITY.md +0 -52
- package/docs/AGENT_GATEWAY_V0.md +0 -212
- package/docs/AGENT_PACKAGES.md +0 -90
- package/docs/API.md +0 -123
- package/docs/AUTHORING.md +0 -68
- package/docs/CSP.md +0 -41
- package/docs/ERROR_CODES.md +0 -229
- package/docs/KNOWN_LIMITATIONS.md +0 -100
- package/docs/MIGRATION.md +0 -50
- package/docs/PERFORMANCE.md +0 -68
- package/docs/PLUGINS.md +0 -138
- package/docs/README.md +0 -98
- package/docs/RISKS-MULTI-TAB.md +0 -46
- package/docs/SESSION_IDENTITY.md +0 -91
- package/docs/STYLING.md +0 -73
- package/docs/UI-SHADCN.md +0 -56
- package/docs/VERCEL_COSTS.md +0 -103
- package/docs/plans/archive/AGENT_EVAL_FRAMEWORK.md +0 -466
- package/docs/plans/archive/agent-package-spec.md +0 -1777
- package/docs/plans/archive/harness-followup-capabilities.md +0 -440
- package/docs/plans/archive/harness-tool-ui-capabilities.md +0 -144
- package/docs/plans/archive/pi-followup-history-projection.md +0 -229
- package/docs/plans/archive/pi-tools-migration.md +0 -1061
- package/docs/plans/archive/reviews/pi-followup-history-codex-review.md +0 -11
- package/docs/plans/archive/reviews/pi-followup-history-gpt-review.md +0 -64
- package/docs/plans/archive/reviews/pi-followup-history-opus-review.md +0 -43
- package/docs/plans/archive/reviews/pi-followup-history-xai-review.md +0 -43
- package/docs/plans/archive/vercel-base-snapshot-template-plan.md +0 -527
- package/docs/plans/archive/vercel-persistent-sandbox-adapter.md +0 -553
- package/docs/runtime-provisioning.md +0 -157
- package/docs/runtime.md +0 -296
- package/docs/tools.md +0 -102
package/docs/runtime.md
DELETED
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
> The boring-ui agent supports multiple runtime modes. Ask it to configure the right one for your deployment.
|
|
2
|
-
|
|
3
|
-
# Runtime Modes and Provisioning
|
|
4
|
-
|
|
5
|
-
Every v1 agent is bound to an authorized workspace and an approved runtime
|
|
6
|
-
adapter. The agent supports multiple built-in execution modes controlling how
|
|
7
|
-
`bash` and filesystem tools run. A headless host may omit its UI/presentation
|
|
8
|
-
surface, but it still supplies the same workspace-backed runtime contract.
|
|
9
|
-
|
|
10
|
-
## Modes
|
|
11
|
-
|
|
12
|
-
| mode | description | use when |
|
|
13
|
-
|---|---|---|
|
|
14
|
-
| `direct` | tools run directly in the host process | local dev, trusted environments |
|
|
15
|
-
| `local` | tools run in a `bwrap` sandbox (Linux only) | self-hosted, untrusted input |
|
|
16
|
-
| `vercel-sandbox` | tools run in Vercel Firecracker microVMs | production on Vercel |
|
|
17
|
-
| `blaxel` | tools run in a Blaxel sandbox pinned to an explicit EU region | sovereign-compute bridge; production safety gate remains opt-in |
|
|
18
|
-
|
|
19
|
-
Set via env var:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
BORING_AGENT_MODE=vercel-sandbox
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
Defaults to `direct` when unset.
|
|
26
|
-
|
|
27
|
-
## Runtime cwd contract
|
|
28
|
-
|
|
29
|
-
Every boring-bash runtime adapter must preserve this invariant:
|
|
30
|
-
|
|
31
|
-
```txt
|
|
32
|
-
file tree root == shell cwd == model-visible cwd == BORING_AGENT_WORKSPACE_ROOT
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
The shared runtime context is intentionally small:
|
|
36
|
-
|
|
37
|
-
```ts
|
|
38
|
-
interface WorkspaceRuntimeContext {
|
|
39
|
-
runtimeCwd: string
|
|
40
|
-
}
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Adapter rules for attached filesystem/exec environments:
|
|
44
|
-
|
|
45
|
-
- `Workspace.root` must equal `runtimeContext.runtimeCwd`.
|
|
46
|
-
- `Sandbox.runtimeContext.runtimeCwd` must equal the same value.
|
|
47
|
-
- Shell tools should default `cwd` to `runtimeCwd`.
|
|
48
|
-
- `BORING_AGENT_WORKSPACE_ROOT` and `PWD` should be the same value seen by the model.
|
|
49
|
-
- Do **not** rewrite user command strings. Adapters own cwd, env, and mounts; commands must pass through literally.
|
|
50
|
-
- Generic agent/provisioning code must not depend on host storage paths or sandbox-internal roots.
|
|
51
|
-
|
|
52
|
-
Mode-specific roots:
|
|
53
|
-
|
|
54
|
-
- `direct`: `runtimeCwd` is the real host workspace path.
|
|
55
|
-
- `local`/bwrap: `runtimeCwd` is `/workspace`; the host workspace is adapter-private.
|
|
56
|
-
- `vercel-sandbox`: `runtimeCwd` is `/workspace`; `/vercel/sandbox` is adapter-private.
|
|
57
|
-
- `blaxel`: `runtimeCwd` is the EU-pinned persistent Volume mount at `/workspace`.
|
|
58
|
-
|
|
59
|
-
Never expose adapter-private paths (host workspace roots for bwrap, `/vercel/sandbox` for Vercel) in model-facing prompts, tool descriptions, or observations.
|
|
60
|
-
|
|
61
|
-
### Blaxel v1 fidelity limits
|
|
62
|
-
|
|
63
|
-
Blaxel SDK 0.3.11 does not expose a server-side output byte limit. The adapter
|
|
64
|
-
therefore reads the terminal process record and applies Boring's single combined
|
|
65
|
-
byte budget locally, allocating stdout before stderr. The SDK's live log stream
|
|
66
|
-
is line based rather than byte exact, so v1 intentionally does not invoke
|
|
67
|
-
`onStdout`/`onStderr`; callers receive byte-capped terminal output instead.
|
|
68
|
-
|
|
69
|
-
Abort and timeout are implemented with a stable named process plus
|
|
70
|
-
`process.kill()`. This is best effort across control-plane races: Boring preserves
|
|
71
|
-
the caller's exact abort reason and returns exit 124 on timeout, but a provider
|
|
72
|
-
transport failure can delay confirmation that the remote process stopped.
|
|
73
|
-
Snapshots, forking, and Agent Drive remain out of scope because those Blaxel
|
|
74
|
-
surfaces are private preview in the pinned SDK.
|
|
75
|
-
|
|
76
|
-
## `.boring-agent/` runtime layout
|
|
77
|
-
|
|
78
|
-
Provisioned runtime artifacts live under the workspace-local `.boring-agent/` directory:
|
|
79
|
-
|
|
80
|
-
```txt
|
|
81
|
-
.boring-agent/
|
|
82
|
-
bin/ # managed shims for provisioned CLIs
|
|
83
|
-
node/ # npm prefix for provisioned node packages (bins at node/node_modules/.bin)
|
|
84
|
-
venv/ # Python virtualenv (console scripts at venv/bin)
|
|
85
|
-
sdk/ # staged local SDK/package sources; sdk/uv holds the workspace-local uv
|
|
86
|
-
skills/ # mirror of plugin skills
|
|
87
|
-
cache/ # npm/uv/pip caches
|
|
88
|
-
tmp/ # staged venvs, tarballs, temp files
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
PATH entries exposed to the harness are `node/node_modules/.bin`, `venv/bin`,
|
|
92
|
-
and `sdk/uv/bin` (see `getBoringAgentPathEntries` in
|
|
93
|
-
`@hachej/boring-sandbox/providers/node-workspace`). `.boring-agent/bin` is a managed shim
|
|
94
|
-
location written by the provisioner; it is not the canonical PATH source
|
|
95
|
-
described by `getBoringAgentPathEntries`. The provisioner writes ownership
|
|
96
|
-
markers (`.boring-agent-owned.json`) for managed runtime directories. Do not
|
|
97
|
-
hand-edit managed files as an app integration mechanism; declare provisioning
|
|
98
|
-
contributions instead.
|
|
99
|
-
|
|
100
|
-
## Runtime provisioning
|
|
101
|
-
|
|
102
|
-
Plugins and host apps can contribute runtime setup through `templateDirs[]`, `python[]`, and `nodePackages[]`. Provisioning is fingerprinted and skipped when already materialized; broken or stale runtime artifacts are lazily repaired on the next provision pass. Force reprovision by calling the provisioning API with `force: true` from host code/tests.
|
|
103
|
-
|
|
104
|
-
### Template files
|
|
105
|
-
|
|
106
|
-
Use `templateDirs[]` for skills, docs, seeds, starter files, and app-owned workspace content:
|
|
107
|
-
|
|
108
|
-
```ts
|
|
109
|
-
provisioning: {
|
|
110
|
-
templateDirs: [
|
|
111
|
-
{
|
|
112
|
-
id: 'app-template',
|
|
113
|
-
path: new URL('./workspace-template', import.meta.url),
|
|
114
|
-
target: '.',
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
}
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
Templates are copied into the runtime workspace. They should not include generated `.boring-agent/` shims or SDK copies.
|
|
121
|
-
|
|
122
|
-
### Python SDKs and CLIs
|
|
123
|
-
|
|
124
|
-
Use `python[]` for local Python projects that provide console scripts:
|
|
125
|
-
|
|
126
|
-
```ts
|
|
127
|
-
provisioning: {
|
|
128
|
-
python: [
|
|
129
|
-
{
|
|
130
|
-
id: 'app-sdk',
|
|
131
|
-
projectFile: new URL('./sdk/pyproject.toml', import.meta.url),
|
|
132
|
-
env: {
|
|
133
|
-
APP_API_URL: 'https://example.test/api',
|
|
134
|
-
APP_ASSETS_ROOT: new URL('./sdk/assets/', import.meta.url),
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
],
|
|
138
|
-
}
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
The provisioner stages each project under `.boring-agent/sdk/python/<id>`, installs it into `.boring-agent/venv`, and may write managed shims under `.boring-agent/bin`. The harness-visible executables still come from the runtime PATH entries above. File URL env values must point inside the Python project and are converted to runtime-visible SDK paths.
|
|
142
|
-
|
|
143
|
-
Reserved env keys (`BORING_AGENT_WORKSPACE_ROOT`, `VIRTUAL_ENV`, `HOME`, `PYTHONHOME`) cannot be set by plugins.
|
|
144
|
-
|
|
145
|
-
### Node packages and CLIs
|
|
146
|
-
|
|
147
|
-
Use `nodePackages[]` for npm packages or local package roots that should expose bins on PATH:
|
|
148
|
-
|
|
149
|
-
```ts
|
|
150
|
-
provisioning: {
|
|
151
|
-
nodePackages: [
|
|
152
|
-
{
|
|
153
|
-
id: 'boring-ui-cli',
|
|
154
|
-
packageName: '@hachej/boring-ui-cli',
|
|
155
|
-
packageRoot: new URL('../../cli', import.meta.url),
|
|
156
|
-
bins: { 'boring-ui': 'dist/index.js' },
|
|
157
|
-
},
|
|
158
|
-
],
|
|
159
|
-
}
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
Local packages are packed/installed into `.boring-agent/node`; managed bin shims may also be written to `.boring-agent/bin`. The harness-visible executables still come from `node/node_modules/.bin`. Multiple node packages are installed together so later packages do not prune earlier ones.
|
|
163
|
-
|
|
164
|
-
## vercel-sandbox
|
|
165
|
-
|
|
166
|
-
Each workspace session gets its own Firecracker microVM. Files and shell state persist across turns within a session. Snapshots are taken every 10 minutes.
|
|
167
|
-
|
|
168
|
-
```bash
|
|
169
|
-
BORING_AGENT_MODE=vercel-sandbox
|
|
170
|
-
VERCEL_TEAM_ID=team_...
|
|
171
|
-
VERCEL_PROJECT_ID=prj_...
|
|
172
|
-
# production: uses Vercel OIDC automatically
|
|
173
|
-
# local emulation: set VERCEL_TOKEN
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
Sandbox lifetime:
|
|
177
|
-
|
|
178
|
-
```bash
|
|
179
|
-
BORING_AGENT_VERCEL_SANDBOX_TIMEOUT_MS=2700000 # max 2700000ms (Vercel limit)
|
|
180
|
-
BORING_AGENT_SNAPSHOT_KEEP=2 # retained snapshots per workspace
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
Vercel model-facing paths should be `/workspace`. Do not expose `/vercel/sandbox` in prompts or observations.
|
|
184
|
-
|
|
185
|
-
## local (bwrap)
|
|
186
|
-
|
|
187
|
-
Linux only. Wraps tool execution in a `bubblewrap` sandbox. The workspace root is mounted read-write at `/workspace`; the rest of the filesystem is read-only.
|
|
188
|
-
|
|
189
|
-
```bash
|
|
190
|
-
BORING_AGENT_MODE=local
|
|
191
|
-
BORING_AGENT_WORKSPACE_ROOT=/home/ubuntu/projects/my-app # host config input
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
The host workspace path is adapter-private. Inside the runtime/model-visible
|
|
195
|
-
namespace, cwd, file-tree root, and `BORING_AGENT_WORKSPACE_ROOT` should all be
|
|
196
|
-
`/workspace`.
|
|
197
|
-
|
|
198
|
-
## direct
|
|
199
|
-
|
|
200
|
-
Direct mode runs tools in the host workspace and is intended for trusted local development.
|
|
201
|
-
|
|
202
|
-
```bash
|
|
203
|
-
BORING_AGENT_MODE=direct
|
|
204
|
-
BORING_AGENT_WORKSPACE_ROOT=/absolute/path/to/workspace
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
In direct mode, host paths are expected: `runtimeCwd` is the real `BORING_AGENT_WORKSPACE_ROOT`.
|
|
208
|
-
|
|
209
|
-
## Workspace root
|
|
210
|
-
|
|
211
|
-
Config input:
|
|
212
|
-
|
|
213
|
-
```bash
|
|
214
|
-
BORING_AGENT_WORKSPACE_ROOT=/absolute/path/to/workspace
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
When unset, it defaults to the current working directory at server start.
|
|
218
|
-
In `direct` mode this is also the model-visible workspace root. In isolated
|
|
219
|
-
modes, the adapter maps that host path into the public runtime namespace
|
|
220
|
-
(`/workspace`).
|
|
221
|
-
|
|
222
|
-
### Production storage roots in `vercel-sandbox` mode
|
|
223
|
-
|
|
224
|
-
In a hosted app using `BORING_AGENT_MODE=vercel-sandbox`, there are two
|
|
225
|
-
filesystems with different jobs:
|
|
226
|
-
|
|
227
|
-
```txt
|
|
228
|
-
App container / mounted volume:
|
|
229
|
-
/data/workspaces/<workspaceId> host/control-plane workspace anchor
|
|
230
|
-
/data/pi-sessions/<workspaceId> durable chat transcript storage
|
|
231
|
-
|
|
232
|
-
Vercel sandbox:
|
|
233
|
-
/workspace agent-visible cwd, file tree, and shell root
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
`BORING_AGENT_WORKSPACE_ROOT=/data/workspaces` is a host-side configuration
|
|
237
|
-
input. Core resolves each authorized workspace to `/data/workspaces/<id>` and
|
|
238
|
-
ensures that directory exists so host-side resource lookups have a durable,
|
|
239
|
-
workspace-scoped anchor. In `vercel-sandbox` mode, it is not where normal agent
|
|
240
|
-
file edits, shell output, Python files, or uploaded workspace files should live.
|
|
241
|
-
Those belong to the sandbox runtime root, `/workspace`.
|
|
242
|
-
|
|
243
|
-
Production chat history also must not use the container root filesystem. Set
|
|
244
|
-
`BORING_AGENT_SESSION_ROOT` to a mounted-volume path such as `/data/pi-sessions`
|
|
245
|
-
so Pi wrapper/native transcripts survive host deploys and restarts. Core-hosted
|
|
246
|
-
apps that run `vercel-sandbox` with `BORING_AGENT_WORKSPACE_ROOT=/data/workspaces`
|
|
247
|
-
default this to the sibling `/data/pi-sessions` path when the env var is absent.
|
|
248
|
-
|
|
249
|
-
## Adding a custom runtime mode
|
|
250
|
-
|
|
251
|
-
A boring-bash-active mode is a `RuntimeModeAdapter` (defined in
|
|
252
|
-
`src/server/runtime/mode.ts`). There is no registry to edit: pass your adapter
|
|
253
|
-
as the `runtimeModeAdapter` option to `createAgentApp(opts)` or
|
|
254
|
-
`registerAgentRoutes(app, opts)` — it takes precedence over
|
|
255
|
-
`mode`/auto-detection (`createAgentApp.ts`, `registerAgentRoutes.ts`).
|
|
256
|
-
`resolveMode()` only knows the three built-ins and throws for unknown ids,
|
|
257
|
-
telling you to pass `runtimeModeAdapter`.
|
|
258
|
-
|
|
259
|
-
Each adapter provides a workspace, filesystem/search, and sandbox/execution
|
|
260
|
-
substrate as one runtime bundle.
|
|
261
|
-
|
|
262
|
-
```ts
|
|
263
|
-
interface RuntimeModeAdapter {
|
|
264
|
-
id: string // built-ins: 'direct' | 'local' | 'blaxel' | 'vercel-sandbox'
|
|
265
|
-
workspaceFsCapability?: Workspace['fsCapability']
|
|
266
|
-
// describes how much host-side fs access exists before create();
|
|
267
|
-
// remote backends must not claim strong host visibility
|
|
268
|
-
runtimeHost?: AgentRuntimeHostOperations // host-owned workspace/path/bwrap operations
|
|
269
|
-
create(ctx: ModeContext): Promise<RuntimeBundle>
|
|
270
|
-
dispose?(): Promise<void>
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
interface RuntimeBundle {
|
|
274
|
-
runtimeContext?: WorkspaceRuntimeContext // e.g. { runtimeCwd: '/workspace' }
|
|
275
|
-
storageRoot?: string // host path for host-fs tools; required unless the
|
|
276
|
-
// workspace itself resolves a host root. NOT the
|
|
277
|
-
// agent-visible cwd — Workspace.root stays the public namespace
|
|
278
|
-
workspace: Workspace // your filesystem adapter
|
|
279
|
-
sandbox: Sandbox // your exec adapter — MUST share the workspace's
|
|
280
|
-
// filesystem substrate (invariant 5: mixed pairings = split-brain)
|
|
281
|
-
fileSearch: FileSearch // createServerFileSearch(workspace, sandbox) usually
|
|
282
|
-
provisioningAdapter?: WorkspaceProvisioningAdapter
|
|
283
|
-
// provisioning bound to this acquired pair
|
|
284
|
-
disposeRuntime?: () => Promise<void> // releases this acquired pair exactly once
|
|
285
|
-
}
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
Reference composition to copy: `packages/workspace/src/app/server/sandboxRuntimeHost.ts`,
|
|
289
|
-
which creates package-owned providers and injects host operations into the
|
|
290
|
-
generic Agent mode factories. Tests to extend:
|
|
291
|
-
`src/server/runtime/__tests__/resolveMode.test.ts`.
|
|
292
|
-
|
|
293
|
-
Rules that must hold: the adapter owns path validation (reject `../`,
|
|
294
|
-
absolute, symlink escapes — see `@hachej/boring-sandbox/providers/node-workspace`); Workspace +
|
|
295
|
-
Sandbox swap as a pair; consumers receive `Workspace` as a parameter and never
|
|
296
|
-
see raw paths.
|
package/docs/tools.md
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
> The boring-ui agent has a built-in tool catalog. Ask it to use or extend these tools.
|
|
2
|
-
|
|
3
|
-
# Agent Tools
|
|
4
|
-
|
|
5
|
-
The agent runtime ships a catalog of tools for interacting with the workspace filesystem and shell.
|
|
6
|
-
|
|
7
|
-
## Filesystem + shell tools
|
|
8
|
-
|
|
9
|
-
These are adapted from `@earendil-works/pi-coding-agent` and bound to the
|
|
10
|
-
selected runtime mode (see [runtime.md](./runtime.md)):
|
|
11
|
-
|
|
12
|
-
| tool | description |
|
|
13
|
-
|---|---|
|
|
14
|
-
| `read` | Read a file's contents |
|
|
15
|
-
| `write` | Write or overwrite a file |
|
|
16
|
-
| `edit` | Apply a targeted string replacement to a file |
|
|
17
|
-
| `bash` | Execute a shell command |
|
|
18
|
-
| `find` | Find files by name pattern |
|
|
19
|
-
| `grep` | Search file contents |
|
|
20
|
-
| `ls` | List directory contents |
|
|
21
|
-
|
|
22
|
-
## Tools added by this package
|
|
23
|
-
|
|
24
|
-
| tool | description |
|
|
25
|
-
|---|---|
|
|
26
|
-
| `execute_isolated_code` | Run code in an isolated sandbox capability |
|
|
27
|
-
| `upload_file` | Upload a workspace file to blob storage |
|
|
28
|
-
| `plugin_diagnostics` | Report loaded plugins and any load errors |
|
|
29
|
-
|
|
30
|
-
## UI-bridge tools (workspace-owned)
|
|
31
|
-
|
|
32
|
-
`exec_ui` and `get_ui_state` are **not** part of the standalone agent. They are
|
|
33
|
-
contributed by `@hachej/boring-workspace` when the agent is mounted via the
|
|
34
|
-
workspace-composed server surfaces (typically `createWorkspaceAgentServer`).
|
|
35
|
-
Standalone `createAgentApp` ships no UI tools. For the UI command reference see
|
|
36
|
-
`packages/workspace/docs/PLUGIN_SYSTEM.md`.
|
|
37
|
-
|
|
38
|
-
## Adding custom tools
|
|
39
|
-
|
|
40
|
-
Three paths — pick by who owns the tool and how it should update:
|
|
41
|
-
|
|
42
|
-
| Path | Use when | Lifecycle |
|
|
43
|
-
| --- | --- | --- |
|
|
44
|
-
| `createAgentApp({ extraTools })` | App shell owns the tool, standalone agent | Boot-time |
|
|
45
|
-
| `defineServerPlugin({ agentTools })` | A workspace plugin package contributes it | Boot-time |
|
|
46
|
-
| Pi resources (`package.json#pi`, often in runtime plugins under `.pi/extensions/<name>/`) | Tool/skill/chat behavior should hot-reload with `/reload` | Hot-reloadable |
|
|
47
|
-
|
|
48
|
-
**App-shell `extraTools`** — the simplest path for a standalone agent: pass
|
|
49
|
-
`extraTools: [myTool]` to `createAgentApp(...)` (or `registerAgentRoutes`).
|
|
50
|
-
Runnable example with a custom renderer:
|
|
51
|
-
[`examples/with-custom-tool`](../examples/with-custom-tool/README.md).
|
|
52
|
-
Collision precedence is built-in → `extraTools` → plugin tools, last wins
|
|
53
|
-
(see [PLUGINS.md](./PLUGINS.md)).
|
|
54
|
-
|
|
55
|
-
**Workspace server plugin** — for statically composed app/server integrations,
|
|
56
|
-
contribute tools from a workspace server plugin:
|
|
57
|
-
|
|
58
|
-
```ts
|
|
59
|
-
import { defineServerPlugin } from "@hachej/boring-workspace/server"
|
|
60
|
-
|
|
61
|
-
export default defineServerPlugin({
|
|
62
|
-
id: "my-plugin",
|
|
63
|
-
systemPrompt: "Use my_tool when the user asks to process an item.",
|
|
64
|
-
agentTools: [
|
|
65
|
-
{
|
|
66
|
-
name: "my_tool",
|
|
67
|
-
description: "Does something useful",
|
|
68
|
-
parameters: {
|
|
69
|
-
type: "object",
|
|
70
|
-
properties: { id: { type: "string" } },
|
|
71
|
-
required: ["id"],
|
|
72
|
-
additionalProperties: false,
|
|
73
|
-
},
|
|
74
|
-
async execute(params) {
|
|
75
|
-
return {
|
|
76
|
-
content: [{ type: "text", text: `processed ${String(params.id)}` }],
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
})
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
Expose that entry with `package.json#boring.server` or pass the plugin object to
|
|
85
|
-
`createWorkspaceAgentServer({ plugins: [...] })`. This is static/boot-time
|
|
86
|
-
server composition; restart the host process after changing routes or tools.
|
|
87
|
-
`execute(params, ctx)` also receives a context (`abortSignal`, `toolCallId`,
|
|
88
|
-
`onUpdate`) — full contract in [PLUGINS.md](./PLUGINS.md#tool-contract).
|
|
89
|
-
|
|
90
|
-
**Pi-native resources** — for hot-reloadable chat behavior in user plugin packages, prefer Pi-native
|
|
91
|
-
resources declared in `package.json#pi` (`extensions`, `skills`, `prompts`, and
|
|
92
|
-
`systemPrompt`). Those participate in the `/reload` path and are the right
|
|
93
|
-
place for tools/skills that should update without restarting the workspace
|
|
94
|
-
server.
|
|
95
|
-
|
|
96
|
-
## Optional trusted plugin tools
|
|
97
|
-
|
|
98
|
-
App hosts may add tools through trusted Workspace server plugins. Disposable lease support is additive: the optional sandbox plugin supplies `sandbox` and `sandbox_bash` without changing canonical bash or file-tool schemas. Agent-authored plugin selection alone cannot grant that host authority.
|
|
99
|
-
|
|
100
|
-
## Runtime modes
|
|
101
|
-
|
|
102
|
-
See [runtime.md](./runtime.md) for how tool execution is sandboxed.
|