@fungi.computer/oyster 0.19.31 → 0.19.32
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/agents.js
CHANGED
|
@@ -4,6 +4,7 @@ import { z } from "zod";
|
|
|
4
4
|
import {} from "./host.js";
|
|
5
5
|
import { agentAvatarSchema } from "./agent-avatars.js";
|
|
6
6
|
import { computerTargetParam } from "./computer-target.js";
|
|
7
|
+
import { supportedAgentModels } from "./standalone/agent-model-choice.js";
|
|
7
8
|
import { agentAvatar, agentList, agentManage, agentRename, agentSessionRead, agentSessionWrite, agentToolPolicy, } from "@fungi.computer/agar/agents";
|
|
8
9
|
/** At most this many connections per Agent. */
|
|
9
10
|
export const maxAgentConnections = 16;
|
|
@@ -371,7 +372,16 @@ export function agentApprovalRoutes(agents) {
|
|
|
371
372
|
name: item.name,
|
|
372
373
|
choice: await agents.readModelChoice(item.agentId),
|
|
373
374
|
})));
|
|
374
|
-
|
|
375
|
+
const keys = await agents.modelKeys();
|
|
376
|
+
const providers = [...new Set(keys.map((key) => key.provider))];
|
|
377
|
+
const catalogs = Object.fromEntries(await Promise.all(providers
|
|
378
|
+
.filter((provider) => provider !== "openai-compatible")
|
|
379
|
+
.map(async (provider) => [provider, await supportedAgentModels(provider)])));
|
|
380
|
+
return Response.json({
|
|
381
|
+
agents: rows,
|
|
382
|
+
catalogs,
|
|
383
|
+
models: (await agents.setup()).models,
|
|
384
|
+
});
|
|
375
385
|
})
|
|
376
386
|
.get("/api/agent-models/:agentId", owner("direct"), async (context) => {
|
|
377
387
|
const agentId = context.req.param("agentId");
|
|
@@ -21,6 +21,15 @@ export declare class AgentModelRefused extends Error {
|
|
|
21
21
|
readonly reason: AgentModelRefusal;
|
|
22
22
|
constructor(reason: AgentModelRefusal);
|
|
23
23
|
}
|
|
24
|
+
/** A supported model and Pi's USD prices per million tokens, without credentials. */
|
|
25
|
+
export type SupportedAgentModel = Readonly<{
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
input: number;
|
|
29
|
+
output: number;
|
|
30
|
+
}>;
|
|
31
|
+
/** Settings and selection share Pi's catalog; cheapest combined token rate first. */
|
|
32
|
+
export declare function supportedAgentModels(provider: "anthropic" | "openai" | "openrouter" | "cloudflare-workers-ai"): Promise<readonly SupportedAgentModel[]>;
|
|
24
33
|
/**
|
|
25
34
|
* An Agent with no saved choice runs on a model its host can reach, chosen when
|
|
26
35
|
* it runs: Workers AI where a Cloudflare account answers, then the Fungi
|
|
@@ -43,6 +43,17 @@ async function byokCatalog(provider) {
|
|
|
43
43
|
.openrouterProvider()
|
|
44
44
|
.getModels();
|
|
45
45
|
}
|
|
46
|
+
/** Settings and selection share Pi's catalog; cheapest combined token rate first. */
|
|
47
|
+
export async function supportedAgentModels(provider) {
|
|
48
|
+
return (await byokCatalog(provider))
|
|
49
|
+
.map((model) => ({
|
|
50
|
+
id: model.id,
|
|
51
|
+
name: model.name,
|
|
52
|
+
input: model.cost.input,
|
|
53
|
+
output: model.cost.output,
|
|
54
|
+
}))
|
|
55
|
+
.sort((a, b) => a.input + a.output - b.input - b.output || a.id.localeCompare(b.id));
|
|
56
|
+
}
|
|
46
57
|
/**
|
|
47
58
|
* An Agent with no saved choice runs on a model its host can reach, chosen when
|
|
48
59
|
* it runs: Workers AI where a Cloudflare account answers, then the Fungi
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/oyster",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.32",
|
|
4
4
|
"author": "Levi <levi@technomancy.dev>",
|
|
5
5
|
"description": "Self-hosted Apps for people and AI agents, with a local trial and deployment to your Cloudflare account.",
|
|
6
6
|
"homepage": "https://docs.fungi.computer/oyster",
|