agent-trellis 0.4.0 → 0.6.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.
Files changed (62) hide show
  1. package/dist/adapters/codex.js +4 -1
  2. package/dist/adapters/jsonMcp.js +6 -3
  3. package/dist/adapters/kiro.js +9 -1
  4. package/dist/adapters/mcpPlan.d.ts +15 -0
  5. package/dist/adapters/mcpPlan.js +59 -3
  6. package/dist/adapters/symlinkPlan.js +3 -0
  7. package/dist/cli.js +56 -8
  8. package/dist/commands/doctor.d.ts +13 -3
  9. package/dist/commands/doctor.js +20 -10
  10. package/dist/commands/mcpAuth.d.ts +28 -0
  11. package/dist/commands/mcpAuth.js +99 -0
  12. package/dist/commands/mcpGateway.d.ts +53 -0
  13. package/dist/commands/mcpGateway.js +148 -0
  14. package/dist/commands/memory.d.ts +42 -19
  15. package/dist/commands/memory.js +99 -14
  16. package/dist/commands/migrate.d.ts +18 -1
  17. package/dist/commands/migrate.js +52 -6
  18. package/dist/commands/onboard.d.ts +34 -0
  19. package/dist/commands/onboard.js +110 -10
  20. package/dist/commands/onboardVerdict.d.ts +55 -0
  21. package/dist/commands/onboardVerdict.js +175 -0
  22. package/dist/core/adapter.d.ts +7 -0
  23. package/dist/core/canonical.d.ts +8 -6
  24. package/dist/core/canonical.js +26 -3
  25. package/dist/core/types.d.ts +42 -4
  26. package/dist/lib/backup.js +32 -3
  27. package/dist/lib/gatewayBackend.d.ts +75 -0
  28. package/dist/lib/gatewayBackend.js +131 -0
  29. package/dist/lib/mcpConnect.d.ts +53 -0
  30. package/dist/lib/mcpConnect.js +123 -0
  31. package/dist/lib/mcpMigrateRead.d.ts +12 -0
  32. package/dist/lib/mcpMigrateRead.js +47 -12
  33. package/dist/lib/mcpToolRegistry.d.ts +89 -0
  34. package/dist/lib/mcpToolRegistry.js +94 -0
  35. package/dist/lib/memoryGraph.d.ts +35 -0
  36. package/dist/lib/memoryGraph.js +62 -0
  37. package/dist/lib/oauth/discovery.d.ts +53 -0
  38. package/dist/lib/oauth/discovery.js +95 -0
  39. package/dist/lib/oauth/flow.d.ts +47 -0
  40. package/dist/lib/oauth/flow.js +193 -0
  41. package/dist/lib/oauth/lock.d.ts +25 -0
  42. package/dist/lib/oauth/lock.js +98 -0
  43. package/dist/lib/oauth/pkce.d.ts +27 -0
  44. package/dist/lib/oauth/pkce.js +40 -0
  45. package/dist/lib/oauth/refresh.d.ts +33 -0
  46. package/dist/lib/oauth/refresh.js +93 -0
  47. package/dist/lib/oauth/store.d.ts +55 -0
  48. package/dist/lib/oauth/store.js +85 -0
  49. package/dist/lib/slug.d.ts +9 -0
  50. package/dist/lib/slug.js +15 -0
  51. package/dist/lib/tomlSection.js +7 -1
  52. package/dist/pi-bridge/bundle.js +14383 -14338
  53. package/dist/pi-bridge/index.d.ts +5 -9
  54. package/dist/pi-bridge/index.js +6 -99
  55. package/dist/pi-bridge/schemaTranslate.d.ts +8 -2
  56. package/dist/pi-bridge/schemaTranslate.js +8 -4
  57. package/docs/architecture.md +88 -19
  58. package/docs/getting-started.md +174 -11
  59. package/docs/research.md +190 -0
  60. package/docs/roadmap.md +20 -0
  61. package/package.json +4 -3
  62. package/schema/servers.example.yaml +42 -7
package/docs/research.md CHANGED
@@ -120,6 +120,17 @@ clients." Mature, but needs Docker + an LLM key. Documented as the
120
120
  upgrade path for cross-machine or richer semantic memory, alongside
121
121
  `totalrecallai` as a second real option in that same category.
122
122
 
