@fungi.computer/mycelium 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/README.md +303 -2
- package/THIRD_PARTY_NOTICES +2 -0
- package/dist/access.d.ts +129 -0
- package/dist/access.js +166 -0
- package/dist/capability-source.d.ts +44 -0
- package/dist/capability-source.js +1 -0
- package/dist/compiler.d.ts +28 -0
- package/dist/compiler.js +221 -0
- package/dist/define.d.ts +8 -0
- package/dist/define.js +7 -0
- package/dist/effect.d.ts +89 -0
- package/dist/effect.js +42 -0
- package/dist/errors.d.ts +48 -0
- package/dist/errors.js +62 -0
- package/dist/execute-tool.d.ts +22 -0
- package/dist/execute-tool.js +163 -0
- package/dist/image-collector.d.ts +47 -0
- package/dist/image-collector.js +39 -0
- package/dist/index.d.ts +149 -0
- package/dist/index.js +22 -0
- package/dist/internal/build-identity.d.ts +1 -0
- package/dist/internal/build-identity.js +15 -0
- package/dist/internal/build-identity.node.d.ts +1 -0
- package/dist/internal/build-identity.node.js +42 -0
- package/dist/internal/execution-lifecycle.d.ts +44 -0
- package/dist/internal/execution-lifecycle.js +328 -0
- package/dist/internal/mcp-principal.d.ts +14 -0
- package/dist/internal/mcp-principal.js +17 -0
- package/dist/mcp-catalog.d.ts +23 -0
- package/dist/mcp-catalog.js +110 -0
- package/dist/mcp.d.ts +92 -0
- package/dist/mcp.js +250 -0
- package/dist/operation-schema.d.ts +47 -0
- package/dist/operation-schema.js +50 -0
- package/dist/promise-facade.d.ts +3 -0
- package/dist/promise-facade.js +82 -0
- package/dist/registration.d.ts +74 -0
- package/dist/registration.js +157 -0
- package/dist/remote.d.ts +33 -0
- package/dist/remote.js +126 -0
- package/dist/runtime.d.ts +51 -0
- package/dist/runtime.js +159 -0
- package/dist/sandbox-boundary.d.ts +44 -0
- package/dist/sandbox-boundary.js +325 -0
- package/dist/sandbox-failure-event.d.ts +15 -0
- package/dist/sandbox-failure-event.js +34 -0
- package/dist/sandbox-failure.d.ts +128 -0
- package/dist/sandbox-failure.js +161 -0
- package/dist/sandbox-guest.d.ts +34 -0
- package/dist/sandbox-guest.js +131 -0
- package/dist/sandbox-wire.d.ts +76 -0
- package/dist/sandbox-wire.js +190 -0
- package/dist/sandbox.d.ts +41 -0
- package/dist/sandbox.js +1 -0
- package/dist/semaphore-transition.d.ts +7 -0
- package/dist/semaphore-transition.js +9 -0
- package/dist/source-runtime.d.ts +28 -0
- package/dist/source-runtime.js +162 -0
- package/dist/testing.d.ts +11 -0
- package/dist/testing.js +19 -0
- package/dist/workers/index.d.ts +9 -0
- package/dist/workers/index.js +90 -0
- package/docs/api/README.md +25 -0
- package/docs/api/define.md +20 -0
- package/docs/api/effect.md +245 -0
- package/docs/api/index.md +1081 -0
- package/docs/api/mcp.md +239 -0
- package/docs/api/remote.md +108 -0
- package/docs/api/sandbox-boundary.md +325 -0
- package/docs/api/sandbox-failure.md +1133 -0
- package/docs/api/sandbox-guest.md +191 -0
- package/docs/api/sandbox-wire.md +117 -0
- package/docs/api/sandbox.md +81 -0
- package/docs/api/semaphore-transition.md +40 -0
- package/docs/api/testing.md +72 -0
- package/docs/api/workers.md +55 -0
- package/package.json +132 -3
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
<!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
|
|
2
|
+
|
|
3
|
+
[**@fungi.computer/mycelium**](README.md)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
[@fungi.computer/mycelium](README.md) / sandbox-guest
|
|
8
|
+
|
|
9
|
+
# sandbox-guest
|
|
10
|
+
|
|
11
|
+
## Variables
|
|
12
|
+
|
|
13
|
+
### sandboxGuestResultSchema
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
const sandboxGuestResultSchema: ZodDiscriminatedUnion<
|
|
17
|
+
[
|
|
18
|
+
ZodObject<
|
|
19
|
+
{
|
|
20
|
+
ok: ZodLiteral<true>;
|
|
21
|
+
value: ZodUnknown;
|
|
22
|
+
},
|
|
23
|
+
$strict
|
|
24
|
+
>,
|
|
25
|
+
ZodObject<
|
|
26
|
+
{
|
|
27
|
+
ok: ZodLiteral<false>;
|
|
28
|
+
error: ZodObject<
|
|
29
|
+
{
|
|
30
|
+
kind: ZodLiteral<"guest_threw">;
|
|
31
|
+
name: ZodString;
|
|
32
|
+
message: ZodString;
|
|
33
|
+
transportMessage: ZodOptional<ZodString>;
|
|
34
|
+
},
|
|
35
|
+
$strict
|
|
36
|
+
>;
|
|
37
|
+
},
|
|
38
|
+
$strict
|
|
39
|
+
>,
|
|
40
|
+
],
|
|
41
|
+
"ok"
|
|
42
|
+
>;
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Closed guest envelope: guest exceptions cannot masquerade as host failures.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
### sandboxNamespaceSegmentSchema
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
const sandboxNamespaceSegmentSchema: ZodString;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Parsed guest namespace segments; callbacks never cross this wire.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
### sandboxTransportAliasSchema
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
const sandboxTransportAliasSchema: ZodString;
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
A transport alias is interpolated as a strict JavaScript binding identifier.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
### sandboxNamespacePathsSchema
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
const sandboxNamespacePathsSchema: ZodRecord<ZodString, ZodArray<ZodString>>;
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Transport aliases mapped to their logical namespace paths.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
### sandboxBindingNamesSchema
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
const sandboxBindingNamesSchema: ZodRecord<ZodString, ZodArray<ZodString>>;
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Serializable flat transport table; operation keys may have any namespace depth.
|
|
86
|
+
|
|
87
|
+
## Functions
|
|
88
|
+
|
|
89
|
+
### submittedSourceLocation()
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
function submittedSourceLocation(
|
|
93
|
+
normalized,
|
|
94
|
+
submitted,
|
|
95
|
+
): Readonly<{
|
|
96
|
+
line: number;
|
|
97
|
+
column: number;
|
|
98
|
+
excerpt: string;
|
|
99
|
+
}> | null;
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Locate syntax in the submitted code, accounting for Codemode's normalization.
|
|
103
|
+
|
|
104
|
+
#### Parameters
|
|
105
|
+
|
|
106
|
+
| Parameter | Type |
|
|
107
|
+
| ------------ | -------- |
|
|
108
|
+
| `normalized` | `string` |
|
|
109
|
+
| `submitted` | `string` |
|
|
110
|
+
|
|
111
|
+
#### Returns
|
|
112
|
+
|
|
113
|
+
\| `Readonly`\<\{ `line`: `number`; `column`: `number`; `excerpt`: `string`;
|
|
114
|
+
\}\> \| `null`
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
### sandboxBindingNames()
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
function sandboxBindingNames<A>(
|
|
122
|
+
bindings,
|
|
123
|
+
): Readonly<Record<string, readonly string[]>>;
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Serializable operation names; callbacks stay in the host's existing binding
|
|
127
|
+
table.
|
|
128
|
+
|
|
129
|
+
#### Type Parameters
|
|
130
|
+
|
|
131
|
+
| Type Parameter |
|
|
132
|
+
| -------------- |
|
|
133
|
+
| `A` |
|
|
134
|
+
|
|
135
|
+
#### Parameters
|
|
136
|
+
|
|
137
|
+
| Parameter | Type |
|
|
138
|
+
| ---------- | --------------------------------------------------------------------------- |
|
|
139
|
+
| `bindings` | `Readonly`\<`Record`\<`string`, `Readonly`\<`Record`\<`string`, `A`\>\>\>\> |
|
|
140
|
+
|
|
141
|
+
#### Returns
|
|
142
|
+
|
|
143
|
+
`Readonly`\<`Record`\<`string`, readonly `string`[]\>\>
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
### sandboxProviderOperationName()
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
function sandboxProviderOperationName(operation): string;
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Injective provider identifier: Codemode sanitizes dotted function names.
|
|
154
|
+
|
|
155
|
+
#### Parameters
|
|
156
|
+
|
|
157
|
+
| Parameter | Type |
|
|
158
|
+
| ----------- | -------- |
|
|
159
|
+
| `operation` | `string` |
|
|
160
|
+
|
|
161
|
+
#### Returns
|
|
162
|
+
|
|
163
|
+
`string`
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
### sandboxGuestProgram()
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
function sandboxGuestProgram(
|
|
171
|
+
normalized,
|
|
172
|
+
bindings?,
|
|
173
|
+
namespacePaths?,
|
|
174
|
+
transportName?,
|
|
175
|
+
): string;
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Capture name and text inside the guest, before Codemode erases Error.name.
|
|
179
|
+
|
|
180
|
+
#### Parameters
|
|
181
|
+
|
|
182
|
+
| Parameter | Type |
|
|
183
|
+
| ---------------- | ------------------------------------------------------- |
|
|
184
|
+
| `normalized` | `string` |
|
|
185
|
+
| `bindings` | `Readonly`\<`Record`\<`string`, readonly `string`[]\>\> |
|
|
186
|
+
| `namespacePaths` | `Readonly`\<`Record`\<`string`, readonly `string`[]\>\> |
|
|
187
|
+
| `transportName?` | (`operation`) => `string` |
|
|
188
|
+
|
|
189
|
+
#### Returns
|
|
190
|
+
|
|
191
|
+
`string`
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
|
|
2
|
+
|
|
3
|
+
[**@fungi.computer/mycelium**](README.md)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
[@fungi.computer/mycelium](README.md) / sandbox-wire
|
|
8
|
+
|
|
9
|
+
# sandbox-wire
|
|
10
|
+
|
|
11
|
+
## Type Aliases
|
|
12
|
+
|
|
13
|
+
### SandboxWire
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
type SandboxWire = z.output<typeof sandboxWireSchema>;
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Typed, decoded host wire value.
|
|
20
|
+
|
|
21
|
+
## Variables
|
|
22
|
+
|
|
23
|
+
### sandboxWireSchema
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
const sandboxWireSchema: ZodDiscriminatedUnion<
|
|
27
|
+
[
|
|
28
|
+
ZodObject<
|
|
29
|
+
{
|
|
30
|
+
ok: ZodLiteral<true>;
|
|
31
|
+
value: ZodJSONSchema;
|
|
32
|
+
},
|
|
33
|
+
$strict
|
|
34
|
+
>,
|
|
35
|
+
ZodObject<
|
|
36
|
+
{
|
|
37
|
+
ok: ZodLiteral<false>;
|
|
38
|
+
error: ZodDiscriminatedUnion<
|
|
39
|
+
[
|
|
40
|
+
ZodObject<
|
|
41
|
+
{
|
|
42
|
+
kind: ZodLiteral<"invalid_source">;
|
|
43
|
+
line: ZodNumber;
|
|
44
|
+
column: ZodNumber;
|
|
45
|
+
excerpt: ZodString;
|
|
46
|
+
},
|
|
47
|
+
$strict
|
|
48
|
+
>,
|
|
49
|
+
ZodObject<
|
|
50
|
+
{
|
|
51
|
+
kind: ZodLiteral<"guest_threw">;
|
|
52
|
+
name: ZodString;
|
|
53
|
+
message: ZodString;
|
|
54
|
+
transportMessage: ZodOptional<ZodString>;
|
|
55
|
+
},
|
|
56
|
+
$strict
|
|
57
|
+
>,
|
|
58
|
+
ZodObject<
|
|
59
|
+
{
|
|
60
|
+
kind: ZodLiteral<"deadline_exceeded">;
|
|
61
|
+
limitMs: ZodNumber;
|
|
62
|
+
elapsedMs: ZodNumber;
|
|
63
|
+
},
|
|
64
|
+
$strict
|
|
65
|
+
>,
|
|
66
|
+
],
|
|
67
|
+
"kind"
|
|
68
|
+
>;
|
|
69
|
+
},
|
|
70
|
+
$strict
|
|
71
|
+
>,
|
|
72
|
+
],
|
|
73
|
+
"ok"
|
|
74
|
+
>;
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The host-to-host result contract; raw diagnostic fields never go to guest code.
|
|
78
|
+
|
|
79
|
+
## Functions
|
|
80
|
+
|
|
81
|
+
### sandboxWireFailure()
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
function sandboxWireFailure(error): SandboxFailure;
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Convert one validated wire failure into the shared error channel.
|
|
88
|
+
|
|
89
|
+
#### Parameters
|
|
90
|
+
|
|
91
|
+
| Parameter | Type |
|
|
92
|
+
| --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
93
|
+
| `error` | \| \{ `kind`: `"invalid_source"`; `line`: `number`; `column`: `number`; `excerpt`: `string`; \} \| \{ `kind`: `"guest_threw"`; `name`: `string`; `message`: `string`; `transportMessage?`: `string`; \} \| \{ `kind`: `"deadline_exceeded"`; `limitMs`: `number`; `elapsedMs`: `number`; \} \| \{ `kind`: `"result_not_json"`; `valueKind`: `string`; `rawCause`: `JSONType`; \} \| \{ `kind`: `"sandbox_crashed"`; `rawCause`: `JSONType`; \} \| \{ `kind`: `"bad_response"`; `reason`: `string`; `rawCause`: `JSONType`; \} \| \{ `kind`: `"dispatch_lost"`; `elapsedMs`: `number`; `transport`: `string`; `errno?`: `string`; `rawCause`: `JSONType`; \} \| \{ `kind`: `"cancelled"`; `by`: `"caller"` \| `"operator"`; \} \| \{ `kind`: `"result_too_large"`; `size`: `number`; \} \| \{ `kind`: `"capability_failed"`; `namespace`: `string`; `operation`: `string`; `cause`: \{ `kind`: `"Files"` \| `"Forage"` \| `"InvalidInput"` \| `"Unavailable"` \| `"OperationFailed"`; `message`: `string`; \}; `rawCause`: `JSONType`; \} \| \{ `kind`: `"unknown"`; `rawCause`: `JSONType`; \} |
|
|
94
|
+
|
|
95
|
+
#### Returns
|
|
96
|
+
|
|
97
|
+
[`SandboxFailure`](sandbox-failure.md#sandboxfailure)
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
### sandboxFailureWire()
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
function sandboxFailureWire(failure): JSONType;
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Host-only encoding; the guest receives only the admitted diagnostic text.
|
|
108
|
+
|
|
109
|
+
#### Parameters
|
|
110
|
+
|
|
111
|
+
| Parameter | Type |
|
|
112
|
+
| --------- | ----------------------------------------------------- |
|
|
113
|
+
| `failure` | [`SandboxFailure`](sandbox-failure.md#sandboxfailure) |
|
|
114
|
+
|
|
115
|
+
#### Returns
|
|
116
|
+
|
|
117
|
+
`JSONType`
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
|
|
2
|
+
|
|
3
|
+
[**@fungi.computer/mycelium**](README.md)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
[@fungi.computer/mycelium](README.md) / sandbox
|
|
8
|
+
|
|
9
|
+
# sandbox
|
|
10
|
+
|
|
11
|
+
## Type Aliases
|
|
12
|
+
|
|
13
|
+
### MyceliumJsonValue
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
type MyceliumJsonValue = output<ZodJSONSchema>;
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
JSON value allowed to cross the sandbox and capability boundary.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
### SandboxValue
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
type SandboxValue = input<ZodUnknown>;
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Untrusted value supplied by or returned from a host sandbox boundary.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
### SandboxBinding
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
type SandboxBinding = (input) => Promise<MyceliumJsonValue>;
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
One invocation binding visible to the host-provided sandbox.
|
|
40
|
+
|
|
41
|
+
#### Parameters
|
|
42
|
+
|
|
43
|
+
| Parameter | Type |
|
|
44
|
+
| --------- | ------------------------------- |
|
|
45
|
+
| `input` | [`SandboxValue`](#sandboxvalue) |
|
|
46
|
+
|
|
47
|
+
#### Returns
|
|
48
|
+
|
|
49
|
+
`Promise`\<[`MyceliumJsonValue`](#myceliumjsonvalue)\>
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
### SandboxRequest
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
type SandboxRequest = Readonly<{
|
|
57
|
+
executionId: string;
|
|
58
|
+
code: string;
|
|
59
|
+
timeoutMs: number;
|
|
60
|
+
bindings: Readonly<Record<string, Readonly<Record<string, SandboxBinding>>>>;
|
|
61
|
+
namespacePaths?: Readonly<Record<string, readonly string[]>>;
|
|
62
|
+
modules?: Readonly<Record<string, string>>;
|
|
63
|
+
sessionId?: string | null;
|
|
64
|
+
}>;
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Request crossing the root Promise-shaped sandbox seam.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
### Sandbox
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
type Sandbox = Readonly<{
|
|
75
|
+
adapter?: string;
|
|
76
|
+
buildSha?: string;
|
|
77
|
+
execute: (request, signal) => Promise<SandboxValue>;
|
|
78
|
+
}>;
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Promise-shaped sandbox interface implemented by a host or stranger.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
|
|
2
|
+
|
|
3
|
+
[**@fungi.computer/mycelium**](README.md)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
[@fungi.computer/mycelium](README.md) / semaphore-transition
|
|
8
|
+
|
|
9
|
+
# semaphore-transition
|
|
10
|
+
|
|
11
|
+
## Functions
|
|
12
|
+
|
|
13
|
+
### claimThenSettle()
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
function claimThenSettle<A, B, E>(gate, claim, settle): Effect<B, E>;
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Serialize a synchronous state claim and settle its Effect outside the gate.
|
|
20
|
+
Interruption cannot release the caller until settlement finishes.
|
|
21
|
+
|
|
22
|
+
#### Type Parameters
|
|
23
|
+
|
|
24
|
+
| Type Parameter |
|
|
25
|
+
| -------------- |
|
|
26
|
+
| `A` |
|
|
27
|
+
| `B` |
|
|
28
|
+
| `E` |
|
|
29
|
+
|
|
30
|
+
#### Parameters
|
|
31
|
+
|
|
32
|
+
| Parameter | Type |
|
|
33
|
+
| --------- | ----------------------------------- |
|
|
34
|
+
| `gate` | `Semaphore` |
|
|
35
|
+
| `claim` | () => `A` |
|
|
36
|
+
| `settle` | (`claimed`) => `Effect`\<`B`, `E`\> |
|
|
37
|
+
|
|
38
|
+
#### Returns
|
|
39
|
+
|
|
40
|
+
`Effect`\<`B`, `E`\>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
|
|
2
|
+
|
|
3
|
+
[**@fungi.computer/mycelium**](README.md)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
[@fungi.computer/mycelium](README.md) / testing
|
|
8
|
+
|
|
9
|
+
# testing
|
|
10
|
+
|
|
11
|
+
## Type Aliases
|
|
12
|
+
|
|
13
|
+
### DirectSandboxCallback
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
type DirectSandboxCallback = (bindings, signal) => Promise<SandboxValue>;
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
A test callback receives the admitted bindings and cancellation.
|
|
20
|
+
|
|
21
|
+
#### Parameters
|
|
22
|
+
|
|
23
|
+
| Parameter | Type |
|
|
24
|
+
| ---------- | ------------------------------------------------------------- |
|
|
25
|
+
| `bindings` | [`SandboxRequest`](sandbox.md#sandboxrequest)\[`"bindings"`\] |
|
|
26
|
+
| `signal` | `AbortSignal` |
|
|
27
|
+
|
|
28
|
+
#### Returns
|
|
29
|
+
|
|
30
|
+
`Promise`\<[`SandboxValue`](sandbox.md#sandboxvalue)\>
|
|
31
|
+
|
|
32
|
+
## Functions
|
|
33
|
+
|
|
34
|
+
### directSandbox()
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
function directSandbox(callback): Sandbox;
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Dispatch a known-binding callback directly in this process. NOT isolation:
|
|
41
|
+
submitted code is ignored, and the callback retains all host privileges. Use
|
|
42
|
+
only trusted tests and examples, never model-authored code execution.
|
|
43
|
+
|
|
44
|
+
#### Parameters
|
|
45
|
+
|
|
46
|
+
| Parameter | Type |
|
|
47
|
+
| ---------- | ------------------------------------------------- |
|
|
48
|
+
| `callback` | [`DirectSandboxCallback`](#directsandboxcallback) |
|
|
49
|
+
|
|
50
|
+
#### Returns
|
|
51
|
+
|
|
52
|
+
[`Sandbox`](sandbox.md#sandbox)
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
### rejectingSandbox()
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
function rejectingSandbox(message): Sandbox;
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
A test transport that always refuses execution with the supplied message.
|
|
63
|
+
|
|
64
|
+
#### Parameters
|
|
65
|
+
|
|
66
|
+
| Parameter | Type |
|
|
67
|
+
| --------- | -------- |
|
|
68
|
+
| `message` | `string` |
|
|
69
|
+
|
|
70
|
+
#### Returns
|
|
71
|
+
|
|
72
|
+
[`Sandbox`](sandbox.md#sandbox)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
|
|
2
|
+
|
|
3
|
+
[**@fungi.computer/mycelium**](README.md)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
[@fungi.computer/mycelium](README.md) / workers
|
|
8
|
+
|
|
9
|
+
# workers
|
|
10
|
+
|
|
11
|
+
## Type Aliases
|
|
12
|
+
|
|
13
|
+
### CodemodeLoader
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
type CodemodeLoader = WorkerLoader;
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The Worker Loader binding Codemode runs guests on.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
### CodemodeSandboxOptions
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
type CodemodeSandboxOptions = Readonly<{
|
|
27
|
+
localDevUnenforcedLimits?: readonly (
|
|
28
|
+
"cpu" | "memory" | "output" | "cancel"
|
|
29
|
+
)[];
|
|
30
|
+
}>;
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Local development facts supplied by the host, never by guest code.
|
|
34
|
+
|
|
35
|
+
## Functions
|
|
36
|
+
|
|
37
|
+
### createCodemodeSandbox()
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
function createCodemodeSandbox(loader, adapter?, options?): Sandbox;
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Construct a network-isolated Codemode sandbox over a Worker Loader.
|
|
44
|
+
|
|
45
|
+
#### Parameters
|
|
46
|
+
|
|
47
|
+
| Parameter | Type | Default value |
|
|
48
|
+
| --------- | --------------------------------------------------- | -------------------- |
|
|
49
|
+
| `loader` | `WorkerLoader` | `undefined` |
|
|
50
|
+
| `adapter` | `string` | `"codemode-workerd"` |
|
|
51
|
+
| `options` | [`CodemodeSandboxOptions`](#codemodesandboxoptions) | `{}` |
|
|
52
|
+
|
|
53
|
+
#### Returns
|
|
54
|
+
|
|
55
|
+
[`Sandbox`](sandbox.md#sandbox)
|
package/package.json
CHANGED
|
@@ -1,6 +1,135 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/mycelium",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"author": "Levi <levi@technomancy.dev>",
|
|
5
|
+
"description": "Effect-native scoped capability lifecycle with a Zod-authored execute door",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./define": {
|
|
15
|
+
"types": "./dist/define.d.ts",
|
|
16
|
+
"import": "./dist/define.js"
|
|
17
|
+
},
|
|
18
|
+
"./effect": {
|
|
19
|
+
"types": "./dist/effect.d.ts",
|
|
20
|
+
"import": "./dist/effect.js"
|
|
21
|
+
},
|
|
22
|
+
"./remote": {
|
|
23
|
+
"types": "./dist/remote.d.ts",
|
|
24
|
+
"import": "./dist/remote.js"
|
|
25
|
+
},
|
|
26
|
+
"./semaphore-transition": {
|
|
27
|
+
"types": "./dist/semaphore-transition.d.ts",
|
|
28
|
+
"import": "./dist/semaphore-transition.js"
|
|
29
|
+
},
|
|
30
|
+
"./sandbox-guest": {
|
|
31
|
+
"types": "./dist/sandbox-guest.d.ts",
|
|
32
|
+
"import": "./dist/sandbox-guest.js"
|
|
33
|
+
},
|
|
34
|
+
"./sandbox-wire": {
|
|
35
|
+
"types": "./dist/sandbox-wire.d.ts",
|
|
36
|
+
"import": "./dist/sandbox-wire.js"
|
|
37
|
+
},
|
|
38
|
+
"./sandbox-failure": {
|
|
39
|
+
"types": "./dist/sandbox-failure.d.ts",
|
|
40
|
+
"import": "./dist/sandbox-failure.js"
|
|
41
|
+
},
|
|
42
|
+
"./sandbox-boundary": {
|
|
43
|
+
"types": "./dist/sandbox-boundary.d.ts",
|
|
44
|
+
"import": "./dist/sandbox-boundary.js"
|
|
45
|
+
},
|
|
46
|
+
"./testing": {
|
|
47
|
+
"types": "./dist/testing.d.ts",
|
|
48
|
+
"import": "./dist/testing.js"
|
|
49
|
+
},
|
|
50
|
+
"./workers": {
|
|
51
|
+
"types": "./dist/workers/index.d.ts",
|
|
52
|
+
"import": "./dist/workers/index.js"
|
|
53
|
+
},
|
|
54
|
+
"./mcp": {
|
|
55
|
+
"types": "./dist/mcp.d.ts",
|
|
56
|
+
"import": "./dist/mcp.js"
|
|
57
|
+
},
|
|
58
|
+
"./sandbox": {
|
|
59
|
+
"types": "./dist/sandbox.d.ts",
|
|
60
|
+
"import": "./dist/sandbox.js"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"imports": {
|
|
64
|
+
"#build-identity": {
|
|
65
|
+
"node": "./dist/internal/build-identity.node.js",
|
|
66
|
+
"default": "./dist/internal/build-identity.js"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"files": [
|
|
70
|
+
"dist",
|
|
71
|
+
"docs/api",
|
|
72
|
+
"README.md",
|
|
73
|
+
"LICENSE",
|
|
74
|
+
"THIRD_PARTY_NOTICES"
|
|
75
|
+
],
|
|
76
|
+
"dependencies": {
|
|
77
|
+
"@fungi.computer/cairn": "0.0.1",
|
|
78
|
+
"@fungi.computer/forage": "0.0.2",
|
|
79
|
+
"@fungi.computer/mule": "0.0.2",
|
|
80
|
+
"@fungi.computer/puffball": "0.0.2",
|
|
81
|
+
"effect": "4.0.2",
|
|
82
|
+
"zod": "4.4.3",
|
|
83
|
+
"acorn": "8.18.0",
|
|
84
|
+
"@cloudflare/codemode": "0.5.1",
|
|
85
|
+
"@modelcontextprotocol/server": "2.0.0"
|
|
86
|
+
},
|
|
87
|
+
"devDependencies": {
|
|
88
|
+
"@cloudflare/vitest-plugin": "1.1.2",
|
|
89
|
+
"@types/node": "24.13.3",
|
|
90
|
+
"typescript": "5.9.3",
|
|
91
|
+
"vitest": "4.1.11",
|
|
92
|
+
"@cloudflare/workers-types": "5.20260828.1",
|
|
93
|
+
"@modelcontextprotocol/client": "2.0.0"
|
|
94
|
+
},
|
|
95
|
+
"botanical": {
|
|
96
|
+
"role": "package",
|
|
97
|
+
"operations": {
|
|
98
|
+
"lint": "required",
|
|
99
|
+
"typecheck": "required",
|
|
100
|
+
"build": "required",
|
|
101
|
+
"test": "required",
|
|
102
|
+
"docs": "required",
|
|
103
|
+
"pack": "required",
|
|
104
|
+
"smoke": "required",
|
|
105
|
+
"stranger": "required"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"license": "MIT",
|
|
109
|
+
"repository": {
|
|
110
|
+
"type": "git",
|
|
111
|
+
"url": "git+https://github.com/fungi-computer/mycelium.git"
|
|
112
|
+
},
|
|
113
|
+
"fungi": {
|
|
114
|
+
"build": {
|
|
115
|
+
"typescript": [
|
|
116
|
+
"src/workers/tsconfig.json"
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"scripts": {
|
|
121
|
+
"lint": "eslint src test --max-warnings=0 && ../../node_modules/.bin/oxlint --config ../../oxlint.config.ts --deny-warnings src test",
|
|
122
|
+
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p src/workers/tsconfig.json --noEmit",
|
|
123
|
+
"build": "pnpm run clean && tsc -p tsconfig.build.json && tsc -p src/workers/tsconfig.json",
|
|
124
|
+
"clean": "node --input-type=module --eval \"import { rm } from 'node:fs/promises'; await rm('dist', { recursive: true, force: true });\"",
|
|
125
|
+
"test": "vitest run && pnpm run test:workers",
|
|
126
|
+
"test:workers": "vitest run --config test/vitest.workers.config.mts",
|
|
127
|
+
"docs": "tsx ../../tooling/repository/src/docs/cli.ts check --root ../..",
|
|
128
|
+
"docs:write": "tsx ../../tooling/repository/src/docs/cli.ts write --root ../..",
|
|
129
|
+
"pack": "pnpm run build && node scripts/stamp-build.mjs && mkdir -p ../../.botanical/mycelium-pack && pnpm pack --pack-destination ../../.botanical/mycelium-pack",
|
|
130
|
+
"smoke": "node --input-type=module -e \"import('./dist/index.js').then(({Mycelium}) => { if (!Mycelium) process.exit(1); })\"",
|
|
131
|
+
"stranger": "tsx ../../tooling/repository/src/artifacts/cli.ts --repo-root ../.. .",
|
|
132
|
+
"format:check": "node ../../tooling/repository/scripts/format-package-check.mjs",
|
|
133
|
+
"lint:anti-slop": "node ../../tooling/repository/scripts/lint-package-anti-slop.mjs"
|
|
134
|
+
}
|
|
6
135
|
}
|