@fungi.computer/computer-contract 0.0.0-stage → 0.0.1
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/LICENSE +21 -0
- package/README.md +60 -2
- package/dist/index.d.ts +742 -0
- package/dist/index.js +750 -0
- package/docs/api/README.md +2055 -0
- package/package.json +61 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jamstack Consulting LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,61 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Computer Contract (`@fungi.computer/computer-contract`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The wire contract for one Fungi Computer: the Zod schemas and types for
|
|
4
|
+
operation discovery, files, commands, processes and ports, shared by every host
|
|
5
|
+
and client that talks to a Computer. It has no runtime of its own and does not
|
|
6
|
+
depend on [`@fungi.computer/computer`](../computer/README.md), so an App or a
|
|
7
|
+
client can decode Computer operations without pulling in the Computer host.
|
|
8
|
+
|
|
9
|
+
## Install or set up
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
pnpm add @fungi.computer/computer-contract
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The package is ESM-only and has one entrypoint. It depends on
|
|
16
|
+
`@fungi.computer/cairn` for request identifiers, `@fungi.computer/knapsack` for
|
|
17
|
+
the shared file-patch schemas, and `zod`.
|
|
18
|
+
|
|
19
|
+
## Quick start
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import {
|
|
23
|
+
pathSchema,
|
|
24
|
+
mintComputerRequestId,
|
|
25
|
+
} from "@fungi.computer/computer-contract";
|
|
26
|
+
|
|
27
|
+
const path = pathSchema.parse("/workspace/notes.md");
|
|
28
|
+
const requestId = mintComputerRequestId();
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Core concepts
|
|
32
|
+
|
|
33
|
+
- **Operation schemas** describe each Computer operation's input and output:
|
|
34
|
+
files (read, write, replace, list, patch, mkdir), command execution, processes
|
|
35
|
+
and ports. A host decodes requests with them; a client decodes results with
|
|
36
|
+
them.
|
|
37
|
+
- **Request identifiers** name one admitted operation, so repeating a request
|
|
38
|
+
reads the same operation instead of running it again.
|
|
39
|
+
- **Backend ids** name the attached execution backend an operation ran on.
|
|
40
|
+
|
|
41
|
+
## API reference
|
|
42
|
+
|
|
43
|
+
The generated reference is in [docs/api](docs/api/README.md).
|
|
44
|
+
|
|
45
|
+
## Examples and checks
|
|
46
|
+
|
|
47
|
+
- `pnpm --filter @fungi.computer/computer-contract test` checks the reserved
|
|
48
|
+
port and port-input rules.
|
|
49
|
+
- `pnpm --filter @fungi.computer/computer-contract stranger` packs the package
|
|
50
|
+
and typechecks and runs a consumer against the tarball.
|
|
51
|
+
|
|
52
|
+
## Limits and errors
|
|
53
|
+
|
|
54
|
+
Every schema is bounded: paths, payload sizes and list lengths have explicit
|
|
55
|
+
limits, and a value outside them fails to decode with a Zod error. The package
|
|
56
|
+
performs no I/O.
|
|
57
|
+
|
|
58
|
+
## Contribute and license
|
|
59
|
+
|
|
60
|
+
Changes land through the Botanical repository. MIT licensed; see
|
|
61
|
+
[LICENSE](LICENSE).
|