123
+ Two commands, one direction each: `trellis memory sync` (canonical
124
+ `memories/*.md` → the shared graph file) and `trellis memory extract`
125
+ (the graph's own real, non-Trellis entities → new canonical files) —
126
+ closing P15's own explicitly-named "per-agent extraction into canonical
127
+ remains a separate, open gap." The two are not symmetric round-trips:
128
+ canonical's memory model is one flat blob per file, the graph's native
129
+ model is typed entities plus a relation graph, so extraction is a
130
+ one-way, lossy-in-structure (not in substance) transcription, not a
131
+ serialization format — see `docs/getting-started.md`'s `memory extract`
132
+ section for the exact trade-off.
133
+
123
134
  ## Secrets (formalize existing practice, don't build new infra)
124
135
 
125
136
  The 2026 consensus across 1Password, Vault, Infisical writeups is uniform:
@@ -133,6 +144,19 @@ which was silently invalid). Trellis's contribution here is `trellis secrets
133
144
  audit` — a linter that fails a build if any adapter output contains a raw
134
145
  credential — not a new secret store.
135
146
 
147
+ A third real incident during migrate-in: a source config's `${VAR}`
148
+ reference doesn't always name itself (`OPENAPI_MCP_HEADERS:
149
+ "${NOTION_OPENAPI_MCP_HEADERS}"`, a real Notion MCP server entry). Migrate's
150
+ read path originally only recognized a same-named reference as one; a
151
+ differently-named reference silently fell through as a literal, unexpanded
152
+ value — harmless on Claude Code/Codex (both expand `${VAR}` themselves from
153
+ their own native config format), but a hard crash on pi, whose bridge has no
154
+ `${VAR}` runtime of its own and merges an unrecognized value verbatim.
155
+ `McpServerDef.envAliases` (target key → source variable name) closes this:
156
+ every agent's adapter renders it through the exact same reference mechanism
157
+ `env` already uses, and the pi bridge resolves it through the exact same
158
+ `resolveSecretEnv` call.
159
+
136
160
  ## pi coding agent — the one place we write real code, not config generation
137
161
 
138
162
  Reverse-engineered directly from the installed binary
@@ -155,6 +179,172 @@ Reverse-engineered directly from the installed binary
155
179
  genuine code, not config templating — see
156
180
  [`src/adapters/pi/`](../src/adapters/pi).
157
181
 
182
+ ## Cross-machine / cloud sharing — surveyed 2026-09-15, future direction confirmed
183
+
184
+ Trellis today is single-machine-only (`docs/architecture.md`'s "Global vs.
185
+ workspace scope" section deliberately scopes out project-local merge, but
186
+ says nothing about cross-*machine* sync — that's a separate, real gap, not
187
+ something already decided against). **Cloud/cross-machine sharing is
188
+ confirmed as a future requirement, not a maybe** — the open question is
189
+ sequencing and substrate choice, not whether to build it.
190
+
191
+ Two genuinely different problems got explored together and need to stay
192
+ separate in any design that follows:
193
+
194
+ 1. **Keeping `~/.trellis` canonical source consistent across a person's own
195
+ multiple machines** (config sync — small files, low write frequency).
196
+ 2. **Coordinating agent execution across machines / providing a shared
197
+ runtime substrate** (running-process orchestration — a different problem
198
+ with different failure modes, not a natural extension of #1).
199
+
200
+ ### `cloudflare/computer` — evaluated, not adopted
201
+
202
+ [cloudflare/computer](https://github.com/cloudflare/computer) gives an
203
+ agent a durable virtual filesystem (SQLite inside a Durable Object,
204
+ `@cloudflare/dofs`) plus a pluggable execution backend (container FUSE
205
+ mount, isolate shell via `just-bash`, or isolate JS in a Dynamic Worker) —
206
+ one `workspace.runtime.exec(source, { backend })` entrypoint. Aimed at
207
+ SaaS-scale "give every concurrent agent task its own cheap, horizontally-
208
+ scalable workspace," not at syncing a handful of config files between a
209
+ person's own laptop and desktop.
210
+
211
+ Explicitly **PREVIEW ONLY** per the project's own README: "APIs are
212
+ unstable... NOT suitable for production use at this time." That alone
213
+ rules it out as a dependency today, separate from the architectural
214
+ mismatch.
215
+
216
+ The one reusable idea, if problem #1 above is tackled with a real sync
217
+ protocol later rather than git: `@cloudflare/dofs`'s sync building blocks
218
+ (`applyChanges`/`stageBlob`/`materialiseChange`/`fetchChanges`/
219
+ `buildManifest`/`currentRev`/watermark cursors) are a clean change-set +
220
+ content-addressed-blob + watermark model worth studying as a *design
221
+ reference*, not a dependency — adopting the package itself means adopting
222
+ Cloudflare Durable Objects as a required backend, which is a vendor
223
+ commitment Trellis has never needed for anything else it does (everything
224
+ else runs as a local CLI against local files).
225
+
226
+ **Recommendation for problem #1**: start with git as the sync transport
227
+ (`~/.trellis` is already just markdown/YAML — a natural git repo; `trellis
228
+ sync` gains a `git pull --rebase`/`git push` step, conflicts resolved by
229
+ git's own mechanism) before building or adopting any bespoke sync engine.
230
+ Matches the project's own existing principle for MCP hub mode — "no engine
231
+ switch in the type, only a URL" — apply the same discipline here: don't
232
+ build sync-engine abstraction ahead of validating that git alone doesn't
233
+ already solve it.
234
+
235
+ ### Letta Cloud's "Agent state" — evaluated as a hosted-state model, not adopted
236
+
237
+ Surveyed 2026-09-16 after recognizing the shape from
238
+ [letta-ai/letta-code](https://github.com/letta-ai/letta-code): Letta Cloud
239
+ keeps an agent's memory, identity, and conversation history entirely
240
+ server-side; any machine (laptop, Cloud VM, Mac Mini, GitHub Actions) can
241
+ run the `letta server` harness against that same state
242
+ ([README](https://github.com/letta-ai/letta-code/blob/main/README.md),
243
+ [Constellation docs](https://docs.letta.com/letta-code/constellation)).
244
+ Confirmed by reading the actual mechanism, not just the marketing diagram:
245
+
246
+ - **Attach is outbound-only.** `letta server --env-name "work-laptop"`
247
+ opens one outbound WebSocket to Letta Cloud — no inbound port, ever
248
+ ([BYOM docs](https://docs.letta.com/platform/computers/byom)). OAuth
249
+ device-flow credentials persist under `~/.letta/` so reconnects are
250
+ silent.
251
+ - **"Teleportation" (moving execution between machines) is a sequenced
252
+ single-writer handoff, never concurrent.** The source machine finishes
253
+ its current tool call, stops accepting new work, and releases before
254
+ the destination starts; "a conversation can have only one teleport in
255
+ flight at a time," and a failed handoff leaves the conversation on the
256
+ source rather than in a split state
257
+ ([Teleportation docs](https://docs.letta.com/platform/computers/teleportation)).
258
+ Memory, message history, pending tool approvals, credentials, and
259
+ permission mode move with it; files, working directories, running
260
+ processes, and installed dependencies do not — the destination
261
+ reconstructs its own environment rather than receiving a filesystem
262
+ snapshot.
263
+ - **Even with a fully hosted state store, Letta's own docs still tell
264
+ users to mirror agent memory to GitHub** via `/memory-repository` as a
265
+ backup. The vendor that built the hosted-state alternative does not
266
+ treat it as a substitute for a plain, git-friendly copy.
267
+
268
+ **Not adopted as a model for Trellis's own cross-machine problem, and the
269
+ reason is structural, not a maturity/cost judgment**: Letta's "agent
270
+ state" is the runtime state of an agent Letta itself executes — its own
271
+ first-party memory and conversation loop. Trellis has no equivalent to
272
+ host: canonical (`~/.trellis`) is *configuration projected into* other
273
+ vendors' agents (Claude Code, Codex, Kiro), whose own sessions, auth, and
274
+ runtime state Trellis never touches and has no execution loop of its own
275
+ to hand off. There is no "conversation" for a Trellis-hosted service to
276
+ teleport — Trellis's job ends at writing correct config to disk on the
277
+ one machine it's invoked on. Building a hosted canonical-state service to
278
+ mirror Letta's shape would mean Trellis becoming a resident,
279
+ account-backed service — the same "material shift... needs its own
280
+ explicit sign-off" line `trellis-mcp-gateway-hosting`'s proposal.md
281
+ already drew around operating so much as a spawned subprocess, applied
282
+ here to something with a much larger blast radius (a user's actual
283
+ configuration data, not a per-session child process).
284
+
285
+ **Two mechanisms are worth recording anyway — not as new ideas to adopt,
286
+ but as independent confirmation that designs already committed to
287
+ elsewhere in this project land on the same shape a production
288
+ multi-machine system converged on:**
289
+
290
+ 1. Outbound-only, no-daemon-to-babysit attach is exactly
291
+ `trellis-mcp-gateway-hosting`'s own shape (design.md D2/D13) — an
292
+ agent spawns `trellis mcp-gateway`, it connects out, it exits with the
293
+ session. Letta using the identical pattern for "any machine attaches
294
+ to hosted state" is evidence the shape generalizes, not a coincidence
295
+ worth re-deriving from scratch if problem #2 (a shared runtime
296
+ substrate) is ever built.
297
+ 2. Sequenced single-writer handoff — finish, release, then let the next
298
+ party proceed — is exactly the OAuth refresh lock's shape
299
+ (`trellis-mcp-gateway-hosting` design.md D16, `withServerLock`:
300
+ acquire, re-read to check whether the work is already done, act, or
301
+ defer). Same problem (two parties who might touch shared state at
302
+ once), same answer (serialize, never split), arrived at independently
303
+ in a completely different subsystem.
304
+
305
+ **Standing recommendation unchanged**: git remains the right transport
306
+ for problem #1. This survey is a reason to be confident in that choice,
307
+ not a reason to revisit it — the hosted-state alternative was evaluated
308
+ on its merits and excluded on structural grounds, and even its own
309
+ vendor keeps a git-based fallback for the same category of data Trellis
310
+ already treats git-friendly YAML/Markdown as the source of truth for.
311
+
312
+ ### Sandbox / execution substrate landscape — problem #2
313
+
314
+ Surveyed for "a place agents actually run" rather than "a place config
315
+ gets copied to":
316
+
317
+ | Project | Model | License / status | Notes |
318
+ |---|---|---|---|
319
+ | [dagger/container-use](https://github.com/dagger/container-use) | MCP server; each agent gets an isolated container + its own git branch | Apache-2.0-adjacent, early/active | Works with *any* MCP-compatible agent, no vendor lock-in per its own README; `git checkout <branch>` to review any agent's work. Lightest-weight fit for Trellis's existing "MCP is the one place we write real integration code" model — could ship as a documented default MCP server entry with zero new adapter code, the same way `memory` (P6) was added |
320
+ | [awslabs/cli-agent-orchestrator](https://github.com/awslabs/cli-agent-orchestrator) (CAO) | Local `cao-server` + per-agent isolated tmux sessions; supervisor/worker delegation; Web UI, HTTP API, PTY WebSocket; K8s deployment (shared workspace, per-pod state, credential delivery) | Apache-2.0, active (AWS) | **Directly supports Kiro CLI, Claude Code, and Codex CLI** — three of Trellis's four managed agents by name. Closest existing match to "run agents more smoothly + fleet management," and the closest existing candidate for problem #2 (cross-machine coordination) via its K8s deployment story. Not yet verified against Trellis's own canonical source/scope model — CAO has its own agent-profile concept, which is a second place "what an agent is configured to do" could live, the exact fragmentation class `docs/research.md`'s mcp-router incident (§ MCP aggregation) already warns about |
321
+ | [daytonaio/daytona](https://github.com/daytonaio/daytona) | Firecracker-level sandbox infra, multi-language SDKs | Open-source repo, **but its own README states core development moved to a private codebase as of June 2026 — "no longer maintained"** | Ruled out: not an active open-source target to build on |
322
+ | [e2b-dev/E2B](https://github.com/e2b-dev/E2B), [opensandbox-group/OpenSandbox](https://github.com/opensandbox-group/OpenSandbox) | Firecracker microVM / Docker+K8s one-shot code-execution sandboxes | E2B mostly managed (weak self-host story); OpenSandbox self-hostable | Both model "spin up a sandbox per code execution," not "keep a long-lived agent runtime consistent across a person's machines" — weaker fit than container-use/CAO for Trellis's actual use case |
323
+
324
+ ### Recommended path, not yet built
325
+
326
+ 1. **Cheapest, ships now, zero new adapter code**: document `container-use`
327
+ as an optional MCP server entry in `schema/servers.example.yaml`
328
+ (same pattern P6 used for `memory`) — every managed agent gets isolated,
329
+ disposable containers per task through the exact mechanism Trellis
330
+ already has for distributing MCP config. No cross-machine claim yet,
331
+ just "agents run more safely/smoothly," which is this session's own
332
+ stated ask.
333
+ 2. **Validate cross-machine config sync with git before building anything
334
+ bespoke** (problem #1) — smallest possible experiment, no new runtime
335
+ dependency.
336
+ 3. **Evaluate CAO as the substrate for problem #2** (cross-machine
337
+ coordination) only after #1 and #2 are separately validated as real,
338
+ distinct needs — specifically check whether its agent-profile model can
339
+ be made to read Trellis's canonical source rather than becoming a
340
+ second source of truth. This is new-project-scale work, not an
341
+ incremental Trellis phase — should get its own openspec proposal with
342
+ explicit success criteria before any code is written.
343
+
344
+ None of the above is built yet. This section exists so the next design
345
+ pass starts from "what was already checked" instead of re-surveying the
346
+ same ground.
347
+
158
348
  ## Codex — three hard constraints learned by breaking them
159
349
 
160
350
  All three below came from real incidents, not upfront design, and any Codex
package/docs/roadmap.md CHANGED
@@ -948,6 +948,26 @@ tests passing.
948
948
  | P15 | ✅ Shared memory: ingest canonical `memories/*.md` into the `server-memory` store's own graph file (per-agent extraction into canonical remains a separate, open gap) | P6 |
949
949
  | P16 | ✅ MCP migrate-in: `trellis migrate --only mcp` for claude-code/kiro/codex (codex remote transport + probe HOME-scoping closed same-day, see prose above), closing the gap P14 named | P12, P14 |
950
950
  | P17 | ✅ `onboard` orchestration catches up to P15/P16: three-way migrate-category selection (mcp added), `memory sync` wired in as a chained stage | P15, P16 |
951
+ | P18 | ✅ `envAliases`: a migrated `${NAME}` env reference whose name differs from its own key (found via live dogfooding — a real Notion MCP server crashing pi after migrate, not a hypothetical) is now recognized as a reference, not silently shipped as literal unexpanded placeholder text. New `McpServerDef.envAliases` field, threaded through migrate-read (both JSON and Codex TOML sources), every adapter's write path, the pre-write unresolvable-env refusal guard, the pi bridge's runtime resolution, and canonical's own `env_aliases`/`envAliases` on-disk round-trip | P16 |
952
+ | P19 | ✅ Migrate reclassify-repair: found immediately after P18 shipped — re-running migrate on data migrated *before* a classification fix didn't pick the fix up at all, since `planMcpServer`'s conflict check was plain `deepEqual` (any structural difference, real customization or not, was refused as "resolve by hand"). New narrow `isSafeReclassification` check + `"reclassify"` migrate action: applied automatically when a value only moved between `staticEnv`/`env`/`envAliases` while resolving to the exact same literal/reference text, everything else identical; any real difference still conflicts, unchanged. Verified for real on this machine: `migrate --from claude-code --only mcp` correctly reclassified notion's stale entry and left all 8 other already-migrated servers untouched | P18 |
953
+ | P20 | ✅ Memory extraction: closes P15's own explicitly-named "per-agent extraction into canonical remains a separate, open gap." New `trellis memory extract` — the reverse of `memory sync` — reads the shared graph's real, non-`trellis-memory` entities (the same ownership marker `memory sync` already uses to leave agent-created content untouched, read the other direction) and writes each as a new canonical `memories/*.md` file: readable markdown, not a serialization format, not meant to round-trip byte-for-byte back through `memory sync`. Same create/no-op/conflict discipline as every other Trellis write; not wired into `onboard`'s automatic chain (a deliberate, occasional action, like `migrate`) | P15 |
954
+ | P21 | ✅ MCP gateway hosting: collapses each agent's MCP config to ONE native stdio entry (`trellis mcp-gateway --agent <id>`) that Trellis itself spawns — no Docker, no daemon, no lifecycle command. Four third-party gateways were evaluated and excluded on hard constraints (MetaMCP is Docker-only; mcp-local-hub is Windows-only today; `@samanhappy/mcphub` is a 43-dependency authenticated web product with no importable SDK surface; `@pcandido/mcphub` has correct OAuth but zero `${VAR}` expansion in its stdio `env`, verified by inspecting what a spawned child actually received — adopting it would mean plaintext secrets or a second resolution path outside `secrets audit`). Built instead on `pi-bridge`'s already-proven connect logic, extracted to `src/lib/mcpConnect.ts`, behind a `GatewayBackend` seam so the confirmed next step — one shared service for all agents, with the per-session process becoming a thin MCP-over-Unix-socket client — is a substitution at one construction site, with every agent's written config identical either way. Includes Trellis's own OAuth client (RFC 8414/9728 discovery, RFC 7591 DCR, RFC 7636 PKCE S256, refresh), tested against a hand-built Authorization Server that *enforces* those RFCs rather than rubber-stamping them; tokens live 0600 one-file-per-server outside canonical, never the OS keychain (macOS `security add-generic-password` measurably fails exit 152/154 with no GUI session — the gateway's exact context). Two bugs the design caught before shipping: the MCP SDK's stdio transport reports no EOF, so without explicit teardown every agent session would leak a gateway plus its whole upstream process set; and concurrent OAuth refresh silently kills a rotated refresh token, so it is serialized by a per-server lock. Remaining: the shared service itself (v2) | P2 |
955
+ | P22 | ✅ Onboard closed loop: onboard used to stop the moment files were written, never checking whether any of it took effect, and never telling the user how the run went — a real run with a genuine sync conflict still ended its printed output on a later stage's unrelated green line. Two distinct fixes, not one: a **self-verification re-plan** (the mechanism that actually closes the loop) runs `sync`/`mcp sync` a second time, dry-run, immediately after their real apply, and treats anything still outstanding as its own blocking finding — `trellis doctor` was tried first and rejected for this job, since its six detectors compare agents against each other and never read canonical, so they cannot prove a write took effect even in principle. Doctor still runs, last, as a secondary whole-machine health scan (never `--probe-mcp` — the worst moment to spawn every configured MCP server is a user's first run of this command), with findings on an unmanaged agent demoted to a warning rather than hidden. Every stage's conflicts and findings normalize into one `VerdictItem[]`, printed as a terminal verdict block that is always the last thing on screen and always agrees with the exit code, each blocking item carrying a concrete remediation instead of a restatement of the problem. Also adds stage progress to stderr (never stdout, so `onboard > report.txt` stays exactly the report) and, on a real terminal, a `--dry-run` that ends by offering to apply (declining is the default; accepting re-plans against current state rather than replaying a now-stale preview) | P0 |
956
+
957
+ **Cross-machine / cloud sharing — confirmed future direction, not yet
958
+ scoped as a phase.** Surveyed 2026-09-15 (`docs/research.md`'s "Cross-
959
+ machine / cloud sharing" section): keeping `~/.trellis` consistent across
960
+ a person's own multiple machines, and separately, providing a smoother/
961
+ shared runtime substrate for agents to actually execute in, are both
962
+ confirmed as real, wanted future capabilities — not yet broken into a
963
+ numbered phase because the substrate choice needs its own validation pass
964
+ first (git-based sync for the config side; `dagger/container-use` as a
965
+ zero-new-code MCP server entry for safer per-task sandboxing; `awslabs/
966
+ cli-agent-orchestrator` as a candidate for actual cross-machine
967
+ coordination, evaluated only after the simpler pieces are proven). See
968
+ `docs/research.md` for the full survey, including why `cloudflare/computer`
969
+ and `daytonaio/daytona` were both evaluated and not adopted (preview-only
970
+ API instability, and unmaintained-as-of-June-2026, respectively).
951
971
 
952
972
  No dates. This is scoped by verification milestones, not calendar time.
953
973
  Execution order for P11–P16: P11 → P12 → P13 → P14 → P15 → P16 — CRUD
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-trellis",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "A single source of capability for every coding agent — skills, MCP, subagents, memory, and secret policy, adapted natively into Claude Code, Codex, Kiro, and pi.",
5
5
  "license": "MIT",
6
6
  "author": "Paul Leo",
@@ -26,8 +26,9 @@
26
26
  "build": "tsc -p tsconfig.json && node scripts/build-pi-bridge.mjs",
27
27
  "dev": "tsx src/cli.ts",
28
28
  "typecheck": "tsc --noEmit",
29
- "test": "tsx --test test/unit/**/*.test.ts",
30
- "prepublishOnly": "npm run typecheck && npm test && npm run build"
29
+ "pretest": "node scripts/build-pi-bridge.mjs",
30
+ "test": "tsx --test \"test/unit/**/*.test.ts\"",
31
+ "prepublishOnly": "npm run typecheck && npm run build && npm test"
31
32
  },
