Skip to content

Commit 8b06771

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/assets-plugin
# Conflicts: # pnpm-lock.yaml # pnpm-workspace.yaml
2 parents 45c26ac + 5d6b6c7 commit 8b06771

47 files changed

Lines changed: 1765 additions & 1951 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/guide/agent-native.md‎

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Three building blocks:
1616

1717
1. **An `agent` field on `defineRpcFunction`.** Add `agent: { description, ... }` to opt a function in. Functions without the field stay private.
1818
2. **`ctx.agent`** — a host exposed on `DevframeNodeContext`. Plugins register tools that aren't backed by an RPC, and expose readable resources (e.g. a Markdown build summary).
19-
3. **The MCP adapter** (`devframe/adapters/mcp`) — translates the agent host into a [Model Context Protocol](https://modelcontextprotocol.io) server, currently over `stdio`.
19+
3. **The MCP adapter** (`devframe/adapters/mcp`) — translates the agent host into a [Model Context Protocol](https://modelcontextprotocol.io) server, over `stdio` (`devframe mcp`) or as a Streamable-HTTP route on the dev server (`--mcp`, advertised in `__connection.json`).
2020

2121
## Exposing an RPC function
2222

@@ -118,6 +118,52 @@ Add an entry to `claude_desktop_config.json`:
118118

119119
Restart Claude Desktop. The tools you flagged with `agent: { ... }` (plus any `registerTool` calls) show up in the MCP tool drawer. Resources are reachable as `devframe://resource/<id>` and `devframe://state/<key>` URIs.
120120

121+
## Writing descriptions agents act on
122+
123+
A tool description is a prompt, not documentation. The agent decides *when* to call your tool from the description alone, so tell it — state when to reach for the tool, not just what it returns:
124+
125+
<!-- eslint-skip -->
126+
127+
```ts
128+
// ✗ Bad: describes the mechanism
129+
agent: { description: 'Returns the session summary object.' }
130+
// ✓ Good: tells the agent when and why
131+
agent: { description: 'Summarize the current build session — durations, chunk counts, warnings. Call this before proposing any build-config change.' }
132+
```
133+
134+
Two conventions:
135+
136+
- **Lead with the action and the trigger.** "Call this before/after/when …" steers proactive use; a bare noun phrase gets ignored.
137+
- **State freshness and cost.** "Safe to call freely" / "expensive, call once per session" lets the agent budget calls.
138+
139+
## Gateway tools
140+
141+
A gateway tool returns *instructions and locations* instead of doing the work — the pattern for anything the agent can do better directly (reading bundled docs, running a CLI it has shell access to):
142+
143+
```ts
144+
ctx.agent.registerTool({
145+
id: 'my-plugin:docs',
146+
description: 'Locate the version-accurate docs for this tool. Call before answering questions about its config format.',
147+
safety: 'read',
148+
handler: () => ({
149+
docsPath: resolveInstalledDocsDir(),
150+
hint: 'Read the file matching your topic; do not rely on training-data knowledge of this config format.',
151+
}),
152+
})
153+
```
154+
155+
The agent gets a path and a next step; the actual reading happens with its own tools, which are faster and keep large content out of the MCP payload.
156+
157+
## Structured errors
158+
159+
A coded devframe diagnostic thrown from a tool handler crosses the MCP boundary as structured JSON rather than a flattened message:
160+
161+
```json
162+
{ "error": { "code": "DF0017", "message": "…", "fix": "…", "docs": "https://devfra.me/errors/df0017" } }
163+
```
164+
165+
Agents can act on `fix` directly and follow `docs` for detail — prefer throwing coded diagnostics from anything agent-reachable.
166+
121167
## Safety model
122168

123169
- **Opt-in exposure.** Functions opt in via the `agent` field; everything else stays private.

‎examples/a11y-messages-playground/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "a11y-messages-playground",
33
"type": "module",
4-
"version": "0.7.14",
4+
"version": "0.7.15",
55
"private": true,
66
"description": "A focused hub playground that pairs @devframes/plugin-a11y with @devframes/plugin-messages over an intentionally-broken, multi-route app under test — for exercising a11y scanning, route tracking, and message→dock navigation.",
77
"homepage": "https://github.com/devframes/devframe/tree/main/examples/a11y-messages-playground",

‎examples/files-inspector/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "files-inspector-example",
33
"type": "module",
4-
"version": "0.7.14",
4+
"version": "0.7.15",
55
"private": true,
66
"description": "End-to-end devframe demo — lists files in cwd via RPC, exercises CLI dev/build/spa surfaces.",
77
"homepage": "https://github.com/devframes/devframe/tree/main/examples/files-inspector",

‎examples/json-render/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "json-render",
33
"type": "module",
4-
"version": "0.7.14",
4+
"version": "0.7.15",
55
"private": true,
66
"description": "Standalone devframe that serves a JSON-render view — a server-authored spec rendered by @devframes/json-render-ui, with live state and an action bridge.",
77
"homepage": "https://github.com/devframes/devframe/tree/main/examples/json-render",

‎examples/next-devframe-hub/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "next-devframe-hub",
33
"type": "module",
4-
"version": "0.7.14",
4+
"version": "0.7.15",
55
"private": true,
66
"description": "Protocol-witness example — a tiny Next.js Devframe Hub built on @devframes/hub that exercises every hub subsystem end-to-end.",
77
"homepage": "https://github.com/devframes/devframe/tree/main/examples/next-devframe-hub",

‎examples/next-runtime-snapshot/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "next-runtime-snapshot-example",
33
"type": "module",
4-
"version": "0.7.14",
4+
"version": "0.7.15",
55
"private": true,
66
"description": "End-to-end devframe demo — Next.js App Router SPA over RPC, exposing the host Node runtime snapshot (system info, memory, env).",
77
"homepage": "https://github.com/devframes/devframe/tree/main/examples/next-runtime-snapshot",

‎examples/streaming-chat/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "streaming-chat-example",
33
"type": "module",
4-
"version": "0.7.14",
4+
"version": "0.7.15",
55
"private": true,
66
"description": "End-to-end devframe demo — streams synthetic chat tokens from server to client via `ctx.rpc.streaming`. Mirrors the AI-deltas use case from issue #306.",
77
"homepage": "https://github.com/devframes/devframe/tree/main/examples/streaming-chat",

‎examples/vite-devframe-hub/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vite-devframe-hub",
33
"type": "module",
4-
"version": "0.7.14",
4+
"version": "0.7.15",
55
"private": true,
66
"description": "Protocol-witness example — a tiny Vite Devframe Hub built on @devframes/hub that exercises every hub subsystem end-to-end.",
77
"homepage": "https://github.com/devframes/devframe/tree/main/examples/vite-devframe-hub",

‎package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "devframe-monorepo",
33
"type": "module",
4-
"version": "0.7.14",
4+
"version": "0.7.15",
55
"private": true,
6-
"packageManager": "pnpm@11.16.0",
6+
"packageManager": "pnpm@11.17.0",
77
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
88
"license": "MIT",
99
"funding": "https://github.com/sponsors/antfu",

‎packages/devframe/package.json‎

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "devframe",
33
"type": "module",
4-
"version": "0.7.14",
4+
"version": "0.7.15",
55
"description": "Framework for building generic devframes",
66
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
77
"license": "MIT",
@@ -111,32 +111,5 @@
111111
"ua-parser-modern": "catalog:inlined",
112112
"whenexpr": "catalog:deps",
113113
"ws": "catalog:deps"
114-
},
115-
"inlinedDependencies": {
116-
"bundle-name": "4.1.0",
117-
"default-browser": "5.5.0",
118-
"default-browser-id": "5.0.1",
119-
"define-lazy-prop": "3.0.0",
120-
"get-port-please": "3.2.0",
121-
"immer": "11.1.8",
122-
"is-docker": "3.0.0",
123-
"is-in-ssh": "1.0.0",
124-
"is-inside-container": "1.0.0",
125-
"is-wsl": "3.1.1",
126-
"launch-editor": "2.13.2",
127-
"obug": "2.1.1",
128-
"ohash": "2.0.11",
129-
"open": "11.0.0",
130-
"p-limit": "7.3.0",
131-
"perfect-debounce": "2.1.0",
132-
"picocolors": "1.1.1",
133-
"powershell-utils": "0.1.0",
134-
"run-applescript": "7.1.0",
135-
"shell-quote": "1.8.3",
136-
"structured-clone-es": "2.0.0",
137-
"ua-parser-modern": "0.1.1",
138-
"whenexpr": "0.1.2",
139-
"wsl-utils": "0.3.1",
140-
"yocto-queue": "1.2.2"
141114
}
142115
}

0 commit comments

Comments
 (0)