@fungi.computer/oyster 0.38.1 → 0.39.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/dist/channels/conversations.d.ts +7 -2
- package/dist/channels/conversations.js +10 -3
- package/dist/embed-metafiles.js +1 -1
- package/dist/embed-scripts.js +1 -1
- package/dist/standalone/agents.d.ts +19 -0
- package/dist/standalone/agents.js +97 -0
- package/dist/standalone/channel-session-door.js +6 -1
- package/package.json +12 -12
|
@@ -28,6 +28,7 @@ import { type ModelKeyRecord, type ModelKeyRefusal, type ModelKeySealInput } fro
|
|
|
28
28
|
import type { CloudflareShiitakeOptions } from "@fungi.computer/shiitake/cloudflare";
|
|
29
29
|
import { type AgentModelChoice, type AgentModelRefusal } from "./agent-model-choice.js";
|
|
30
30
|
import * as Schema from "effect/Schema";
|
|
31
|
+
import { type FingerprintSet } from "@fungi.computer/veil/redaction";
|
|
31
32
|
import { type FrameBindingProps } from "../cloudflare.js";
|
|
32
33
|
import { type AppAgentScheduleListInput, type AgentSchedulePage, type AgentScheduleTarget, type AgentScheduleControlReceipt } from "../agent-schedules.js";
|
|
33
34
|
import { type StarterLedgerRow } from "../starter-agent.js";
|
|
@@ -316,6 +317,13 @@ export declare abstract class StandaloneAgentBase<Env extends StandaloneAgentEnv
|
|
|
316
317
|
* and it must run discordReplyWork or an evicted Discord run never answers.
|
|
317
318
|
*/
|
|
318
319
|
protected shiitakeOptions(): Promise<CloudflareShiitakeOptions>;
|
|
320
|
+
private vaultRedactor;
|
|
321
|
+
/**
|
|
322
|
+
* Session redaction from this instance's stored credentials. The directory
|
|
323
|
+
* that holds them sends fingerprints only, never a value; an Agent with no
|
|
324
|
+
* directory, or a directory that cannot answer, fails closed.
|
|
325
|
+
*/
|
|
326
|
+
protected vaultRedaction(): NonNullable<CloudflareShiitakeOptions["redaction"]>;
|
|
319
327
|
/** Send an installation-admitted message through fleet Session operations. */
|
|
320
328
|
sendFromApp(installationId: string, sessionId: string, message: FleetMessage): Promise<{
|
|
321
329
|
sessionId: string;
|
|
@@ -358,6 +366,17 @@ export declare class AgentDirectory extends DurableObject<StandaloneAgentEnv> {
|
|
|
358
366
|
}>): Promise<Response | Readonly<{
|
|
359
367
|
error: ModelKeyRefusal;
|
|
360
368
|
}>>;
|
|
369
|
+
private redactionSet;
|
|
370
|
+
/**
|
|
371
|
+
* Host-only: fingerprints of every credential this directory stores (model
|
|
372
|
+
* keys, connections and Discord tokens), for Session redaction. The HMAC
|
|
373
|
+
* subkey derives from the instance credential key; no value leaves here.
|
|
374
|
+
*/
|
|
375
|
+
redactionFingerprints(): Promise<Readonly<{
|
|
376
|
+
revision: string;
|
|
377
|
+
set: FingerprintSet;
|
|
378
|
+
}>>;
|
|
379
|
+
private fingerprintSet;
|
|
361
380
|
private mcpOwner;
|
|
362
381
|
/** Loaded on the first MCP request: the SDK and OpenAPI decoders stay out of startup. */
|
|
363
382
|
private mcpConnections;
|
|
@@ -60,7 +60,16 @@ import { cloudflareAccountReady } from "./cloudflare-account.js";
|
|
|
60
60
|
import { cloudflareWorkersAIProvider } from "@earendil-works/pi-ai/providers/cloudflare-workers-ai";
|
|
61
61
|
import { getSupportedThinkingLevels } from "@earendil-works/pi-ai/models";
|
|
62
62
|
import { agentModelListSchema } from "@fungi.computer/shiitake/model-list";
|
|
63
|
+
import * as Option from "effect/Option";
|
|
64
|
+
import * as Predicate from "effect/Predicate";
|
|
63
65
|
import * as Schema from "effect/Schema";
|
|
66
|
+
import { decode as decodeBase64Url } from "effect/encoding/Base64Url";
|
|
67
|
+
import * as Result from "effect/Result";
|
|
68
|
+
// Named imports only: Veil's redaction module is already in the startup graph
|
|
69
|
+
// (its egress paths import it), and naming the two calls lets the bundler drop
|
|
70
|
+
// the maintained pattern rules this Worker never runs. A dynamic import would
|
|
71
|
+
// keep the whole module, rules included, in the evaluated idle state.
|
|
72
|
+
import { createFingerprintRedactor, createFingerprintSet, } from "@fungi.computer/veil/redaction";
|
|
64
73
|
import { z } from "zod";
|
|
65
74
|
import {} from "../cloudflare.js";
|
|
66
75
|
import { AppInstanceError } from "../index.js";
|
|
@@ -1449,6 +1458,30 @@ export class StandaloneAgentBase extends ShiitakeDO {
|
|
|
1449
1458
|
this.archiveControl().work,
|
|
1450
1459
|
this.discordReplyWork(),
|
|
1451
1460
|
],
|
|
1461
|
+
redaction: this.vaultRedaction(),
|
|
1462
|
+
};
|
|
1463
|
+
}
|
|
1464
|
+
vaultRedactor;
|
|
1465
|
+
/**
|
|
1466
|
+
* Session redaction from this instance's stored credentials. The directory
|
|
1467
|
+
* that holds them sends fingerprints only, never a value; an Agent with no
|
|
1468
|
+
* directory, or a directory that cannot answer, fails closed.
|
|
1469
|
+
*/
|
|
1470
|
+
vaultRedaction() {
|
|
1471
|
+
return {
|
|
1472
|
+
load: async () => {
|
|
1473
|
+
const pin = await this.policyDirectory();
|
|
1474
|
+
if (pin === null)
|
|
1475
|
+
throw new Error("Agent directory is unavailable");
|
|
1476
|
+
const answer = await this.env.AGENT_DIRECTORY.getByName(pin.directoryName).redactionFingerprints();
|
|
1477
|
+
if (this.vaultRedactor?.revision !== answer.revision) {
|
|
1478
|
+
this.vaultRedactor = {
|
|
1479
|
+
revision: answer.revision,
|
|
1480
|
+
redactor: createFingerprintRedactor(answer.set),
|
|
1481
|
+
};
|
|
1482
|
+
}
|
|
1483
|
+
return this.vaultRedactor.redactor;
|
|
1484
|
+
},
|
|
1452
1485
|
};
|
|
1453
1486
|
}
|
|
1454
1487
|
/** Send an installation-admitted message through fleet Session operations. */
|
|
@@ -1589,6 +1622,44 @@ export class AgentDirectory extends DurableObject {
|
|
|
1589
1622
|
throw error;
|
|
1590
1623
|
}
|
|
1591
1624
|
}
|
|
1625
|
+
redactionSet;
|
|
1626
|
+
/**
|
|
1627
|
+
* Host-only: fingerprints of every credential this directory stores (model
|
|
1628
|
+
* keys, connections and Discord tokens), for Session redaction. The HMAC
|
|
1629
|
+
* subkey derives from the instance credential key; no value leaves here.
|
|
1630
|
+
*/
|
|
1631
|
+
async redactionFingerprints() {
|
|
1632
|
+
const storage = credentialStorage(this.ctx.storage);
|
|
1633
|
+
const rows = [...(await storage.list("credential:")).values()];
|
|
1634
|
+
// Each seal draws a fresh IV, so any stored change is a new revision.
|
|
1635
|
+
const revision = rows
|
|
1636
|
+
.map((row) => `${row.credentialId}:${row.sealed}`)
|
|
1637
|
+
.sort()
|
|
1638
|
+
.join("\n");
|
|
1639
|
+
const cached = this.redactionSet;
|
|
1640
|
+
if (cached?.revision === revision)
|
|
1641
|
+
return cached;
|
|
1642
|
+
// A set that fails to build is never cached: the next read retries.
|
|
1643
|
+
const fresh = { revision, set: await this.fingerprintSet(rows) };
|
|
1644
|
+
this.redactionSet = fresh;
|
|
1645
|
+
return fresh;
|
|
1646
|
+
}
|
|
1647
|
+
async fingerprintSet(rows) {
|
|
1648
|
+
const store = createInstanceCredentialStore(this.credentialOptions());
|
|
1649
|
+
const values = new Set();
|
|
1650
|
+
for (const row of rows)
|
|
1651
|
+
await store.withSecret(row.credentialId, (secret) => {
|
|
1652
|
+
for (const value of secretStrings(secret))
|
|
1653
|
+
values.add(value);
|
|
1654
|
+
});
|
|
1655
|
+
// With no stored values there is nothing to find; any key will do. A
|
|
1656
|
+
// malformed key refuses in createFingerprintSet, so redaction fails closed.
|
|
1657
|
+
const key = this.env.OYSTER_CREDENTIAL_KEY;
|
|
1658
|
+
const ownerKey = key === undefined
|
|
1659
|
+
? crypto.getRandomValues(new Uint8Array(32))
|
|
1660
|
+
: Result.getOrElse(decodeBase64Url(key), () => new Uint8Array(0));
|
|
1661
|
+
return createFingerprintSet(ownerKey, [...values]);
|
|
1662
|
+
}
|
|
1592
1663
|
mcpOwner;
|
|
1593
1664
|
/** Loaded on the first MCP request: the SDK and OpenAPI decoders stay out of startup. */
|
|
1594
1665
|
async mcpConnections() {
|
|
@@ -2470,6 +2541,32 @@ export class AgentDirectory extends DurableObject {
|
|
|
2470
2541
|
}
|
|
2471
2542
|
/** Where an authorization server returns the owner after a sign-in. */
|
|
2472
2543
|
const mcpCallbackUrl = (origin) => new URL("/api/connections/callback", origin).href;
|
|
2544
|
+
const decodeJsonSecret = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Json));
|
|
2545
|
+
/** Every string leaf of one parsed JSON value. */
|
|
2546
|
+
function jsonStrings(value, into) {
|
|
2547
|
+
if (value === null || Predicate.isNumber(value) || Predicate.isBoolean(value))
|
|
2548
|
+
return;
|
|
2549
|
+
if (Predicate.isString(value)) {
|
|
2550
|
+
into.push(value);
|
|
2551
|
+
return;
|
|
2552
|
+
}
|
|
2553
|
+
// An array's values are its items; an object's are its fields.
|
|
2554
|
+
for (const item of Object.values(value))
|
|
2555
|
+
jsonStrings(item, into);
|
|
2556
|
+
}
|
|
2557
|
+
/**
|
|
2558
|
+
* The strings one sealed secret can print: the secret itself and, for a JSON
|
|
2559
|
+
* bundle (an OAuth token set, a Cloudflare key), each string inside it. Over-
|
|
2560
|
+
* matching a non-secret field only masks it. Vault never stores a value
|
|
2561
|
+
* under eight code units, so shorter strings are not values to find.
|
|
2562
|
+
*/
|
|
2563
|
+
function secretStrings(secret) {
|
|
2564
|
+
const strings = [secret];
|
|
2565
|
+
const parsed = decodeJsonSecret(secret);
|
|
2566
|
+
if (Option.isSome(parsed))
|
|
2567
|
+
jsonStrings(parsed.value, strings);
|
|
2568
|
+
return strings.filter((value) => value.length >= 8);
|
|
2569
|
+
}
|
|
2473
2570
|
/** The directory's Durable Object storage as the credential store's key-value port. */
|
|
2474
2571
|
const credentialStorage = (storage) => ({
|
|
2475
2572
|
get: (key) => storage.get(key),
|
|
@@ -67,6 +67,11 @@ export function channelSessionDoor(open, deliverGrants, conversations) {
|
|
|
67
67
|
error.cause === "closed" &&
|
|
68
68
|
error.requestId === requestId
|
|
69
69
|
? "closed_request"
|
|
70
|
-
:
|
|
70
|
+
: error instanceof ShiitakeError &&
|
|
71
|
+
error.boundary === "contract" &&
|
|
72
|
+
(error.cause === "secret_in_prompt" ||
|
|
73
|
+
error.cause === "unavailable")
|
|
74
|
+
? "intake_refused"
|
|
75
|
+
: null,
|
|
71
76
|
};
|
|
72
77
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/oyster",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
4
|
"author": "Levi <levi@technomancy.dev>",
|
|
5
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",
|
|
@@ -360,35 +360,35 @@
|
|
|
360
360
|
"@earendil-works/pi-ai": "1.5.2",
|
|
361
361
|
"@fungi.computer/agar": "0.22.1",
|
|
362
362
|
"@fungi.computer/bird-dog": "0.3.7",
|
|
363
|
-
"@fungi.computer/braid": "0.5.
|
|
363
|
+
"@fungi.computer/braid": "0.5.4",
|
|
364
364
|
"@fungi.computer/burrow": "0.2.1",
|
|
365
365
|
"@fungi.computer/cairn": "0.1.0",
|
|
366
366
|
"@fungi.computer/capnweb": "0.12.0-fungi.0",
|
|
367
367
|
"@fungi.computer/caps": "0.12.1",
|
|
368
368
|
"@fungi.computer/carrier": "0.2.5",
|
|
369
|
-
"@fungi.computer/computer": "0.14.
|
|
370
|
-
"@fungi.computer/computer-contract": "0.5.
|
|
369
|
+
"@fungi.computer/computer": "0.14.7",
|
|
370
|
+
"@fungi.computer/computer-contract": "0.5.7",
|
|
371
371
|
"@fungi.computer/darkroom": "0.11.7",
|
|
372
372
|
"@fungi.computer/ear-tag": "0.1.0",
|
|
373
373
|
"@fungi.computer/forage": "0.3.13",
|
|
374
374
|
"@fungi.computer/gills": "0.4.0",
|
|
375
|
-
"@fungi.computer/knapsack": "0.4.
|
|
375
|
+
"@fungi.computer/knapsack": "0.4.20",
|
|
376
376
|
"@fungi.computer/lantern": "0.4.2",
|
|
377
|
-
"@fungi.computer/mycelium": "0.4.
|
|
377
|
+
"@fungi.computer/mycelium": "0.4.7",
|
|
378
378
|
"@fungi.computer/nacre": "0.8.2",
|
|
379
|
-
"@fungi.computer/parakeet": "0.
|
|
379
|
+
"@fungi.computer/parakeet": "0.14.0",
|
|
380
380
|
"@fungi.computer/puffball": "0.12.0",
|
|
381
381
|
"@fungi.computer/seam": "0.2.6",
|
|
382
|
-
"@fungi.computer/shiitake": "0.
|
|
383
|
-
"@fungi.computer/shiitake-extensions": "0.11.
|
|
382
|
+
"@fungi.computer/shiitake": "0.21.0",
|
|
383
|
+
"@fungi.computer/shiitake-extensions": "0.11.10",
|
|
384
384
|
"@fungi.computer/sigils": "0.3.2",
|
|
385
385
|
"@fungi.computer/sprite": "0.2.2",
|
|
386
386
|
"@fungi.computer/sprite-zdog": "0.3.2",
|
|
387
|
-
"@fungi.computer/veil": "0.8.
|
|
387
|
+
"@fungi.computer/veil": "0.8.1",
|
|
388
388
|
"@fungi.computer/watchdog": "0.1.4",
|
|
389
389
|
"@fungi.computer/whistle": "0.3.0",
|
|
390
|
-
"@fungi.computer/workflows-wire": "0.5.
|
|
391
|
-
"@fungi.computer/zookeeper": "0.0.
|
|
390
|
+
"@fungi.computer/workflows-wire": "0.5.4",
|
|
391
|
+
"@fungi.computer/zookeeper": "0.0.42",
|
|
392
392
|
"@modelcontextprotocol/server": "2.0.0",
|
|
393
393
|
"@msgpack/msgpack": "3.1.3",
|
|
394
394
|
"@napi-rs/keyring": "2.1.2",
|