@fungi.computer/oyster 0.47.1 → 0.47.3
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.d.ts +3 -1
- package/dist/agents.js +3 -1
- package/dist/host.d.ts +6 -4
- package/dist/host.js +26 -5
- package/dist/page/storage-events.d.ts +41 -0
- package/dist/page/storage-events.js +102 -0
- package/dist/page/storage-notice.d.ts +3 -0
- package/dist/page/storage-notice.js +28 -0
- package/dist/page/storage.js +53 -9
- package/dist/page-script.js +1 -1
- package/dist/standalone/agents.d.ts +1 -0
- package/dist/standalone/agents.js +13 -5
- package/dist/starter-agent.d.ts +94 -6
- package/dist/starter-agent.js +229 -41
- package/dist/storage-watch-stream.d.ts +13 -0
- package/dist/storage-watch-stream.js +19 -0
- package/dist/storage-watch-wire.d.ts +29 -0
- package/dist/storage-watch-wire.js +24 -0
- package/dist/workers.d.ts +3 -2
- package/dist/workers.js +10 -17
- package/docs/api/agents.md +5 -1
- package/docs/api/host.md +2 -3
- package/docs/api/workers.md +26 -32
- package/package.json +1 -1
package/dist/workers.js
CHANGED
|
@@ -18,6 +18,7 @@ import { installationWorkerEntrypoint } from "./installation-execution.js";
|
|
|
18
18
|
export { installationWorkerEntrypoint };
|
|
19
19
|
import { approvedBindingGrants, scopedBindings } from "./apps/gate.js";
|
|
20
20
|
import { appMethodReplySchema } from "@fungi.computer/agar/backend";
|
|
21
|
+
import { storageWatchStream } from "./storage-watch-stream.js";
|
|
21
22
|
import { nativeGitFrameMethods, nativeGitMethodNameSchema, } from "@fungi.computer/agar/git-rpc";
|
|
22
23
|
import { backgroundOriginKey, actorLane, mayDefer, } from "@fungi.computer/puffball/background-replay";
|
|
23
24
|
import { emptyAppDeclaration, appBackendBindingKinds, } from "@fungi.computer/puffball/app";
|
|
@@ -33,7 +34,6 @@ import { fileCapabilities } from "./files.js";
|
|
|
33
34
|
import { DurableObject } from "cloudflare:workers";
|
|
34
35
|
import * as Effect from "effect/Effect";
|
|
35
36
|
import * as Schema from "effect/Schema";
|
|
36
|
-
import * as Stream from "effect/Stream";
|
|
37
37
|
import { parseReleaseId, parseSha256Digest, } from "@fungi.computer/puffball";
|
|
38
38
|
import { releaseSchema } from "@fungi.computer/puffball/effect";
|
|
39
39
|
import { AppInstanceError, } from "./index.js";
|
|
@@ -275,21 +275,14 @@ export class OysterRegistry extends DurableObject {
|
|
|
275
275
|
return Promise.resolve({ kind: "rejected", code: "invalid" });
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
|
-
/**
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
return
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
.pipe(Stream.map((event) => new TextEncoder().encode(event === null
|
|
287
|
-
? "event: ready\ndata: {}\n\n"
|
|
288
|
-
: `event: changed\ndata: ${JSON.stringify(event)}\n\n`)))), {
|
|
289
|
-
headers: {
|
|
290
|
-
"Content-Type": "text/event-stream",
|
|
291
|
-
"Cache-Control": "no-store",
|
|
292
|
-
},
|
|
278
|
+
/** Watch many storage keys as one stream, each under fresh owner admission. */
|
|
279
|
+
storageWatch(ownerId, watches) {
|
|
280
|
+
return storageWatchStream(watches, async ([installationId, key]) => {
|
|
281
|
+
const view = this.storageView(installationId, () => Promise.resolve(ownerId));
|
|
282
|
+
const admitted = await this.storageResult(view.read(key));
|
|
283
|
+
return admitted.kind === "rejected"
|
|
284
|
+
? admitted
|
|
285
|
+
: { kind: "accepted", value: view.events(key) };
|
|
293
286
|
});
|
|
294
287
|
}
|
|
295
288
|
storageResult(program) {
|
|
@@ -1424,8 +1417,8 @@ export function oysterWorkerHost(env, auth, options = {}) {
|
|
|
1424
1417
|
write: (input) => registry().storageWrite(installationId, ownerId, input),
|
|
1425
1418
|
reset: (input) => registry().storageReset(installationId, ownerId, input),
|
|
1426
1419
|
claim: (input) => registry().storageClaim(installationId, ownerId, input),
|
|
1427
|
-
events: (key) => registry().storageEvents(installationId, ownerId, key),
|
|
1428
1420
|
}),
|
|
1421
|
+
watchStorage: (ownerId, watches) => registry().storageWatch(ownerId, watches),
|
|
1429
1422
|
},
|
|
1430
1423
|
guestLimits: guestLimits(options.guestLimits),
|
|
1431
1424
|
artifacts,
|
package/docs/api/agents.md
CHANGED
|
@@ -685,6 +685,8 @@ What one Vault command answers: a listing, an id, a version, usage or a refusal.
|
|
|
685
685
|
```ts
|
|
686
686
|
type StarterOutcome =
|
|
687
687
|
| "created"
|
|
688
|
+
| "seeding"
|
|
689
|
+
| "starting"
|
|
688
690
|
| "already-offered"
|
|
689
691
|
| "team-not-empty"
|
|
690
692
|
| "unfunded"
|
|
@@ -692,7 +694,9 @@ type StarterOutcome =
|
|
|
692
694
|
| "failed";
|
|
693
695
|
```
|
|
694
696
|
|
|
695
|
-
How one offer of the starter Agent settled
|
|
697
|
+
How one offer of the starter Agent settled. `created` and `seeding` both mean
|
|
698
|
+
the Agent exists; `seeding` means its Home seed is still running; `starting`
|
|
699
|
+
means its create is still running.
|
|
696
700
|
|
|
697
701
|
## Variables
|
|
698
702
|
|
package/docs/api/host.md
CHANGED
|
@@ -528,9 +528,8 @@ type OysterHost = Readonly<{
|
|
|
528
528
|
}>;
|
|
529
529
|
installing?: readonly InstallingApp[];
|
|
530
530
|
}>>;
|
|
531
|
-
storage: Pick<AppStorageWire, "read" | "write" | "reset" | "claim"
|
|
532
|
-
|
|
533
|
-
}>;
|
|
531
|
+
storage: Pick<AppStorageWire, "read" | "write" | "reset" | "claim">;
|
|
532
|
+
watchStorage: Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
|
|
534
533
|
}>;
|
|
535
534
|
homeInstallationId?: string;
|
|
536
535
|
pageScript?: string;
|