@fungi.computer/shiitake 0.3.0 → 0.3.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/dist/http-routes.d.ts +7 -7
- package/dist/internal/compaction/compaction.d.ts +5 -5
- package/dist/internal/compaction/compaction.js +3 -4
- package/dist/internal/compaction/settings.d.ts +1 -1
- package/dist/internal/compaction/utils.d.ts +1 -1
- package/dist/internal/model-preference.d.ts +2 -2
- package/dist/internal/woodstock/session-entry.d.ts +1 -1
- package/dist/testing.d.ts +1 -1
- package/docs/api/model-preference.md +10 -10
- package/package.json +4 -4
package/dist/http-routes.d.ts
CHANGED
|
@@ -217,7 +217,7 @@ export declare function createShiitakeHttpRoutes(resolveSession: ShiitakeSession
|
|
|
217
217
|
output: {
|
|
218
218
|
readonly providerId: string;
|
|
219
219
|
readonly modelId: string;
|
|
220
|
-
readonly reasoning?: "
|
|
220
|
+
readonly reasoning?: "high" | "low" | "max" | "medium" | "minimal" | "xhigh" | undefined;
|
|
221
221
|
} | null;
|
|
222
222
|
outputFormat: "json";
|
|
223
223
|
status: 200;
|
|
@@ -230,7 +230,7 @@ export declare function createShiitakeHttpRoutes(resolveSession: ShiitakeSession
|
|
|
230
230
|
json: {
|
|
231
231
|
readonly providerId: string;
|
|
232
232
|
readonly modelId: string;
|
|
233
|
-
readonly reasoning?: "
|
|
233
|
+
readonly reasoning?: "high" | "low" | "max" | "medium" | "minimal" | "xhigh" | undefined;
|
|
234
234
|
} | null;
|
|
235
235
|
} & {
|
|
236
236
|
param: {
|
|
@@ -251,7 +251,7 @@ export declare function createShiitakeHttpRoutes(resolveSession: ShiitakeSession
|
|
|
251
251
|
json: {
|
|
252
252
|
readonly providerId: string;
|
|
253
253
|
readonly modelId: string;
|
|
254
|
-
readonly reasoning?: "
|
|
254
|
+
readonly reasoning?: "high" | "low" | "max" | "medium" | "minimal" | "xhigh" | undefined;
|
|
255
255
|
} | null;
|
|
256
256
|
} & {
|
|
257
257
|
param: {
|
|
@@ -579,13 +579,13 @@ export declare function createShiitakeHttpRoutes(resolveSession: ShiitakeSession
|
|
|
579
579
|
thinkingSignature?: string | undefined;
|
|
580
580
|
redacted?: boolean | undefined;
|
|
581
581
|
})[];
|
|
582
|
-
api: import("@
|
|
583
|
-
provider: import("@
|
|
582
|
+
api: import("@fungi.computer/mule/effect").Api;
|
|
583
|
+
provider: import("@fungi.computer/mule/effect").ProviderId;
|
|
584
584
|
model: string;
|
|
585
585
|
responseModel?: string | undefined;
|
|
586
586
|
responseId?: string | undefined;
|
|
587
587
|
providerThinkingLevel?: string | undefined;
|
|
588
|
-
thinkingLevel?: import("@
|
|
588
|
+
thinkingLevel?: import("@fungi.computer/mule/effect").ModelThinkingLevel | undefined;
|
|
589
589
|
diagnostics?: {
|
|
590
590
|
type: string;
|
|
591
591
|
timestamp: number;
|
|
@@ -615,7 +615,7 @@ export declare function createShiitakeHttpRoutes(resolveSession: ShiitakeSession
|
|
|
615
615
|
total: number;
|
|
616
616
|
};
|
|
617
617
|
};
|
|
618
|
-
stopReason: import("@
|
|
618
|
+
stopReason: import("@fungi.computer/mule/effect").StopReason;
|
|
619
619
|
deferred?: {
|
|
620
620
|
provider: string;
|
|
621
621
|
modelId: string;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Range selection follows Pi Durable spec §8.7 (`earendil-works/pi` at
|
|
6
6
|
* 8efd314f) and token estimates are pi-ai's own.
|
|
7
7
|
*/
|
|
8
|
-
import type { Api, Model, Usage } from "@
|
|
8
|
+
import type { Api, Model, Usage } from "@fungi.computer/mule/effect";
|
|
9
9
|
import type { MuleStreamFunction } from "@fungi.computer/mule/effect";
|
|
10
10
|
import * as Effect from "effect/Effect";
|
|
11
11
|
import type { BorrowedCompactionViewV0 } from "../../extensions.js";
|
|
@@ -14,14 +14,14 @@ import { createFileOps, type CompactionSettings } from "./utils.js";
|
|
|
14
14
|
export type CompactionSourceEntry = Readonly<{
|
|
15
15
|
id: string;
|
|
16
16
|
kind: "message";
|
|
17
|
-
message: import("@
|
|
17
|
+
message: import("@fungi.computer/mule/effect").Message;
|
|
18
18
|
}> | Readonly<{
|
|
19
19
|
id: string;
|
|
20
20
|
kind: "compaction";
|
|
21
21
|
/** Pi's entry head: the first entry the summary keeps. */
|
|
22
22
|
head: string;
|
|
23
23
|
/** Pi's entry model message: the summary the model reads. */
|
|
24
|
-
model: import("@
|
|
24
|
+
model: import("@fungi.computer/mule/effect").UserMessage;
|
|
25
25
|
usage: Usage;
|
|
26
26
|
details?: Readonly<{
|
|
27
27
|
readFiles: readonly string[];
|
|
@@ -30,8 +30,8 @@ export type CompactionSourceEntry = Readonly<{
|
|
|
30
30
|
}>;
|
|
31
31
|
export type CompactionPreparation = Readonly<{
|
|
32
32
|
firstKeptEntryId: string;
|
|
33
|
-
messagesToSummarize: readonly import("@
|
|
34
|
-
turnPrefixMessages: readonly import("@
|
|
33
|
+
messagesToSummarize: readonly import("@fungi.computer/mule/effect").Message[];
|
|
34
|
+
turnPrefixMessages: readonly import("@fungi.computer/mule/effect").Message[];
|
|
35
35
|
isSplitTurn: boolean;
|
|
36
36
|
tokensBefore: number;
|
|
37
37
|
previousSummary?: string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { normalizeContext } from "@earendil-works/pi-ai/utils/transcript";
|
|
2
|
+
import { streamModel } from "@fungi.computer/mule/effect";
|
|
1
3
|
// Leaf helpers, not Pi's root entry, which also evaluates its validators.
|
|
2
4
|
import { estimateContextTokens, estimateMessageTokens, } from "@earendil-works/pi-ai/utils/estimate";
|
|
3
5
|
import { retryAssistantCall } from "@earendil-works/pi-ai/utils/retry";
|
|
4
6
|
import { contentText } from "@earendil-works/pi-ai/utils/text";
|
|
5
|
-
import { normalizeContext } from "@earendil-works/pi-ai/utils/transcript";
|
|
6
7
|
import { uuidv7 } from "@earendil-works/pi-ai/utils/uuid";
|
|
7
8
|
import * as Effect from "effect/Effect";
|
|
8
9
|
import { ShiitakeError } from "../../errors.js";
|
|
@@ -210,9 +211,7 @@ function completeSummarization(model, context, options, streamFn) {
|
|
|
210
211
|
cacheRetention: "none",
|
|
211
212
|
sessionId: options.sessionId ?? uuidv7(),
|
|
212
213
|
};
|
|
213
|
-
return retryAssistantCall(() => streamFn
|
|
214
|
-
? Promise.resolve(streamFn(model, normalizeContext(context), requestOptions)).then((stream) => stream.result())
|
|
215
|
-
: import("@earendil-works/pi-ai/compat").then(({ completeSimple }) => completeSimple(model, context, requestOptions)), RETRY_POLICY, requestOptions.signal);
|
|
214
|
+
return retryAssistantCall(() => Promise.resolve((streamFn ?? streamModel)(model, normalizeContext(context), requestOptions)).then((stream) => stream.result()), RETRY_POLICY, requestOptions.signal);
|
|
216
215
|
}
|
|
217
216
|
function buildContext(promptText) {
|
|
218
217
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Api, Model } from "@
|
|
1
|
+
import type { Api, Model } from "@fungi.computer/mule/effect";
|
|
2
2
|
import type { CompactionOptions } from "../contracts.js";
|
|
3
3
|
import { type CompactionSettings } from "./utils.js";
|
|
4
4
|
/** Resolve one model's compaction settings from the host's validated options. */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Token estimates are pi-ai's own (`@earendil-works/pi-ai/utils/estimate`).
|
|
4
4
|
* The only destination delta is carrying Pi's native Message values directly.
|
|
5
5
|
*/
|
|
6
|
-
import type { AssistantMessage, Message, UserMessage } from "@
|
|
6
|
+
import type { AssistantMessage, Message, UserMessage } from "@fungi.computer/mule/effect";
|
|
7
7
|
/**
|
|
8
8
|
* Pi's compaction entry model message (Pi Durable `compaction.ts`): the
|
|
9
9
|
* summary as the user message the model reads, built once when the entry is
|
|
@@ -13,11 +13,11 @@ export type ModelPreference = Schema.Schema.Type<typeof ModelPreferenceSchema>;
|
|
|
13
13
|
export declare const parseModelPreference: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => {
|
|
14
14
|
readonly providerId: string;
|
|
15
15
|
readonly modelId: string;
|
|
16
|
-
readonly reasoning?: "
|
|
16
|
+
readonly reasoning?: "high" | "low" | "max" | "medium" | "minimal" | "xhigh" | undefined;
|
|
17
17
|
} | null;
|
|
18
18
|
/** Decode the serialized preference with the same maintained schema. */
|
|
19
19
|
export declare const parseModelPreferenceJson: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => {
|
|
20
20
|
readonly providerId: string;
|
|
21
21
|
readonly modelId: string;
|
|
22
|
-
readonly reasoning?: "
|
|
22
|
+
readonly reasoning?: "high" | "low" | "max" | "medium" | "minimal" | "xhigh" | undefined;
|
|
23
23
|
} | null;
|
|
@@ -337,7 +337,7 @@ export declare function decodeStoredSessionEntry(value: string): Result.Result<{
|
|
|
337
337
|
readonly preference: {
|
|
338
338
|
readonly providerId: string;
|
|
339
339
|
readonly modelId: string;
|
|
340
|
-
readonly reasoning?: "
|
|
340
|
+
readonly reasoning?: "high" | "low" | "max" | "medium" | "minimal" | "xhigh" | undefined;
|
|
341
341
|
} | null;
|
|
342
342
|
} | {
|
|
343
343
|
readonly kind: "command";
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { type FauxResponseStep } from "@fungi.computer/mule/testing";
|
|
1
2
|
import type { ExtensionRosterV0, Json, RosteredExtensionV0 } from "./extensions.js";
|
|
2
|
-
import { type FauxResponseStep } from "@earendil-works/pi-ai/providers/faux";
|
|
3
3
|
import { type ModelSource, type SessionSnapshot, type ShiitakeOwnerAgent, type ShiitakeOptions, type SqliteOwner } from "./index.js";
|
|
4
4
|
/** A deterministic model source for trusted tests; no provider account or I/O. */
|
|
5
5
|
export declare function fauxModelSource(replies: readonly FauxResponseStep[]): ModelSource;
|
|
@@ -52,7 +52,7 @@ const parseModelPreference: (
|
|
|
52
52
|
) => {
|
|
53
53
|
providerId: string;
|
|
54
54
|
modelId: string;
|
|
55
|
-
reasoning?: "
|
|
55
|
+
reasoning?: "high" | "low" | "max" | "medium" | "minimal" | "xhigh";
|
|
56
56
|
} | null;
|
|
57
57
|
```
|
|
58
58
|
|
|
@@ -67,8 +67,8 @@ Decode the bounded client preference; availability remains model-owner policy.
|
|
|
67
67
|
|
|
68
68
|
#### Returns
|
|
69
69
|
|
|
70
|
-
\| \{ `providerId`: `string`; `modelId`: `string`; `reasoning?`: `"
|
|
71
|
-
`"low"` \| `"
|
|
70
|
+
\| \{ `providerId`: `string`; `modelId`: `string`; `reasoning?`: `"high"` \|
|
|
71
|
+
`"low"` \| `"max"` \| `"medium"` \| `"minimal"` \| `"xhigh"`; \} \| `null`
|
|
72
72
|
|
|
73
73
|
---
|
|
74
74
|
|
|
@@ -81,7 +81,7 @@ const parseModelPreferenceJson: (
|
|
|
81
81
|
) => {
|
|
82
82
|
providerId: string;
|
|
83
83
|
modelId: string;
|
|
84
|
-
reasoning?: "
|
|
84
|
+
reasoning?: "high" | "low" | "max" | "medium" | "minimal" | "xhigh";
|
|
85
85
|
} | null;
|
|
86
86
|
```
|
|
87
87
|
|
|
@@ -96,8 +96,8 @@ Decode the serialized preference with the same maintained schema.
|
|
|
96
96
|
|
|
97
97
|
#### Returns
|
|
98
98
|
|
|
99
|
-
\| \{ `providerId`: `string`; `modelId`: `string`; `reasoning?`: `"
|
|
100
|
-
`"low"` \| `"
|
|
99
|
+
\| \{ `providerId`: `string`; `modelId`: `string`; `reasoning?`: `"high"` \|
|
|
100
|
+
`"low"` \| `"max"` \| `"medium"` \| `"minimal"` \| `"xhigh"`; \} \| `null`
|
|
101
101
|
|
|
102
102
|
---
|
|
103
103
|
|
|
@@ -133,7 +133,7 @@ Parse the footer's provider/model spelling; model ids may contain slashes.
|
|
|
133
133
|
| ------------ | ------------------------------------------------------------------------ | ------------- |
|
|
134
134
|
| `providerId` | `string` | `identifier` |
|
|
135
135
|
| `modelId` | `string` | `identifier` |
|
|
136
|
-
| `reasoning?` | `"
|
|
136
|
+
| `reasoning?` | `"high"` \| `"low"` \| `"max"` \| `"medium"` \| `"minimal"` \| `"xhigh"` | - |
|
|
137
137
|
|
|
138
138
|
---
|
|
139
139
|
|
|
@@ -143,7 +143,7 @@ Parse the footer's provider/model spelling; model ids may contain slashes.
|
|
|
143
143
|
function resolveModelPreference(layers): {
|
|
144
144
|
providerId: string;
|
|
145
145
|
modelId: string;
|
|
146
|
-
reasoning?: "
|
|
146
|
+
reasoning?: "high" | "low" | "max" | "medium" | "minimal" | "xhigh";
|
|
147
147
|
} | null;
|
|
148
148
|
```
|
|
149
149
|
|
|
@@ -158,8 +158,8 @@ availability; an explicit choice never silently falls through on auth failure.
|
|
|
158
158
|
|
|
159
159
|
#### Returns
|
|
160
160
|
|
|
161
|
-
\| \{ `providerId`: `string`; `modelId`: `string`; `reasoning?`: `"
|
|
162
|
-
`"low"` \| `"
|
|
161
|
+
\| \{ `providerId`: `string`; `modelId`: `string`; `reasoning?`: `"high"` \|
|
|
162
|
+
`"low"` \| `"max"` \| `"medium"` \| `"minimal"` \| `"xhigh"`; \} \| `null`
|
|
163
163
|
|
|
164
164
|
## References
|
|
165
165
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/shiitake",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"author": "Levi <levi@technomancy.dev>",
|
|
5
5
|
"description": "Effect-native durable Session acceptance and bounded run orchestration",
|
|
6
6
|
"type": "module",
|
|
@@ -85,9 +85,9 @@
|
|
|
85
85
|
"@fungi.computer/bird-dog": "0.1.0",
|
|
86
86
|
"@fungi.computer/cairn": "0.1.0",
|
|
87
87
|
"@fungi.computer/carrier": "0.1.0",
|
|
88
|
-
"@fungi.computer/knapsack": "0.2.
|
|
89
|
-
"@fungi.computer/mule": "0.1.
|
|
90
|
-
"@fungi.computer/mycelium": "0.2.
|
|
88
|
+
"@fungi.computer/knapsack": "0.2.1",
|
|
89
|
+
"@fungi.computer/mule": "0.1.1",
|
|
90
|
+
"@fungi.computer/mycelium": "0.2.1",
|
|
91
91
|
"@fungi.computer/seam": "0.1.0",
|
|
92
92
|
"@fungi.computer/watchdog": "0.1.0",
|
|
93
93
|
"effect": "4.0.2",
|