agent-trellis 0.11.0 → 0.12.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/dist/adapters/mcpPlan.d.ts +1 -0
- package/dist/adapters/mcpPlan.js +14 -5
- package/dist/cli.js +1 -1
- package/dist/commands/mcp.d.ts +13 -2
- package/dist/commands/mcp.js +42 -5
- package/dist/commands/mcpAuth.d.ts +6 -0
- package/dist/commands/mcpAuth.js +38 -10
- package/dist/commands/mcpGateway.js +7 -7
- package/dist/core/canonical.d.ts +1 -0
- package/dist/core/canonical.js +8 -3
- package/dist/core/types.d.ts +4 -1
- package/dist/core/types.js +3 -0
- package/dist/lib/agentBridgeProvider.d.ts +1 -1
- package/dist/lib/gatewayBackend.d.ts +11 -0
- package/dist/lib/gatewayBackend.js +23 -4
- package/dist/lib/mcpConnect.d.ts +6 -3
- package/dist/lib/mcpConnect.js +8 -6
- package/dist/lib/mcpRuntime.d.ts +6 -2
- package/dist/lib/mcpRuntime.js +39 -29
- package/dist/lib/mcpStatusProvider.d.ts +1 -1
- package/dist/lib/memoryProvider.d.ts +1 -1
- package/dist/lib/oauth/discovery.d.ts +1 -0
- package/dist/lib/oauth/discovery.js +2 -0
- package/dist/lib/oauth/flow.d.ts +4 -0
- package/dist/lib/oauth/flow.js +48 -11
- package/dist/lib/oauth/refresh.d.ts +1 -0
- package/dist/lib/oauth/refresh.js +3 -1
- package/dist/lib/oauth/store.d.ts +2 -0
- package/dist/lib/runtimeControlProvider.d.ts +1 -1
- package/dist/lib/skillManifest.d.ts +1 -0
- package/dist/lib/skillManifest.js +1 -1
- package/dist/lib/skillProvider.d.ts +1 -1
- package/dist/lib/taskProvider.d.ts +1 -1
- package/dist/lib/upstreamResources.d.ts +23 -0
- package/dist/lib/upstreamResources.js +192 -0
- package/dist/pi-bridge/bundle.js +37558 -19584
- package/docs/architecture.md +14 -13
- package/docs/mcp-authorization-ownership.md +59 -0
- package/docs/skills-over-mcp.md +43 -31
- package/package.json +5 -2
package/docs/architecture.md
CHANGED
|
@@ -261,9 +261,9 @@ reach such a server at all.
|
|
|
261
261
|
|
|
262
262
|
Gateway mode does not automatically take ownership of OAuth servers. Mark a
|
|
263
263
|
server explicitly with `auth: oauth` (or `trellis mcp set <name> --auth oauth`)
|
|
264
|
-
and gateway planning keeps it
|
|
265
|
-
|
|
266
|
-
|
|
264
|
+
and gateway/runtime planning keeps it native. This preserves each Agent's own
|
|
265
|
+
OAuth identity. Only `auth: { kind: oauth, owner: trellis }` explicitly opts into
|
|
266
|
+
Trellis hosting, with a gateway/runtime route required. Trellis never infers this
|
|
267
267
|
classification from a URL or a transient 401.
|
|
268
268
|
|
|
269
269
|
The classification optionally carries pre-registered client metadata, for
|
|
@@ -288,18 +288,19 @@ be pre-filled.
|
|
|
288
288
|
Trellis still implements the client half itself — discovery (RFC 8414 /
|
|
289
289
|
RFC 9728), dynamic client registration (RFC 7591), authorization code with
|
|
290
290
|
PKCE S256 (RFC 7636), and the refresh grant — in `src/lib/oauth/`, but that
|
|
291
|
-
path is
|
|
292
|
-
|
|
291
|
+
path is used for explicitly hosted connections. It never imports or silently
|
|
292
|
+
replaces native Agent authorization. See
|
|
293
|
+
[MCP authorization ownership](mcp-authorization-ownership.md).
|
|
293
294
|
|
|
294
295
|
Two rules shape it, both from the constraint that the gateway is spawned
|
|
295
296
|
silently by an agent with no terminal attached:
|
|
296
297
|
|
|
297
|
-
- **Only an explicit human
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
interactive flow and
|
|
298
|
+
- **Only an explicit human action opens a browser.** Native clients use their
|
|
299
|
+
own authorization entry. Trellis-hosted connections can use the desktop
|
|
300
|
+
Authorize action or `trellis mcp auth <server>`. The gateway never initiates
|
|
301
|
+
an interactive flow and excludes Agent-owned OAuth servers.
|
|
301
302
|
- **Refreshing is silent, and serialized by a lock.** A `refresh_token`
|
|
302
|
-
grant needs neither a browser nor a callback, so the
|
|
303
|
+
grant needs neither a browser nor a callback, so the hosted gateway can
|
|
303
304
|
do it at connect time. The lock (`~/.trellis/mcp/oauth/<name>.lock`) exists
|
|
304
305
|
because most authorization servers rotate the refresh token and
|
|
305
306
|
invalidate its predecessor — two concurrent refreshes would leave one
|
|
@@ -312,8 +313,8 @@ non-interactive, no-GUI-session context the gateway runs in — measured,
|
|
|
312
313
|
not assumed).
|
|
313
314
|
|
|
314
315
|
In direct mode nothing here changes: each agent keeps using its own native
|
|
315
|
-
OAuth flow.
|
|
316
|
-
ordinary
|
|
316
|
+
OAuth flow. Gateway/runtime mode retains native entries for Agent-owned OAuth;
|
|
317
|
+
ordinary and explicitly Trellis-owned servers enter the gateway.
|
|
317
318
|
|
|
318
319
|
## MCP gateway mode
|
|
319
320
|
|
|
@@ -362,7 +363,7 @@ could reach disk.
|
|
|
362
363
|
**What it changes for the agents:** Codex's single-`bearer_token_env_var`
|
|
363
364
|
limitation stops applying, because Codex no longer receives any server's
|
|
364
365
|
`headers` — the gateway holds them. OAuth-marked servers are intentionally
|
|
365
|
-
kept
|
|
366
|
+
kept native by default; explicit Trellis ownership enables hosted OAuth. An
|
|
366
367
|
upstream tool keeps its original name when that name is unique and longer than
|
|
367
368
|
the short-name threshold; generic short names receive a compact
|
|
368
369
|
`<server>__<tool>` prefix even when unique. A tool already carrying its source
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# MCP authorization ownership
|
|
2
|
+
|
|
3
|
+
Each Agent-owned connection is authorized by that Agent. Trellis does not read,
|
|
4
|
+
copy or refresh its credentials. Existing `auth: oauth` and metadata-bearing
|
|
5
|
+
OAuth entries default to `owner: agent`. Runtime delivery also retains these
|
|
6
|
+
native OAuth entries beside the Trellis runtime.
|
|
7
|
+
|
|
8
|
+
The MCP desktop view labels native state as unknown and shows the relevant Agent
|
|
9
|
+
entry or guidance. A stray Trellis token does not change that state. The view's
|
|
10
|
+
credential badge describes stored credentials, not connection health.
|
|
11
|
+
|
|
12
|
+
## Explicit Trellis hosting
|
|
13
|
+
|
|
14
|
+
For providers that accept a Trellis registration, opt in per server:
|
|
15
|
+
|
|
16
|
+
```yaml
|
|
17
|
+
auth:
|
|
18
|
+
kind: oauth
|
|
19
|
+
owner: trellis
|
|
20
|
+
# Optional provider-published client identifier:
|
|
21
|
+
# client_id: YOUR_REGISTERED_CLIENT_ID
|
|
22
|
+
# client_secret_env: YOUR_CLIENT_SECRET_VARIABLE
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or run `trellis mcp set NAME --auth oauth --auth-owner trellis`, then sync.
|
|
26
|
+
Gateway or runtime delivery must be enabled for the receiving Agent. Plain
|
|
27
|
+
direct routing reports a conflict rather than moving Trellis's identity into a
|
|
28
|
+
native connection. `--auth-owner agent` returns the server to native ownership.
|
|
29
|
+
The desktop owner selector previews a plan and requires Apply before changing
|
|
30
|
+
canonical configuration and syncing it.
|
|
31
|
+
|
|
32
|
+
Remote connections without an OAuth classification can choose an owner directly
|
|
33
|
+
in the desktop selector. Its No OAuth classification option clears that setting;
|
|
34
|
+
neither choice starts a grant automatically.
|
|
35
|
+
|
|
36
|
+
The hosted desktop Authorize button launches the existing PKCE flow in the
|
|
37
|
+
system browser. Progress is observable, cancellation closes the callback, and
|
|
38
|
+
timeouts/provider failures permit retry. Repeated clicks share one active job.
|
|
39
|
+
Tokens are saved in the existing per-server 0600 store, never sent to the UI.
|
|
40
|
+
A changed endpoint/auth configuration during the grant prevents persistence.
|
|
41
|
+
Authorization actions require a trusted desktop/development Origin.
|
|
42
|
+
|
|
43
|
+
New credentials retain their MCP resource and authorization-server issuer.
|
|
44
|
+
Authorization, exchange and refresh send the resource indicator; callback issuer
|
|
45
|
+
is checked when supplied or advertised as required. A changed resource cannot
|
|
46
|
+
receive its previous bound credential. The final save shares the refresh lock,
|
|
47
|
+
so a cancelled grant cannot overwrite a concurrent refresh.
|
|
48
|
+
|
|
49
|
+
The gateway can silently refresh its own hosted credentials; it never opens a
|
|
50
|
+
browser. Agents with native connections continue using their own flows.
|
|
51
|
+
|
|
52
|
+
## Verification
|
|
53
|
+
|
|
54
|
+
Run core tests and typecheck, GUI sidecar tests/typecheck and GUI smoke tests.
|
|
55
|
+
`npm run test:oauth-browser --workspace @trellis/gui` additionally uses installed
|
|
56
|
+
Google Chrome headlessly with a local authorization-server fixture. It exercises
|
|
57
|
+
real browser CORS, PKCE callback, progress, cancellation, retry and owner
|
|
58
|
+
confirmation without contacting a real provider or using personal credentials.
|
|
59
|
+
Desktop packaging and installed-app acceptance happen after these checks.
|
package/docs/skills-over-mcp.md
CHANGED
|
@@ -24,8 +24,9 @@ The existing surface is unchanged: `trellis.skills.search|read|read_file` and
|
|
|
24
24
|
## The manifest is computed from the bytes served
|
|
25
25
|
|
|
26
26
|
`digest` is `sha256:` plus 64 lowercase hex characters of the raw bytes;
|
|
27
|
-
`size` is their length. The
|
|
28
|
-
|
|
27
|
+
`size` is their length. The manifest and `resources/read` use the same bounded
|
|
28
|
+
byte reader. Hosts still verify the retained manifest: a file can change between
|
|
29
|
+
listing and reading. Invalid UTF-8 is returned as
|
|
29
30
|
a base64 `blob` rather than lossy `text`, so the bytes a host verifies are the
|
|
30
31
|
bytes that were hashed.
|
|
31
32
|
|
|
@@ -48,32 +49,43 @@ rewrite entry and content together. A matching digest tells a host the bytes
|
|
|
48
49
|
match the manifest; it says nothing about whether the content is safe. Nothing in
|
|
49
50
|
Trellis treats a match as an authorization.
|
|
50
51
|
|
|
51
|
-
##
|
|
52
|
-
|
|
53
|
-
The
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
52
|
+
## Discovery and protocol compatibility
|
|
53
|
+
|
|
54
|
+
The runtime uses the official TypeScript SDK v2 serving entry. Modern clients
|
|
55
|
+
discover resources and the `io.modelcontextprotocol/skills` extension through
|
|
56
|
+
`server/discover`; legacy clients can still initialize and call existing tools
|
|
57
|
+
and resources. Merely constructing a v2 Server is not sufficient: the runtime
|
|
58
|
+
explicitly uses `serveStdio` to select modern or legacy behavior.
|
|
59
|
+
|
|
60
|
+
Skills list/get are registered custom methods with parameter/result schemas.
|
|
61
|
+
The SDK handles modern request metadata, result discrimination and server
|
|
62
|
+
identity. Unknown methods still return JSON-RPC `-32601`. A legacy host can use
|
|
63
|
+
ordinary resources/tools even if it does not understand the Skills extension.
|
|
64
|
+
|
|
65
|
+
## Upstream resources and skills
|
|
66
|
+
|
|
67
|
+
The gateway negotiates modern or legacy upstream behavior. Legacy HTTP+SSE uses
|
|
68
|
+
its existing transport. An upstream with resources but no tools remains valid.
|
|
69
|
+
Declared modern Skills catalogs are paginated, validated and relayed:
|
|
70
|
+
|
|
71
|
+
- URIs use a reversible `trellis-upstream://` namespace per source, preserving
|
|
72
|
+
final path segments and relative references. Provenance records the original
|
|
73
|
+
server label and URI. Canonical and equal-named upstream skills stay distinct.
|
|
74
|
+
- Listing does not fetch file content. Supporting files become readable from a
|
|
75
|
+
complete manifest, even when absent from `resources/list`; direct `skills/get`
|
|
76
|
+
also works for unlisted skills.
|
|
77
|
+
- Reads go back to the registered source and preserve exact bytes, digest and
|
|
78
|
+
size. Skill content is rejected if digest, size or SKILL.md frontmatter differ
|
|
79
|
+
from the entry. Refresh the entry before reading changed content.
|
|
80
|
+
- Dynamic skill manifests are currently declined with a diagnostic. Manifests
|
|
81
|
+
are bounded to 512 files and 16 MiB per skill; unsupported or malformed entries
|
|
82
|
+
do not remove other skills.
|
|
83
|
+
- No upstream skill is installed into `~/.trellis/skills`, activated, or given
|
|
84
|
+
execution permissions by the relay. The consuming host retains its own approval
|
|
85
|
+
and integrity checks.
|
|
86
|
+
|
|
87
|
+
Authorization ownership and the desktop flow are documented in
|
|
88
|
+
[MCP authorization ownership](mcp-authorization-ownership.md).
|
|
89
|
+
|
|
90
|
+
Protocol references: [SDK v2 migration](https://ts.sdk.modelcontextprotocol.io/v2/migration/support-2026-07-28)
|
|
91
|
+
and [Skills extension](https://modelcontextprotocol.io/extensions/skills/overview).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-trellis",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "A unified Code Agent Runtime for Skills, MCP, Memory, and shared instructions across Claude Code, Codex, Kiro, pi, Kimi Code, and ZCode.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Paul Leo",
|
|
@@ -61,7 +61,10 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@clack/prompts": "^1.8.1",
|
|
64
|
+
"@modelcontextprotocol/client": "^2.3.1",
|
|
64
65
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
65
|
-
"
|
|
66
|
+
"@modelcontextprotocol/server": "^2.3.1",
|
|
67
|
+
"yaml": "^2.9.1",
|
|
68
|
+
"zod": "^4.6.5"
|
|
66
69
|
}
|
|
67
70
|
}
|