@fungi.computer/shiitake 0.0.0-stage → 0.1.0
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 +454 -2
- package/dist/agar-extension.d.ts +9 -0
- package/dist/agar-extension.js +38 -0
- package/dist/agent-control.d.ts +77 -0
- package/dist/agent-control.js +434 -0
- package/dist/client-entry.d.ts +211 -0
- package/dist/client-entry.js +101 -0
- package/dist/client-wire.d.ts +199 -0
- package/dist/client-wire.js +271 -0
- package/dist/client.d.ts +439 -0
- package/dist/client.js +4 -0
- package/dist/cloudflare.d.ts +220 -0
- package/dist/cloudflare.js +531 -0
- package/dist/effect.d.ts +42 -0
- package/dist/effect.js +20 -0
- package/dist/errors.d.ts +50 -0
- package/dist/errors.js +81 -0
- package/dist/extension-client.d.ts +38 -0
- package/dist/extension-client.js +56 -0
- package/dist/extension-contract.d.ts +73 -0
- package/dist/extension-contract.js +11 -0
- package/dist/extensions.d.ts +589 -0
- package/dist/extensions.js +263 -0
- package/dist/fleet.d.ts +313 -0
- package/dist/fleet.js +540 -0
- package/dist/hosted.d.ts +133 -0
- package/dist/hosted.js +265 -0
- package/dist/http-routes.d.ts +772 -0
- package/dist/http-routes.js +242 -0
- package/dist/http.d.ts +1 -0
- package/dist/http.js +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +13 -0
- package/dist/internal/accepted-run-executor.d.ts +23 -0
- package/dist/internal/accepted-run-executor.js +129 -0
- package/dist/internal/admission-door.d.ts +75 -0
- package/dist/internal/admission-door.js +105 -0
- package/dist/internal/agent-close.d.ts +4 -0
- package/dist/internal/agent-close.js +42 -0
- package/dist/internal/browser-sessions.d.ts +31 -0
- package/dist/internal/browser-sessions.js +173 -0
- package/dist/internal/client-boundary.d.ts +262 -0
- package/dist/internal/client-boundary.js +202 -0
- package/dist/internal/compaction/compaction.d.ts +54 -0
- package/dist/internal/compaction/compaction.js +291 -0
- package/dist/internal/compaction/session-compaction.d.ts +69 -0
- package/dist/internal/compaction/session-compaction.js +330 -0
- package/dist/internal/compaction/settings.d.ts +11 -0
- package/dist/internal/compaction/settings.js +40 -0
- package/dist/internal/compaction/utils.d.ts +45 -0
- package/dist/internal/compaction/utils.js +319 -0
- package/dist/internal/contracts.d.ts +235 -0
- package/dist/internal/contracts.js +1 -0
- package/dist/internal/coordinator.d.ts +18 -0
- package/dist/internal/coordinator.js +362 -0
- package/dist/internal/document-codec.d.ts +11 -0
- package/dist/internal/document-codec.js +39 -0
- package/dist/internal/effect-client.d.ts +13 -0
- package/dist/internal/effect-client.js +102 -0
- package/dist/internal/effect-contracts.d.ts +236 -0
- package/dist/internal/effect-contracts.js +2 -0
- package/dist/internal/extension-command-registry.d.ts +11 -0
- package/dist/internal/extension-command-registry.js +29 -0
- package/dist/internal/extension-command-tools.d.ts +17 -0
- package/dist/internal/extension-command-tools.js +50 -0
- package/dist/internal/extension-context.d.ts +25 -0
- package/dist/internal/extension-context.js +35 -0
- package/dist/internal/extension-definitions.d.ts +5 -0
- package/dist/internal/extension-definitions.js +6 -0
- package/dist/internal/extension-hook.d.ts +25 -0
- package/dist/internal/extension-hook.js +46 -0
- package/dist/internal/extension-roster.d.ts +23 -0
- package/dist/internal/extension-roster.js +228 -0
- package/dist/internal/extension-runtime.d.ts +63 -0
- package/dist/internal/extension-runtime.js +1004 -0
- package/dist/internal/failure.d.ts +2 -0
- package/dist/internal/failure.js +9 -0
- package/dist/internal/host-meta.d.ts +41 -0
- package/dist/internal/host-meta.js +39 -0
- package/dist/internal/json-value.d.ts +4 -0
- package/dist/internal/json-value.js +3 -0
- package/dist/internal/model-acquisition.d.ts +21 -0
- package/dist/internal/model-acquisition.js +98 -0
- package/dist/internal/model-preference.d.ts +21 -0
- package/dist/internal/model-preference.js +20 -0
- package/dist/internal/observation-kernel.d.ts +28 -0
- package/dist/internal/observation-kernel.js +169 -0
- package/dist/internal/promise-facade.d.ts +18 -0
- package/dist/internal/promise-facade.js +172 -0
- package/dist/internal/run-scope.d.ts +27 -0
- package/dist/internal/run-scope.js +214 -0
- package/dist/internal/runtime-coordinator.d.ts +34 -0
- package/dist/internal/runtime-coordinator.js +233 -0
- package/dist/internal/runtime-core.d.ts +19 -0
- package/dist/internal/runtime-core.js +39 -0
- package/dist/internal/runtime-reconciliation.d.ts +18 -0
- package/dist/internal/runtime-reconciliation.js +162 -0
- package/dist/internal/session-context.d.ts +11 -0
- package/dist/internal/session-context.js +67 -0
- package/dist/internal/session-status.d.ts +10 -0
- package/dist/internal/session-status.js +52 -0
- package/dist/internal/woodstock/agent-reply.d.ts +25 -0
- package/dist/internal/woodstock/agent-reply.js +67 -0
- package/dist/internal/woodstock/client-projection.d.ts +29 -0
- package/dist/internal/woodstock/client-projection.js +512 -0
- package/dist/internal/woodstock/compaction-activity.d.ts +17 -0
- package/dist/internal/woodstock/compaction-activity.js +32 -0
- package/dist/internal/woodstock/cursor.d.ts +9 -0
- package/dist/internal/woodstock/cursor.js +44 -0
- package/dist/internal/woodstock/extension-store.d.ts +72 -0
- package/dist/internal/woodstock/extension-store.js +262 -0
- package/dist/internal/woodstock/fleet-store.d.ts +36 -0
- package/dist/internal/woodstock/fleet-store.js +100 -0
- package/dist/internal/woodstock/identities.d.ts +6 -0
- package/dist/internal/woodstock/identities.js +11 -0
- package/dist/internal/woodstock/index.d.ts +170 -0
- package/dist/internal/woodstock/index.js +546 -0
- package/dist/internal/woodstock/progress.d.ts +32 -0
- package/dist/internal/woodstock/progress.js +89 -0
- package/dist/internal/woodstock/run-recovery.d.ts +8 -0
- package/dist/internal/woodstock/run-recovery.js +95 -0
- package/dist/internal/woodstock/session-attention.d.ts +16 -0
- package/dist/internal/woodstock/session-attention.js +88 -0
- package/dist/internal/woodstock/session-documents.d.ts +18 -0
- package/dist/internal/woodstock/session-documents.js +51 -0
- package/dist/internal/woodstock/session-entry.d.ts +478 -0
- package/dist/internal/woodstock/session-entry.js +484 -0
- package/dist/internal/woodstock/session-grants.d.ts +24 -0
- package/dist/internal/woodstock/session-grants.js +84 -0
- package/dist/internal/woodstock/session-inbox.d.ts +56 -0
- package/dist/internal/woodstock/session-inbox.js +307 -0
- package/dist/internal/woodstock/session-store.d.ts +432 -0
- package/dist/internal/woodstock/session-store.js +2006 -0
- package/dist/internal/woodstock/storage-admission.d.ts +14 -0
- package/dist/internal/woodstock/storage-admission.js +44 -0
- package/dist/model-preference.d.ts +20 -0
- package/dist/model-preference.js +30 -0
- package/dist/node.d.ts +64 -0
- package/dist/node.js +256 -0
- package/dist/remote-client.d.ts +11 -0
- package/dist/remote-client.js +298 -0
- package/dist/session-attention.d.ts +35 -0
- package/dist/session-attention.js +22 -0
- package/dist/session-documents.d.ts +28 -0
- package/dist/session-documents.js +1 -0
- package/dist/testing.d.ts +54 -0
- package/dist/testing.js +215 -0
- package/docs/api/README.md +26 -0
- package/docs/api/agar-extension.md +40 -0
- package/docs/api/agent-control.md +151 -0
- package/docs/api/client-entry.md +344 -0
- package/docs/api/client.md +1112 -0
- package/docs/api/cloudflare.md +500 -0
- package/docs/api/effect.md +884 -0
- package/docs/api/extensions.md +2003 -0
- package/docs/api/fleet.md +734 -0
- package/docs/api/hosted.md +382 -0
- package/docs/api/http.md +111 -0
- package/docs/api/index.md +1116 -0
- package/docs/api/model-preference.md +151 -0
- package/docs/api/node.md +142 -0
- package/docs/api/testing.md +250 -0
- package/package.json +130 -3
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
<!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
|
|
2
|
+
|
|
3
|
+
[**@fungi.computer/shiitake**](README.md)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
[@fungi.computer/shiitake](README.md) / model-preference
|
|
8
|
+
|
|
9
|
+
# model-preference
|
|
10
|
+
|
|
11
|
+
## Variables
|
|
12
|
+
|
|
13
|
+
### ModelPreferenceSchema
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
const ModelPreferenceSchema: Struct<{
|
|
17
|
+
providerId: String;
|
|
18
|
+
modelId: String;
|
|
19
|
+
reasoning: optional<
|
|
20
|
+
Literals<readonly ["minimal", "low", "medium", "high", "xhigh", "max"]>
|
|
21
|
+
>;
|
|
22
|
+
}>;
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Secret-free request to the host's maintained model catalogue.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
### parseModelPreference
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
const parseModelPreference: (
|
|
33
|
+
input,
|
|
34
|
+
options?,
|
|
35
|
+
) => {
|
|
36
|
+
providerId: string;
|
|
37
|
+
modelId: string;
|
|
38
|
+
reasoning?: "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
39
|
+
} | null;
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Decode the bounded client preference; availability remains model-owner policy.
|
|
43
|
+
|
|
44
|
+
#### Parameters
|
|
45
|
+
|
|
46
|
+
| Parameter | Type |
|
|
47
|
+
| ---------- | -------------- |
|
|
48
|
+
| `input` | `unknown` |
|
|
49
|
+
| `options?` | `ParseOptions` |
|
|
50
|
+
|
|
51
|
+
#### Returns
|
|
52
|
+
|
|
53
|
+
\| \{ `providerId`: `string`; `modelId`: `string`; `reasoning?`: `"minimal"` \|
|
|
54
|
+
`"low"` \| `"medium"` \| `"high"` \| `"xhigh"` \| `"max"`; \} \| `null`
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
### parseModelPreferenceJson
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
const parseModelPreferenceJson: (
|
|
62
|
+
input,
|
|
63
|
+
options?,
|
|
64
|
+
) => {
|
|
65
|
+
providerId: string;
|
|
66
|
+
modelId: string;
|
|
67
|
+
reasoning?: "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
68
|
+
} | null;
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Decode the serialized preference with the same maintained schema.
|
|
72
|
+
|
|
73
|
+
#### Parameters
|
|
74
|
+
|
|
75
|
+
| Parameter | Type |
|
|
76
|
+
| ---------- | -------------- |
|
|
77
|
+
| `input` | `unknown` |
|
|
78
|
+
| `options?` | `ParseOptions` |
|
|
79
|
+
|
|
80
|
+
#### Returns
|
|
81
|
+
|
|
82
|
+
\| \{ `providerId`: `string`; `modelId`: `string`; `reasoning?`: `"minimal"` \|
|
|
83
|
+
`"low"` \| `"medium"` \| `"high"` \| `"xhigh"` \| `"max"`; \} \| `null`
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
### modelPreferenceJsonSchema
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
const modelPreferenceJsonSchema: JsonSchema;
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
JSON Schema generated from Shiitake's maintained model preference schema.
|
|
94
|
+
|
|
95
|
+
## Functions
|
|
96
|
+
|
|
97
|
+
### parseModelAddress()
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
function parseModelAddress(input): object;
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Parse the footer's provider/model spelling; model ids may contain slashes.
|
|
104
|
+
|
|
105
|
+
#### Parameters
|
|
106
|
+
|
|
107
|
+
| Parameter | Type |
|
|
108
|
+
| --------- | --------- |
|
|
109
|
+
| `input` | `unknown` |
|
|
110
|
+
|
|
111
|
+
#### Returns
|
|
112
|
+
|
|
113
|
+
`object`
|
|
114
|
+
|
|
115
|
+
| Name | Type | Default value |
|
|
116
|
+
| ------------ | ------------------------------------------------------------------------ | ------------- |
|
|
117
|
+
| `providerId` | `string` | `identifier` |
|
|
118
|
+
| `modelId` | `string` | `identifier` |
|
|
119
|
+
| `reasoning?` | `"minimal"` \| `"low"` \| `"medium"` \| `"high"` \| `"xhigh"` \| `"max"` | - |
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
### resolveModelPreference()
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
function resolveModelPreference(layers): {
|
|
127
|
+
providerId: string;
|
|
128
|
+
modelId: string;
|
|
129
|
+
reasoning?: "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
130
|
+
} | null;
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Resolve host-owned defaults for a future run. Hosts supply offered, logged-in
|
|
134
|
+
availability; an explicit choice never silently falls through on auth failure.
|
|
135
|
+
|
|
136
|
+
#### Parameters
|
|
137
|
+
|
|
138
|
+
| Parameter | Type |
|
|
139
|
+
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
140
|
+
| `layers` | `Readonly`\<\{ `session?`: [`ModelPreference`](index.md#modelpreference) \| `null`; `agent?`: [`ModelPreference`](index.md#modelpreference) \| `null`; `manual?`: [`ModelPreference`](index.md#modelpreference) \| `null`; `team?`: [`ModelPreference`](index.md#modelpreference) \| `null`; `available?`: [`ModelPreference`](index.md#modelpreference) \| `null`; \}\> |
|
|
141
|
+
|
|
142
|
+
#### Returns
|
|
143
|
+
|
|
144
|
+
\| \{ `providerId`: `string`; `modelId`: `string`; `reasoning?`: `"minimal"` \|
|
|
145
|
+
`"low"` \| `"medium"` \| `"high"` \| `"xhigh"` \| `"max"`; \} \| `null`
|
|
146
|
+
|
|
147
|
+
## References
|
|
148
|
+
|
|
149
|
+
### ModelPreference
|
|
150
|
+
|
|
151
|
+
Re-exports [ModelPreference](index.md#modelpreference)
|
package/docs/api/node.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
<!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
|
|
2
|
+
|
|
3
|
+
[**@fungi.computer/shiitake**](README.md)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
[@fungi.computer/shiitake](README.md) / node
|
|
8
|
+
|
|
9
|
+
# node
|
|
10
|
+
|
|
11
|
+
## Type Aliases
|
|
12
|
+
|
|
13
|
+
### NodeRuntimeHost
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
type NodeRuntimeHost = Readonly<{
|
|
17
|
+
runtime: RuntimeHost;
|
|
18
|
+
scheduleWake: (at) => void;
|
|
19
|
+
close: () => Promise<void>;
|
|
20
|
+
}>;
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The event-loop runtime host one Node process gives one durable Agent.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
### NodeStoreLease
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
type NodeStoreLease = Readonly<{
|
|
31
|
+
release: () => void;
|
|
32
|
+
}>;
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
An exclusive, process-held claim on one store file.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
### NodeShiitakeOptions
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
type NodeShiitakeOptions = Omit<ShiitakeOptions, "store" | "runtime"> &
|
|
43
|
+
Readonly<{
|
|
44
|
+
path: string;
|
|
45
|
+
onRuntimeFailure?: (cause) => void;
|
|
46
|
+
}>;
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Everything a Node host supplies except the store and runtime it owns.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
### NodeShiitake
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
type NodeShiitake = Readonly<{
|
|
57
|
+
agent: ShiitakeOwnerAgent;
|
|
58
|
+
routes: Hono<ShiitakeHttpEnv>;
|
|
59
|
+
close: () => Promise<void>;
|
|
60
|
+
}>;
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
One durable Agent in a SQLite file, owned by this Node process.
|
|
64
|
+
|
|
65
|
+
## Functions
|
|
66
|
+
|
|
67
|
+
### nodeRuntimeHost()
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
function nodeRuntimeHost(observeFailure): NodeRuntimeHost;
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The Node event loop as Shiitake's runtime host: one reconciliation at a time,
|
|
74
|
+
re-run when woken during a pass, and a timer for the earliest due retry. It has
|
|
75
|
+
no queue policy; Watchdog owns execution and retries. `observeFailure` sees a
|
|
76
|
+
failed pass, which is retried after five seconds; if it throws, the throw is
|
|
77
|
+
logged and the retry still happens.
|
|
78
|
+
|
|
79
|
+
#### Parameters
|
|
80
|
+
|
|
81
|
+
| Parameter | Type |
|
|
82
|
+
| ---------------- | ------------------- |
|
|
83
|
+
| `observeFailure` | (`cause`) => `void` |
|
|
84
|
+
|
|
85
|
+
#### Returns
|
|
86
|
+
|
|
87
|
+
[`NodeRuntimeHost`](#noderuntimehost)
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
### acquireNodeStoreLease()
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
function acquireNodeStoreLease(sidecarPath): NodeStoreLease;
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Claim one store for this process: an exclusive transaction held open on a
|
|
98
|
+
sidecar file, so a second owner of the same store is refused at once and the
|
|
99
|
+
claim ends with the process, never with a missed heartbeat.
|
|
100
|
+
|
|
101
|
+
#### Parameters
|
|
102
|
+
|
|
103
|
+
| Parameter | Type |
|
|
104
|
+
| ------------- | -------- |
|
|
105
|
+
| `sidecarPath` | `string` |
|
|
106
|
+
|
|
107
|
+
#### Returns
|
|
108
|
+
|
|
109
|
+
[`NodeStoreLease`](#nodestorelease)
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
### openNodeShiitake()
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
function openNodeShiitake(options): Promise<
|
|
117
|
+
Readonly<{
|
|
118
|
+
agent: ShiitakeOwnerAgent;
|
|
119
|
+
routes: Hono<ShiitakeHttpEnv>;
|
|
120
|
+
close: () => Promise<void>;
|
|
121
|
+
}>
|
|
122
|
+
>;
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Open one durable Agent in a SQLite file on disk. The process holds an exclusive
|
|
126
|
+
lease on the store until `close`, so a second opener is refused. The store and
|
|
127
|
+
its lease file are private to this user (0600), and a store reached through a
|
|
128
|
+
symbolic link or with a second hard link is refused. Accepted work survives a
|
|
129
|
+
restart: reopening the file resumes it.
|
|
130
|
+
|
|
131
|
+
#### Parameters
|
|
132
|
+
|
|
133
|
+
| Parameter | Type |
|
|
134
|
+
| --------- | --------------------------------------------- |
|
|
135
|
+
| `options` | [`NodeShiitakeOptions`](#nodeshiitakeoptions) |
|
|
136
|
+
|
|
137
|
+
#### Returns
|
|
138
|
+
|
|
139
|
+
`Promise`\<`Readonly`\<\{ `agent`:
|
|
140
|
+
[`ShiitakeOwnerAgent`](index.md#shiitakeowneragent); `routes`:
|
|
141
|
+
`Hono`\<[`ShiitakeHttpEnv`](http.md#shiitakehttpenv)\>; `close`: () =>
|
|
142
|
+
`Promise`\<`void`\>; \}\>\>
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
<!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
|
|
2
|
+
|
|
3
|
+
[**@fungi.computer/shiitake**](README.md)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
[@fungi.computer/shiitake](README.md) / testing
|
|
8
|
+
|
|
9
|
+
# testing
|
|
10
|
+
|
|
11
|
+
## Classes
|
|
12
|
+
|
|
13
|
+
### ScriptedToolCall
|
|
14
|
+
|
|
15
|
+
One scripted model tool call; the scripted sandbox runs exactly this call.
|
|
16
|
+
|
|
17
|
+
#### Constructors
|
|
18
|
+
|
|
19
|
+
##### Constructor
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
new ScriptedToolCall(path, input): ScriptedToolCall;
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
###### Parameters
|
|
26
|
+
|
|
27
|
+
| Parameter | Type | Description |
|
|
28
|
+
| --------- | ---------------------------- | ----------------------------------------------------------------------- |
|
|
29
|
+
| `path` | `string` | `<alias>.<operation>` as the model would call it, e.g. `bookmarks.add`. |
|
|
30
|
+
| `input` | [`Json`](extensions.md#json) | - |
|
|
31
|
+
|
|
32
|
+
###### Returns
|
|
33
|
+
|
|
34
|
+
[`ScriptedToolCall`](#scriptedtoolcall)
|
|
35
|
+
|
|
36
|
+
#### Properties
|
|
37
|
+
|
|
38
|
+
##### path
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
readonly path: string;
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`<alias>.<operation>` as the model would call it, e.g. `bookmarks.add`.
|
|
45
|
+
|
|
46
|
+
##### input
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
readonly input: Json;
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Type Aliases
|
|
53
|
+
|
|
54
|
+
### ScriptStep
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
type ScriptStep = string | ScriptedToolCall | FauxResponseStep;
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
One model turn in a test script: a reply, a tool call, or a faux step.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
### MemoryHostOptions
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
type MemoryHostOptions = Partial<
|
|
68
|
+
Omit<ShiitakeOptions, "store" | "runtime" | "extensions">
|
|
69
|
+
> &
|
|
70
|
+
Readonly<{
|
|
71
|
+
owner?: SqliteOwner;
|
|
72
|
+
extensions?: ExtensionRosterV0 | readonly RosteredExtensionV0[];
|
|
73
|
+
script?: readonly ScriptStep[];
|
|
74
|
+
}>;
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Optional canonical Agent inputs and a borrowed owner; defaults are in-memory.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
### MemoryHost
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
type MemoryHost = Readonly<{
|
|
85
|
+
agent: ShiitakeOwnerAgent;
|
|
86
|
+
reconcile: () => Promise<void>;
|
|
87
|
+
settle: (sessionId, maxTicks?) => Promise<SessionSnapshot>;
|
|
88
|
+
close: () => Promise<void>;
|
|
89
|
+
}>;
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Explicitly driven in-process host for trusted tests and runnable examples.
|
|
93
|
+
|
|
94
|
+
## Functions
|
|
95
|
+
|
|
96
|
+
### fauxModelSource()
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
function fauxModelSource(replies): ModelSource;
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
A deterministic model source for trusted tests; no provider account or I/O.
|
|
103
|
+
|
|
104
|
+
#### Parameters
|
|
105
|
+
|
|
106
|
+
| Parameter | Type |
|
|
107
|
+
| --------- | ----------------------------- |
|
|
108
|
+
| `replies` | readonly `FauxResponseStep`[] |
|
|
109
|
+
|
|
110
|
+
#### Returns
|
|
111
|
+
|
|
112
|
+
[`ModelSource`](index.md#modelsource)
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
### callTool()
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
function callTool(path, input?): ScriptedToolCall;
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Script one model turn that calls an operation with this input.
|
|
123
|
+
|
|
124
|
+
#### Parameters
|
|
125
|
+
|
|
126
|
+
| Parameter | Type |
|
|
127
|
+
| --------- | ---------------------------- |
|
|
128
|
+
| `path` | `string` |
|
|
129
|
+
| `input` | [`Json`](extensions.md#json) |
|
|
130
|
+
|
|
131
|
+
#### Returns
|
|
132
|
+
|
|
133
|
+
[`ScriptedToolCall`](#scriptedtoolcall)
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
### echoSystemPrompt()
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
function echoSystemPrompt(): FauxResponseStep;
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Script one model turn that replies with the system prompt it received.
|
|
144
|
+
|
|
145
|
+
#### Returns
|
|
146
|
+
|
|
147
|
+
`FauxResponseStep`
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
### memoryHost()
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
function memoryHost(options?): Promise<Readonly<{
|
|
155
|
+
agent: ShiitakeOwnerAgent;
|
|
156
|
+
reconcile: () => Promise<void>;
|
|
157
|
+
settle: (sessionId, maxTicks?) => Promise<Readonly<{
|
|
158
|
+
sessionId: string;
|
|
159
|
+
cursor: string | null;
|
|
160
|
+
hasMore: boolean;
|
|
161
|
+
oldestCursor?: string | null;
|
|
162
|
+
messages: readonly Readonly<{
|
|
163
|
+
meta?: ... | ...;
|
|
164
|
+
origin?: ... | ...;
|
|
165
|
+
id: string;
|
|
166
|
+
sequence: number;
|
|
167
|
+
commandId: ... | ...;
|
|
168
|
+
value: Message;
|
|
169
|
+
}>[];
|
|
170
|
+
terminals: readonly Readonly<{
|
|
171
|
+
commandId: string;
|
|
172
|
+
outcome: ... | ... | ... | ...;
|
|
173
|
+
sequence: number;
|
|
174
|
+
diagnostic: ... | ...;
|
|
175
|
+
meta?: ... | ...;
|
|
176
|
+
}>[];
|
|
177
|
+
compactions?: readonly Readonly<{
|
|
178
|
+
id: ...;
|
|
179
|
+
sequence: ...;
|
|
180
|
+
at: ...;
|
|
181
|
+
tokensBefore: ...;
|
|
182
|
+
tokensAfter: ...;
|
|
183
|
+
trigger: ...;
|
|
184
|
+
}>[];
|
|
185
|
+
compactionNotices?: readonly Readonly<{
|
|
186
|
+
id: ...;
|
|
187
|
+
sequence: ...;
|
|
188
|
+
at: ...;
|
|
189
|
+
trigger: ...;
|
|
190
|
+
result: ...;
|
|
191
|
+
diagnostic: ...;
|
|
192
|
+
}>[];
|
|
193
|
+
sandboxFailures?: readonly object[];
|
|
194
|
+
pending: SessionPendingPrompts;
|
|
195
|
+
activity: SessionActivity;
|
|
196
|
+
progress: | Readonly<{
|
|
197
|
+
messageId: string;
|
|
198
|
+
revision: number;
|
|
199
|
+
text: string;
|
|
200
|
+
thinking: string;
|
|
201
|
+
textTruncated: boolean;
|
|
202
|
+
thinkingTruncated: boolean;
|
|
203
|
+
}>
|
|
204
|
+
| null;
|
|
205
|
+
extensions: SessionExtensionSlots;
|
|
206
|
+
attention: readonly object[];
|
|
207
|
+
context?: Readonly<{
|
|
208
|
+
tokens: number;
|
|
209
|
+
window: ... | ...;
|
|
210
|
+
}>;
|
|
211
|
+
}>>;
|
|
212
|
+
close: () => Promise<void>;
|
|
213
|
+
}>>;
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Compose the real Shiitake runtime over an optional borrowed SQLite owner. Call
|
|
217
|
+
reconcile/settle explicitly after acceptance. Defaults use a faux model and
|
|
218
|
+
rejecting sandbox; custom callbacks are NOT isolation and retain host
|
|
219
|
+
privileges. No submitted JavaScript is evaluated by this helper.
|
|
220
|
+
|
|
221
|
+
#### Parameters
|
|
222
|
+
|
|
223
|
+
| Parameter | Type |
|
|
224
|
+
| --------- | ----------------------------------------- |
|
|
225
|
+
| `options` | [`MemoryHostOptions`](#memoryhostoptions) |
|
|
226
|
+
|
|
227
|
+
#### Returns
|
|
228
|
+
|
|
229
|
+
`Promise`\<`Readonly`\<\{ `agent`:
|
|
230
|
+
[`ShiitakeOwnerAgent`](index.md#shiitakeowneragent); `reconcile`: () =>
|
|
231
|
+
`Promise`\<`void`\>; `settle`: (`sessionId`, `maxTicks?`) =>
|
|
232
|
+
`Promise`\<`Readonly`\<\{ `sessionId`: `string`; `cursor`: `string` \| `null`;
|
|
233
|
+
`hasMore`: `boolean`; `oldestCursor?`: `string` \| `null`; `messages`: readonly
|
|
234
|
+
`Readonly`\<\{ `meta?`: ... \| ...; `origin?`: ... \| ...; `id`: `string`;
|
|
235
|
+
`sequence`: `number`; `commandId`: ... \| ...; `value`: `Message`; \}\>[];
|
|
236
|
+
`terminals`: readonly `Readonly`\<\{ `commandId`: `string`; `outcome`: ... \|
|
|
237
|
+
... \| ... \| ...; `sequence`: `number`; `diagnostic`: ... \| ...; `meta?`: ...
|
|
238
|
+
\| ...; \}\>[]; `compactions?`: readonly `Readonly`\<\{ `id`: ...; `sequence`:
|
|
239
|
+
...; `at`: ...; `tokensBefore`: ...; `tokensAfter`: ...; `trigger`: ...; \}\>[];
|
|
240
|
+
`compactionNotices?`: readonly `Readonly`\<\{ `id`: ...; `sequence`: ...; `at`:
|
|
241
|
+
...; `trigger`: ...; `result`: ...; `diagnostic`: ...; \}\>[];
|
|
242
|
+
`sandboxFailures?`: readonly `object`[]; `pending`:
|
|
243
|
+
[`SessionPendingPrompts`](client.md#sessionpendingprompts); `activity`:
|
|
244
|
+
[`SessionActivity`](client.md#sessionactivity); `progress`: \| `Readonly`\<\{
|
|
245
|
+
`messageId`: `string`; `revision`: `number`; `text`: `string`; `thinking`:
|
|
246
|
+
`string`; `textTruncated`: `boolean`; `thinkingTruncated`: `boolean`; \}\> \|
|
|
247
|
+
`null`; `extensions`:
|
|
248
|
+
[`SessionExtensionSlots`](client.md#sessionextensionslots); `attention`:
|
|
249
|
+
readonly `object`[]; `context?`: `Readonly`\<\{ `tokens`: `number`; `window`:
|
|
250
|
+
... \| ...; \}\>; \}\>\>; `close`: () => `Promise`\<`void`\>; \}\>\>
|
package/package.json
CHANGED
|
@@ -1,6 +1,133 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/shiitake",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"author": "Levi <levi@technomancy.dev>",
|
|
5
|
+
"description": "Effect-native durable Session acceptance and bounded run orchestration",
|
|
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
|
+
"./effect": {
|
|
15
|
+
"types": "./dist/effect.d.ts",
|
|
16
|
+
"import": "./dist/effect.js"
|
|
17
|
+
},
|
|
18
|
+
"./client": {
|
|
19
|
+
"types": "./dist/client.d.ts",
|
|
20
|
+
"import": "./dist/client.js"
|
|
21
|
+
},
|
|
22
|
+
"./agent-control": {
|
|
23
|
+
"types": "./dist/agent-control.d.ts",
|
|
24
|
+
"import": "./dist/agent-control.js"
|
|
25
|
+
},
|
|
26
|
+
"./model-preference": {
|
|
27
|
+
"types": "./dist/model-preference.d.ts",
|
|
28
|
+
"import": "./dist/model-preference.js"
|
|
29
|
+
},
|
|
30
|
+
"./http": {
|
|
31
|
+
"types": "./dist/http.d.ts",
|
|
32
|
+
"import": "./dist/http.js"
|
|
33
|
+
},
|
|
34
|
+
"./cloudflare": {
|
|
35
|
+
"types": "./dist/cloudflare.d.ts",
|
|
36
|
+
"import": "./dist/cloudflare.js"
|
|
37
|
+
},
|
|
38
|
+
"./extensions": {
|
|
39
|
+
"types": "./dist/extensions.d.ts",
|
|
40
|
+
"import": "./dist/extensions.js"
|
|
41
|
+
},
|
|
42
|
+
"./hosted": {
|
|
43
|
+
"types": "./dist/hosted.d.ts",
|
|
44
|
+
"import": "./dist/hosted.js"
|
|
45
|
+
},
|
|
46
|
+
"./client-entry": {
|
|
47
|
+
"types": "./dist/client-entry.d.ts",
|
|
48
|
+
"import": "./dist/client-entry.js"
|
|
49
|
+
},
|
|
50
|
+
"./testing": {
|
|
51
|
+
"types": "./dist/testing.d.ts",
|
|
52
|
+
"import": "./dist/testing.js"
|
|
53
|
+
},
|
|
54
|
+
"./node": {
|
|
55
|
+
"types": "./dist/node.d.ts",
|
|
56
|
+
"import": "./dist/node.js"
|
|
57
|
+
},
|
|
58
|
+
"./agar-extension": {
|
|
59
|
+
"types": "./dist/agar-extension.d.ts",
|
|
60
|
+
"import": "./dist/agar-extension.js"
|
|
61
|
+
},
|
|
62
|
+
"./fleet": {
|
|
63
|
+
"types": "./dist/fleet.d.ts",
|
|
64
|
+
"import": "./dist/fleet.js"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"files": [
|
|
68
|
+
"dist",
|
|
69
|
+
"docs/api",
|
|
70
|
+
"README.md",
|
|
71
|
+
"LICENSE"
|
|
72
|
+
],
|
|
73
|
+
"engines": {
|
|
74
|
+
"node": ">=22.13"
|
|
75
|
+
},
|
|
76
|
+
"dependencies": {
|
|
77
|
+
"@fungi.computer/bird-dog": "0.0.1",
|
|
78
|
+
"@fungi.computer/cairn": "0.0.1",
|
|
79
|
+
"@fungi.computer/knapsack": "0.0.2",
|
|
80
|
+
"@fungi.computer/mule": "0.0.2",
|
|
81
|
+
"@fungi.computer/mycelium": "0.0.2",
|
|
82
|
+
"@fungi.computer/watchdog": "0.0.1",
|
|
83
|
+
"effect": "4.0.2",
|
|
84
|
+
"hono": "4.13.5",
|
|
85
|
+
"zod": "4.4.3",
|
|
86
|
+
"@earendil-works/pi-ai": "0.99.2",
|
|
87
|
+
"@fungi.computer/gills": "0.0.1",
|
|
88
|
+
"@fungi.computer/agar": "0.1.0"
|
|
89
|
+
},
|
|
90
|
+
"devDependencies": {
|
|
91
|
+
"@cloudflare/workers-types": "5.20260828.1",
|
|
92
|
+
"@types/node": "24.13.3",
|
|
93
|
+
"typescript": "5.9.3",
|
|
94
|
+
"vitest": "4.1.11",
|
|
95
|
+
"@fungi.computer/carrier": "0.0.1",
|
|
96
|
+
"@astrojs/starlight": "0.42.4"
|
|
97
|
+
},
|
|
98
|
+
"botanical": {
|
|
99
|
+
"role": "package",
|
|
100
|
+
"operations": {
|
|
101
|
+
"lint": "required",
|
|
102
|
+
"typecheck": "required",
|
|
103
|
+
"build": "required",
|
|
104
|
+
"test": "required",
|
|
105
|
+
"docs": "required",
|
|
106
|
+
"pack": "required",
|
|
107
|
+
"smoke": "required",
|
|
108
|
+
"stranger": "required"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"license": "MIT",
|
|
112
|
+
"repository": {
|
|
113
|
+
"type": "git",
|
|
114
|
+
"url": "git+https://github.com/fungi-computer/shiitake.git"
|
|
115
|
+
},
|
|
116
|
+
"scripts": {
|
|
117
|
+
"lint": "eslint src test examples --max-warnings=0 && ../../node_modules/.bin/oxlint --config ../../oxlint.config.ts --deny-warnings src test examples",
|
|
118
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
119
|
+
"build": "pnpm run clean && tsc -p tsconfig.build.json",
|
|
120
|
+
"clean": "node --input-type=module --eval \"import { rm } from 'node:fs/promises'; await rm('dist', { recursive: true, force: true });\"",
|
|
121
|
+
"test": "pnpm run test:unit && pnpm run test:merge",
|
|
122
|
+
"test:unit": "vitest run",
|
|
123
|
+
"test:merge": "node test/cloudflare-durable-wake.native.mjs && pnpm run test:docs",
|
|
124
|
+
"test:docs": "node --import tsx --test examples/bookmarks/checks.ts",
|
|
125
|
+
"docs": "tsx ../../tooling/repository/src/docs/cli.ts check --root ../..",
|
|
126
|
+
"docs:write": "tsx ../../tooling/repository/src/docs/cli.ts write --root ../..",
|
|
127
|
+
"pack": "mkdir -p ../../.botanical/shiitake-pack && pnpm pack --pack-destination ../../.botanical/shiitake-pack",
|
|
128
|
+
"smoke": "node --input-type=module -e \"import('./dist/index.js').then(({Shiitake}) => { if (!Shiitake) process.exit(1); })\"",
|
|
129
|
+
"stranger": "tsx ../../tooling/repository/src/artifacts/cli.ts --repo-root ../.. .",
|
|
130
|
+
"format:check": "node ../../tooling/repository/scripts/format-package-check.mjs",
|
|
131
|
+
"lint:anti-slop": "node ../../tooling/repository/scripts/lint-package-anti-slop.mjs"
|
|
132
|
+
}
|
|
6
133
|
}
|