@fungi.computer/oyster 0.19.34 → 0.20.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.
|
@@ -21,14 +21,29 @@ export declare class AgentModelRefused extends Error {
|
|
|
21
21
|
readonly reason: AgentModelRefusal;
|
|
22
22
|
constructor(reason: AgentModelRefusal);
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Pi 1.3's Model/getModels contract has no tool-calling flag (reasoning and
|
|
26
|
+
* supportsStrictMode are not capability flags). Until it does, keep this small
|
|
27
|
+
* Agent shortlist beside the existing catalog, never copy names or prices.
|
|
28
|
+
* DeepSeek passed Grove's write/read proof on 2026-11-10; Granite failed its
|
|
29
|
+
* first execute call. Kimi is the existing Workers AI Agent default. The other
|
|
30
|
+
* entries are the providers' tool-capable Sonnet/Luna choices:
|
|
31
|
+
* https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview
|
|
32
|
+
* https://platform.openai.com/docs/guides/function-calling
|
|
33
|
+
* OpenRouter exposes that same Luna model. Other entries remain selectable as chat only;
|
|
34
|
+
* this is an admission policy for Agents, not a claim they cannot chat.
|
|
35
|
+
* Replace this fallback when Pi exposes its source's tool-calling flag.
|
|
36
|
+
*/
|
|
37
|
+
export declare function agentModelSupportsTools(model: Pick<Model<Api>, "provider" | "id">): boolean;
|
|
24
38
|
/** A supported model and Pi's USD prices per million tokens, without credentials. */
|
|
25
39
|
export type SupportedAgentModel = Readonly<{
|
|
26
40
|
id: string;
|
|
27
41
|
name: string;
|
|
28
42
|
input: number;
|
|
29
43
|
output: number;
|
|
44
|
+
tools: boolean;
|
|
30
45
|
}>;
|
|
31
|
-
/**
|
|
46
|
+
/** Pi's full catalog: verified tools first, then chat only; each group by price. */
|
|
32
47
|
export declare function supportedAgentModels(provider: "anthropic" | "openai" | "openrouter" | "cloudflare-workers-ai"): Promise<readonly SupportedAgentModel[]>;
|
|
33
48
|
/**
|
|
34
49
|
* An Agent with no saved choice runs on a model its host can reach, chosen when
|
|
@@ -43,7 +43,35 @@ async function byokCatalog(provider) {
|
|
|
43
43
|
.openrouterProvider()
|
|
44
44
|
.getModels();
|
|
45
45
|
}
|
|
46
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Pi 1.3's Model/getModels contract has no tool-calling flag (reasoning and
|
|
48
|
+
* supportsStrictMode are not capability flags). Until it does, keep this small
|
|
49
|
+
* Agent shortlist beside the existing catalog, never copy names or prices.
|
|
50
|
+
* DeepSeek passed Grove's write/read proof on 2026-11-10; Granite failed its
|
|
51
|
+
* first execute call. Kimi is the existing Workers AI Agent default. The other
|
|
52
|
+
* entries are the providers' tool-capable Sonnet/Luna choices:
|
|
53
|
+
* https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview
|
|
54
|
+
* https://platform.openai.com/docs/guides/function-calling
|
|
55
|
+
* OpenRouter exposes that same Luna model. Other entries remain selectable as chat only;
|
|
56
|
+
* this is an admission policy for Agents, not a claim they cannot chat.
|
|
57
|
+
* Replace this fallback when Pi exposes its source's tool-calling flag.
|
|
58
|
+
*/
|
|
59
|
+
export function agentModelSupportsTools(model) {
|
|
60
|
+
switch (model.provider) {
|
|
61
|
+
case "cloudflare-workers-ai":
|
|
62
|
+
return (model.id === "@cf/deepseek-ai/deepseek-v4-flash-0731" ||
|
|
63
|
+
model.id === "@cf/moonshotai/kimi-k2.6");
|
|
64
|
+
case "anthropic":
|
|
65
|
+
return model.id === "claude-sonnet-4-6";
|
|
66
|
+
case "openai":
|
|
67
|
+
return model.id === "gpt-6-luna" || model.id === "openai/gpt-6-luna";
|
|
68
|
+
case "openrouter":
|
|
69
|
+
return model.id === "openai/gpt-6-luna";
|
|
70
|
+
default:
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/** Pi's full catalog: verified tools first, then chat only; each group by price. */
|
|
47
75
|
export async function supportedAgentModels(provider) {
|
|
48
76
|
return (await byokCatalog(provider))
|
|
49
77
|
.map((model) => ({
|
|
@@ -51,8 +79,11 @@ export async function supportedAgentModels(provider) {
|
|
|
51
79
|
name: model.name,
|
|
52
80
|
input: model.cost.input,
|
|
53
81
|
output: model.cost.output,
|
|
82
|
+
tools: agentModelSupportsTools(model),
|
|
54
83
|
}))
|
|
55
|
-
.sort((a, b) =>
|
|
84
|
+
.sort((a, b) => Number(b.tools) - Number(a.tools) ||
|
|
85
|
+
a.input + a.output - b.input - b.output ||
|
|
86
|
+
a.id.localeCompare(b.id));
|
|
56
87
|
}
|
|
57
88
|
/**
|
|
58
89
|
* An Agent with no saved choice runs on a model its host can reach, chosen when
|
|
@@ -75,7 +106,7 @@ export async function resolveDefaultChoice(ready) {
|
|
|
75
106
|
provider !== "openrouter" &&
|
|
76
107
|
provider !== "cloudflare-workers-ai")
|
|
77
108
|
continue;
|
|
78
|
-
const catalog = await byokCatalog(provider);
|
|
109
|
+
const catalog = (await byokCatalog(provider)).filter(agentModelSupportsTools);
|
|
79
110
|
const model = catalog.find((entry) => "default" in entry && entry.default === true) ??
|
|
80
111
|
catalog[0];
|
|
81
112
|
if (model !== undefined)
|
|
@@ -43,7 +43,7 @@ import { standaloneBrowserLiveView, standaloneBrowserSource, } from "./browser.j
|
|
|
43
43
|
import { standaloneWebSource } from "./web.js";
|
|
44
44
|
import { configuredProviderEgress, providerFetch, } from "@fungi.computer/veil/gatekeeper";
|
|
45
45
|
import { createAssistantMessageEventStream } from "@earendil-works/pi-ai/utils/event-stream";
|
|
46
|
-
import { agentModelChoice, agentModelChoiceSchema, AgentModelRefused, resolveDefaultChoice, selectAgentModel, } from "./agent-model-choice.js";
|
|
46
|
+
import { agentModelChoice, agentModelChoiceSchema, AgentModelRefused, agentModelSupportsTools, resolveDefaultChoice, selectAgentModel, } from "./agent-model-choice.js";
|
|
47
47
|
import { CLOUDFLARE_GATEWAY_BINDING_AUTH_SENTINEL, createAiBindingFetch, } from "@earendil-works/pi-ai/api/cloudflare-ai-binding";
|
|
48
48
|
import { cloudflareAccountReady } from "./cloudflare-account.js";
|
|
49
49
|
import { cloudflareWorkersAIProvider } from "@earendil-works/pi-ai/providers/cloudflare-workers-ai";
|
|
@@ -173,17 +173,17 @@ function observedModels(model, defaults) {
|
|
|
173
173
|
/** The refusal a run ends with when no model provider is connected, in the host's own failure wording. */
|
|
174
174
|
const setupRequiredFailure = "Model request failed (setup_required). Connect a model first.";
|
|
175
175
|
/**
|
|
176
|
-
* A run
|
|
177
|
-
*
|
|
176
|
+
* A run refused before contacting the model: end with the host’s stable reason.
|
|
177
|
+
* A transport error would read as an outage and be retried.
|
|
178
178
|
*/
|
|
179
|
-
function
|
|
179
|
+
function refusedModels(model, reason) {
|
|
180
180
|
return {
|
|
181
181
|
acquire: () => {
|
|
182
182
|
const failed = new WeakSet();
|
|
183
183
|
return Promise.resolve({
|
|
184
184
|
model,
|
|
185
185
|
retryable: () => false,
|
|
186
|
-
failureReason: (message) => failed.has(message) ?
|
|
186
|
+
failureReason: (message) => (failed.has(message) ? reason : undefined),
|
|
187
187
|
stream: () => {
|
|
188
188
|
const events = createAssistantMessageEventStream();
|
|
189
189
|
const terminal = {
|
|
@@ -207,7 +207,7 @@ function unconfiguredModels(model) {
|
|
|
207
207
|
},
|
|
208
208
|
},
|
|
209
209
|
stopReason: "error",
|
|
210
|
-
errorMessage:
|
|
210
|
+
errorMessage: reason,
|
|
211
211
|
timestamp: Date.now(),
|
|
212
212
|
};
|
|
213
213
|
failed.add(terminal);
|
|
@@ -929,6 +929,10 @@ export class StandaloneAgentBase extends ShiitakeDO {
|
|
|
929
929
|
}
|
|
930
930
|
async sourceFor(choice) {
|
|
931
931
|
const modelChoice = await selectAgentModel(choice);
|
|
932
|
+
// Saved choices remain readable, but an Agent needs tools. Stop before a
|
|
933
|
+
// provider request instead of letting a chat-only choice fail opaquely.
|
|
934
|
+
if (!agentModelSupportsTools(modelChoice))
|
|
935
|
+
return refusedModels(normalizeModel(modelChoice), "Model request failed (tools_unsupported). Pick a model marked tools.");
|
|
932
936
|
if (choice.keySource === "byok" && choice.keyId !== undefined) {
|
|
933
937
|
await this.admitKey(choice);
|
|
934
938
|
const directory = await this.keyDirectory();
|
|
@@ -983,7 +987,7 @@ export class StandaloneAgentBase extends ShiitakeDO {
|
|
|
983
987
|
throw new AgentModelRefused("key_not_connected");
|
|
984
988
|
// The AI binding is declared everywhere; only a Cloudflare account answers it.
|
|
985
989
|
if (!cloudflareAccountReady(this.env))
|
|
986
|
-
return
|
|
990
|
+
return refusedModels(normalizeModel(modelChoice), setupRequiredFailure);
|
|
987
991
|
let options = { model: modelChoice.id };
|
|
988
992
|
if (this.env.OYSTER_AI_GATEWAY !== undefined)
|
|
989
993
|
options = { ...options, gateway: this.env.OYSTER_AI_GATEWAY };
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/oyster",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"author": "Levi <levi@technomancy.dev>",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "Oyster by Fungi: open-source Apps for people and AI agents. Try with one command or run on your own Cloudflare account.",
|
|
6
6
|
"homepage": "https://docs.fungi.computer/oyster",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"fungi",
|
|
@@ -356,11 +356,11 @@
|
|
|
356
356
|
"@fungi.computer/lantern": "0.4.2",
|
|
357
357
|
"@fungi.computer/mycelium": "0.3.8",
|
|
358
358
|
"@fungi.computer/nacre": "0.4.5",
|
|
359
|
-
"@fungi.computer/parakeet": "0.11.
|
|
359
|
+
"@fungi.computer/parakeet": "0.11.12",
|
|
360
360
|
"@fungi.computer/puffball": "0.5.5",
|
|
361
361
|
"@fungi.computer/seam": "0.2.5",
|
|
362
|
-
"@fungi.computer/shiitake": "0.
|
|
363
|
-
"@fungi.computer/shiitake-extensions": "0.6.
|
|
362
|
+
"@fungi.computer/shiitake": "0.13.0",
|
|
363
|
+
"@fungi.computer/shiitake-extensions": "0.6.12",
|
|
364
364
|
"@fungi.computer/sigils": "0.3.1",
|
|
365
365
|
"@fungi.computer/sprite": "0.2.2",
|
|
366
366
|
"@fungi.computer/sprite-zdog": "0.3.2",
|
|
@@ -368,7 +368,7 @@
|
|
|
368
368
|
"@fungi.computer/watchdog": "0.1.3",
|
|
369
369
|
"@fungi.computer/whistle": "0.3.0",
|
|
370
370
|
"@fungi.computer/workflows-wire": "0.4.8",
|
|
371
|
-
"@fungi.computer/zookeeper": "0.0.
|
|
371
|
+
"@fungi.computer/zookeeper": "0.0.19",
|
|
372
372
|
"@modelcontextprotocol/server": "2.0.0",
|
|
373
373
|
"@pnpm/lockfile.fs": "1100.2.13",
|
|
374
374
|
"@pnpm/lockfile.pruner": "1100.0.27",
|