32
33
  "engines": {
33
34
  "node": ">=20"
@@ -11,6 +11,12 @@
11
11
  # scanned against `reject_patterns` like everything else, so a real
12
12
  # credential accidentally placed there is still refused, not silently
13
13
  # written (trellis-mcp-static-env-and-disabled-servers).
14
+ # - `env_aliases` is for a var whose own name differs from the name it
15
+ # should resolve (`target_key: source_variable_name`) — resolved
16
+ # through the exact same mechanism as `env`, just delivered under a
17
+ # different key. Do NOT reach for `static_env` here: a "${SOURCE_NAME}"
18
+ # string looks like it works but ships unexpanded to any agent with no
19
+ # `${VAR}` runtime of its own (trellis-migrate-env-var-alias).
14
20
  # - `enabled: false` keeps a server's definition in canonical without
15
21
  # writing it to any agent — for a server you want to keep configured
16
22
  # but not currently active everywhere, matching how a real agent's
@@ -78,6 +84,18 @@ servers:
78
84
  args: ["-y", "@zereight/mcp-gitlab"]
79
85
  env: [GITLAB_PERSONAL_ACCESS_TOKEN, GITLAB_API_URL]
80
86
 
87
+ # `env_aliases`: the server wants `OPENAPI_MCP_HEADERS`, but your secret
88
+ # manager holds it under a differently-named variable — a real example
89
+ # found via migrating an actual Notion MCP server entry. Same resolution
90
+ # discipline as `env`, just target-key -> source-name instead of
91
+ # self-named.
92
+ notion:
93
+ transport: stdio
94
+ command: npx
95
+ args: ["-y", "@notionhq/notion-mcp-server"]
96
+ env_aliases:
97
+ OPENAPI_MCP_HEADERS: NOTION_OPENAPI_MCP_HEADERS
98
+
81
99
  # `enabled: false` keeps this definition in canonical without writing it
82
100
  # to any agent — for something you want configured but not currently
83
101
  # active anywhere. Remove the line (or set it to `true`) to turn it back
@@ -110,15 +128,32 @@ known_host_injected:
110
128
  - memory
111
129
  - mirasim
112
130
 
113
- # How the servers above reach the four agents. Omit this whole block for
131
+ # How the servers above reach the four agents. Omit BOTH blocks below for
114
132
  # direct mode (today's default: every agent gets all N server definitions
115
133
  # written straight into its native config).
116
134
  #
117
- # Set it to route every agent through a single HTTP endpoint instead —
118
- # every adapter then writes exactly ONE entry (this URL), not N. What runs
119
- # behind the URL is not Trellis's concern: could be a self-hosted
120
- # github.com/ravitemer/mcp-hub instance, a hosted mcp-router account,
121
- # anything else speaking MCP over HTTP. No engine/product switch to
122
- # maintain — see docs/architecture.md "MCP hub mode".
135
+ # `hub` routes an agent through a single HTTP endpoint you operate
136
+ # somewhere else — the adapter then writes exactly ONE entry (this URL),
137
+ # not N. What runs behind the URL is not Trellis's concern: could be a
138
+ # self-hosted github.com/ravitemer/mcp-hub instance, a hosted mcp-router
139
+ # account, anything else speaking MCP over HTTP. No engine/product switch
140
+ # to maintain — see docs/architecture.md "MCP hub mode".
123
141
  hub:
124
142
  url: "http://127.0.0.1:37373/mcp"
143
+
144
+ # `gateway` also collapses an agent to one entry, but what sits behind it
145
+ # is a local subprocess Trellis itself spawns (`trellis mcp-gateway`), not
146
+ # a URL you operate. It connects out to the servers above once, resolves
147
+ # their secrets through secrets.policy.yaml exactly as direct mode does,
148
+ # and exposes their tools as `<server>__<tool>`. There is nothing to start
149
+ # or stop: the agent spawns it like any other stdio MCP server, and it
150
+ # exits when the session ends.
151
+ #
152
+ # `gateway` and `hub` are independent and may both be present; gateway
153
+ # wins for any agent it covers. Omit `agents:` — the normal case — and it
154
+ # applies to every managed agent; list them to leave the rest in direct or
155
+ # hub mode.
156
+ #
157
+ # gateway:
158
+ # enabled: true
159
+ # agents: [claude-code, codex]