@fungi.computer/knapsack 0.0.0-stage → 0.0.2
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/LICENSE.codex +201 -0
- package/README.md +140 -2
- package/dist/files-patch.d.ts +30 -0
- package/dist/files-patch.js +22 -0
- package/dist/files-read-codec.d.ts +10 -0
- package/dist/files-read-codec.js +26 -0
- package/dist/files-read.d.ts +25 -0
- package/dist/files-read.js +43 -0
- package/dist/files.d.ts +170 -0
- package/dist/files.js +513 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.js +178 -0
- package/dist/mcp.d.ts +54 -0
- package/dist/mcp.js +237 -0
- package/dist/patch-grammar.d.ts +1 -0
- package/dist/patch-grammar.js +3 -0
- package/dist/patch.d.ts +27 -0
- package/dist/patch.js +56 -0
- package/docs/api/README.md +17 -0
- package/docs/api/files-patch.md +72 -0
- package/docs/api/files-read-codec.md +74 -0
- package/docs/api/files-read.md +94 -0
- package/docs/api/index.md +733 -0
- package/docs/api/patch.md +84 -0
- package/package.json +84 -3
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
|
|
2
|
+
|
|
3
|
+
[**@fungi.computer/knapsack**](README.md)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
[@fungi.computer/knapsack](README.md) / files-patch
|
|
8
|
+
|
|
9
|
+
# files-patch
|
|
10
|
+
|
|
11
|
+
## Variables
|
|
12
|
+
|
|
13
|
+
### patchInputSchema
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
const patchInputSchema: ZodObject<
|
|
17
|
+
{
|
|
18
|
+
patch: ZodString;
|
|
19
|
+
},
|
|
20
|
+
$strict
|
|
21
|
+
>;
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Browser-safe patch contracts shared by native Files tools and Computer HTTP.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
### patchOutputSchema
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
const patchOutputSchema: ZodUnion<
|
|
32
|
+
readonly [
|
|
33
|
+
ZodObject<
|
|
34
|
+
{
|
|
35
|
+
status: ZodEnum<{
|
|
36
|
+
completed: "completed";
|
|
37
|
+
failed: "failed";
|
|
38
|
+
cancelled: "cancelled";
|
|
39
|
+
}>;
|
|
40
|
+
exitCode: ZodNumber;
|
|
41
|
+
stdout: ZodString;
|
|
42
|
+
stderr: ZodString;
|
|
43
|
+
truncated: ZodBoolean;
|
|
44
|
+
},
|
|
45
|
+
$strict
|
|
46
|
+
>,
|
|
47
|
+
ZodObject<
|
|
48
|
+
{
|
|
49
|
+
status: ZodEnum<{
|
|
50
|
+
completed: "completed";
|
|
51
|
+
failed: "failed";
|
|
52
|
+
cancelled: "cancelled";
|
|
53
|
+
}>;
|
|
54
|
+
exitCode: ZodNumber;
|
|
55
|
+
stdout: ZodString;
|
|
56
|
+
stderr: ZodString;
|
|
57
|
+
truncated: ZodBoolean;
|
|
58
|
+
error: ZodObject<
|
|
59
|
+
{
|
|
60
|
+
kind: ZodLiteral<"mismatch">;
|
|
61
|
+
},
|
|
62
|
+
$strict
|
|
63
|
+
>;
|
|
64
|
+
},
|
|
65
|
+
$strict
|
|
66
|
+
>,
|
|
67
|
+
]
|
|
68
|
+
>;
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Native patch completion, cancellation or failure, including an optional
|
|
72
|
+
mismatch.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
|
|
2
|
+
|
|
3
|
+
[**@fungi.computer/knapsack**](README.md)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
[@fungi.computer/knapsack](README.md) / files-read-codec
|
|
8
|
+
|
|
9
|
+
# files-read-codec
|
|
10
|
+
|
|
11
|
+
## Type Aliases
|
|
12
|
+
|
|
13
|
+
### FilesReadTransport
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
type FilesReadTransport = (frame, context) => Promise<string>;
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Host transport carrying a framed Files read with its invocation context.
|
|
20
|
+
|
|
21
|
+
#### Parameters
|
|
22
|
+
|
|
23
|
+
| Parameter | Type |
|
|
24
|
+
| --------- | ------------------- |
|
|
25
|
+
| `frame` | `string` |
|
|
26
|
+
| `context` | `InvocationContext` |
|
|
27
|
+
|
|
28
|
+
#### Returns
|
|
29
|
+
|
|
30
|
+
`Promise`\<`string`\>
|
|
31
|
+
|
|
32
|
+
## Functions
|
|
33
|
+
|
|
34
|
+
### encodeFilesReadRequest()
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
function encodeFilesReadRequest(input): string;
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Validate and encode a bounded Files read request as a JSON frame.
|
|
41
|
+
|
|
42
|
+
#### Parameters
|
|
43
|
+
|
|
44
|
+
| Parameter | Type |
|
|
45
|
+
| --------------- | ---------------------------------------------------------------- |
|
|
46
|
+
| `input` | \{ `path`: `string`; `offset?`: `number`; `limit?`: `number`; \} |
|
|
47
|
+
| `input.path` | `string` |
|
|
48
|
+
| `input.offset?` | `number` |
|
|
49
|
+
| `input.limit?` | `number` |
|
|
50
|
+
|
|
51
|
+
#### Returns
|
|
52
|
+
|
|
53
|
+
`string`
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
### createFilesReadAdapter()
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
function createFilesReadAdapter(transport): Pick<FilesPort, "read">;
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Adapt a framed transport to the Files read port; `Knapsack.files` owns the
|
|
64
|
+
operation.
|
|
65
|
+
|
|
66
|
+
#### Parameters
|
|
67
|
+
|
|
68
|
+
| Parameter | Type |
|
|
69
|
+
| ----------- | ------------------------------------------- |
|
|
70
|
+
| `transport` | [`FilesReadTransport`](#filesreadtransport) |
|
|
71
|
+
|
|
72
|
+
#### Returns
|
|
73
|
+
|
|
74
|
+
`Pick`\<[`FilesPort`](index.md#filesport), `"read"`\>
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
|
|
2
|
+
|
|
3
|
+
[**@fungi.computer/knapsack**](README.md)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
[@fungi.computer/knapsack](README.md) / files-read
|
|
8
|
+
|
|
9
|
+
# files-read
|
|
10
|
+
|
|
11
|
+
## Variables
|
|
12
|
+
|
|
13
|
+
### maximumReadBytes
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
const maximumReadBytes: number;
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Maximum UTF-8 byte length of a Files text page.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
### pathSchema
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
const pathSchema: ZodString;
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Nonempty file path bounded to 4,096 characters, without null bytes.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
### readInputSchema
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
const readInputSchema: ZodObject<
|
|
37
|
+
{
|
|
38
|
+
path: ZodString;
|
|
39
|
+
offset: ZodDefault<ZodNumber>;
|
|
40
|
+
limit: ZodDefault<ZodNumber>;
|
|
41
|
+
},
|
|
42
|
+
$strict
|
|
43
|
+
>;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Canonical bounded Files read request and result, shared with display consumers.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
### readOutputSchema
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
const readOutputSchema: ZodObject<
|
|
54
|
+
{
|
|
55
|
+
path: ZodString;
|
|
56
|
+
content: ZodString;
|
|
57
|
+
offset: ZodNumber;
|
|
58
|
+
nextOffset: ZodNullable<ZodNumber>;
|
|
59
|
+
truncated: ZodBoolean;
|
|
60
|
+
file: ZodExactOptional<
|
|
61
|
+
ZodObject<
|
|
62
|
+
{
|
|
63
|
+
computerId: ZodString;
|
|
64
|
+
path: ZodString;
|
|
65
|
+
},
|
|
66
|
+
$strict
|
|
67
|
+
>
|
|
68
|
+
>;
|
|
69
|
+
},
|
|
70
|
+
$strict
|
|
71
|
+
>;
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Bounded text page, continuation offset and optional hosted file identity.
|
|
75
|
+
|
|
76
|
+
## Functions
|
|
77
|
+
|
|
78
|
+
### boundedTextSchema()
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
function boundedTextSchema(minimumLength?): ZodString;
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Validate text against a minimum character length and the Files UTF-8 byte limit.
|
|
85
|
+
|
|
86
|
+
#### Parameters
|
|
87
|
+
|
|
88
|
+
| Parameter | Type | Default value |
|
|
89
|
+
| --------------- | -------- | ------------- |
|
|
90
|
+
| `minimumLength` | `number` | `0` |
|
|
91
|
+
|
|
92
|
+
#### Returns
|
|
93
|
+
|
|
94
|
+
`ZodString`
|