You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit df12ef6
Browse filesBrowse the repository at this point in the historyBrowse files
feat(rpc)!: make devframe fully validator-neutral (drop forced valibot dep)
Remove valibot and @valibot/to-json-schema from devframe's runtime
dependencies so nothing forces a specific Standard Schema validator on
users. Consumers bring their own (valibot, zod, arktype) or use the new
built-in zero-dependency builder.
- Add devframe/utils/schema: a tiny zero-dep Standard Schema builder (s)
exposing string/number/boolean/void/null/picklist/array/object/
optional/nullable, used by the recipes.
- Convert recipes (common-rpc-functions, interactive-auth) off valibot
to the built-in builder.
- Make the CLI-flags parser validator-neutral: validate via the
~standard contract and duck-type the schema kind (works for the
builder and valibot; other vendors degrade to value-flags).
- Drop @valibot/to-json-schema; the agent/MCP surface advertises a
permissive object schema for any declared args/returns.
- valibot stays a devDependency for tests only.
BREAKING CHANGE: the exported recipe definitions (openInEditor,
openInFinder, interactive-auth functions) now type their args/returns as
the built-in DevframeSchema instead of valibot schema types, and
@valibot/to-json-schema is no longer a devframe dependency. Agent tool
JSON schemas are now permissive objects rather than precise valibot
conversions.
Copy file name to clipboardExpand all lines: docs/errors/DF0019.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ outline: deep
10
10
11
11
## Cause
12
12
13
-
The `agent` field exposes an RPC function as an MCP tool. MCP and the underlying schema-conversion path (`@valibot/to-json-schema`) only consume JSON-shaped data. Functions whose payloads can include `Map`, `Set`, `Date`, `BigInt`, circular references, or class instances cannot be safely advertised to agents.
13
+
The `agent` field exposes an RPC function as an MCP tool. MCP only consumes JSON-shaped data. Functions whose payloads can include `Map`, `Set`, `Date`, `BigInt`, circular references, or class instances cannot be safely advertised to agents.
14
14
15
15
A registered function is rejected when `agent` is present and `jsonSerializable` is not explicitly `true`.
@@ -75,14 +75,16 @@ Use `static` for data collected once during `setup` and shipped to read-only sta
75
75
76
76
### Handler arguments
77
77
78
-
Handlers accept any serializable arguments. Declare `args` schemas — any [Standard Schema](https://standardschema.dev/) validator, valibot below — and each argument is validated at the boundary before the handler runs; a mismatch is rejected with a coded diagnostic. Validation guards the payload without rewriting it, so extra object fields the schema doesn't mention still reach the handler:
78
+
Handlers accept any serializable arguments. Declare `args` schemas — any [Standard Schema](https://standardschema.dev/) validator (valibot, zod, arktype, …) — and each argument is validated at the boundary before the handler runs; a mismatch is rejected with a coded diagnostic. Validation guards the payload without rewriting it, so extra object fields the schema doesn't mention still reach the handler.
79
+
80
+
Devframe forces no validator on you. Bring the one you already use, or reach for the built-in zero-dependency builder at `devframe/utils/schema` (imported as `s` below):
Prefer a single object argument (`args: [v.object({ ... })]`) over positional args — property names are self-describing and agents/IDEs work best with object shapes.
97
+
Prefer a single object argument (`args: [s.object({ ... })]`) over positional args — property names are self-describing and agents/IDEs work best with object shapes.
96
98
97
99
> [!WARNING]
98
100
> Declared `args`/`returns` schemas are enforced at runtime — a call whose arguments, or a handler whose return value, fail the schema is rejected with `DF0043` / `DF0044`. Make sure each schema matches what the function actually accepts and returns; a schema stricter than reality will now reject calls that previously ran.
For flags that are specific to your tool, declare them as valibot schemas so they're validated at parse time and typed at the call site:
171
+
For flags that are specific to your tool, declare them with any [Standard Schema](https://standardschema.dev/) validator (valibot below, or zod / arktype / devframe's built-in `s`) so they're validated at parse time and typed at the call site:
|`KnownEditor`| — | type | — | Union of `KNOWN_EDITORS`. |
30
30
31
-
Both functions are `action`-type RPCs returning `void` and use `valibot` schemas for their arguments — `openInEditor`'s `editor` argument is `v.optional(v.picklist(KNOWN_EDITORS))`, so a value outside `KNOWN_EDITORS` fails validation rather than reaching the underlying `launch-editor` process spawn. Both handlers dynamically `import()` their underlying `devframe/utils/*` implementation, so the `launch-editor` and `open` dependencies only load when the recipe actually runs.
31
+
Both functions are `action`-type RPCs returning `void` and declare their arguments with devframe's built-in zero-dependency `s` builder from `devframe/utils/schema`— `openInEditor`'s `editor` argument is `s.optional(s.picklist(KNOWN_EDITORS))`, so a value outside `KNOWN_EDITORS` fails validation rather than reaching the underlying `launch-editor` process spawn. Both handlers dynamically `import()` their underlying `devframe/utils/*` implementation, so the `launch-editor` and `open` dependencies only load when the recipe actually runs.
32
32
33
33
The `devframe/recipes/open-helpers` entry (`openHelpers`) remains as a deprecated alias for this module — new code should import `commonRpcFunctions` from `devframe/recipes/common-rpc-functions`.
0 commit comments