@melra/protocol 0.3.0-alpha.4 → 0.3.0-alpha.6
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/README.md +42 -0
- package/dist/index.d.ts +1251 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +206 -6
- package/dist/index.js.map +1 -1
- package/dist/index.test.js +56 -1
- package/dist/index.test.js.map +1 -1
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# @melra/protocol
|
|
2
|
+
|
|
3
|
+
Versioned contracts for [MELRA](https://github.com/XAGI-Lab/melra) — tasks,
|
|
4
|
+
workflows, capabilities, policy, and evidence, as Zod schemas plus the types
|
|
5
|
+
inferred from them.
|
|
6
|
+
|
|
7
|
+
This is the wire format every other MELRA package agrees on. Install it if you
|
|
8
|
+
are building a client, a runtime, or anything that has to construct or validate
|
|
9
|
+
MELRA payloads. If you just want to use MELRA, install
|
|
10
|
+
[`@melra/cli`](https://www.npmjs.com/package/@melra/cli) or
|
|
11
|
+
[`@melra/sdk`](https://www.npmjs.com/package/@melra/sdk) instead.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @melra/protocol
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { TaskRequestSchema, PROTOCOL_VERSION } from "@melra/protocol";
|
|
19
|
+
|
|
20
|
+
const request = TaskRequestSchema.parse({
|
|
21
|
+
goal: "Read the manifest",
|
|
22
|
+
operation: { kind: "file", action: "read", path: "package.json" },
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Every schema is `.strict()` and bounded: unknown fields are rejected rather than
|
|
27
|
+
ignored, and strings, arrays, and budgets have explicit maximums. That is
|
|
28
|
+
deliberate — a typo'd field name is a bug you want at the boundary, not a silent
|
|
29
|
+
default three layers in.
|
|
30
|
+
|
|
31
|
+
Parse, don't hand-build. `TaskRequestInput` is the shape you write and
|
|
32
|
+
`TaskRequest` is what the schema produces once defaults are applied, so pass
|
|
33
|
+
input through `TaskRequestSchema.parse` rather than filling in every default by
|
|
34
|
+
hand to satisfy the compiler.
|
|
35
|
+
|
|
36
|
+
Exports the task, workflow, receipt, policy, and MCP tool-input schemas,
|
|
37
|
+
`PROTOCOL_VERSION`, `PRODUCT_VERSION`, and `TOOL_NAMES`.
|
|
38
|
+
|
|
39
|
+
Requires Node.js 22 or newer. Full documentation:
|
|
40
|
+
[github.com/XAGI-Lab/melra](https://github.com/XAGI-Lab/melra)
|
|
41
|
+
|
|
42
|
+
Apache-2.0
|