@fungi.computer/oyster 0.5.0 → 0.7.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/README.md +155 -63
- package/dist/agent-archive-projection.d.ts +8 -0
- package/dist/agent-archive-projection.js +49 -0
- package/dist/agent-schedules.d.ts +50 -0
- package/dist/agent-schedules.js +17 -0
- package/dist/agents.d.ts +35 -14
- package/dist/agents.js +97 -144
- package/dist/app-builds.d.ts +7 -2
- package/dist/app-builds.js +19 -2
- package/dist/approval-capability.d.ts +1 -1
- package/dist/approval-capability.js +11 -16
- package/dist/approval-home.d.ts +2 -1
- package/dist/approval-home.js +5 -3
- package/dist/apps/catalog.js +1 -1
- package/dist/apps/gate.d.ts +4 -7
- package/dist/apps/gate.js +14 -29
- package/dist/apps/index.d.ts +1 -1
- package/dist/apps/installation.d.ts +4 -42
- package/dist/apps/installation.js +7 -75
- package/dist/apps/operations.js +0 -10
- package/dist/apps/permissions.d.ts +18 -8
- package/dist/apps/permissions.js +7 -1
- package/dist/auth.js +9 -1
- package/dist/authorization.d.ts +307 -0
- package/dist/authorization.js +542 -0
- package/dist/boot-host-script.js +1 -1
- package/dist/build/build-jobs.d.ts +2 -2
- package/dist/build/candidate-builder.d.ts +2 -0
- package/dist/build/candidate-builder.js +5 -1
- package/dist/build/candidate-cli.js +3 -0
- package/dist/build/candidate-cli.mjs +67 -22
- package/dist/build/job-log.d.ts +23 -0
- package/dist/build/job-log.js +88 -0
- package/dist/build/local-build.d.ts +2 -0
- package/dist/build/local-build.js +11 -9
- package/dist/channels/binding.d.ts +8 -1
- package/dist/channels/binding.js +12 -0
- package/dist/channels/conversations.d.ts +16 -5
- package/dist/channels/visitor-channel.d.ts +53 -0
- package/dist/channels/visitor-channel.js +124 -0
- package/dist/channels/visitor-edge.d.ts +115 -0
- package/dist/channels/visitor-edge.js +582 -0
- package/dist/channels/visitor-request.d.ts +7 -0
- package/dist/channels/visitor-request.js +17 -0
- package/dist/channels/visitor-stream-slots.d.ts +2 -0
- package/dist/channels/visitor-stream-slots.js +33 -0
- package/dist/channels/visitors.d.ts +47 -0
- package/dist/channels/visitors.js +181 -0
- package/dist/cloudflare.d.ts +11 -2
- package/dist/cloudflare.js +27 -1
- package/dist/{page/computer-target.d.ts → computer-target.d.ts} +2 -0
- package/dist/{page/computer-target.js → computer-target.js} +3 -1
- package/dist/files.js +9 -8
- package/dist/git-admission.d.ts +3 -3
- package/dist/git-admission.js +4 -6
- package/dist/git-door.d.ts +8 -7
- package/dist/git-door.js +18 -17
- package/dist/git.d.ts +1 -1
- package/dist/host.d.ts +38 -42
- package/dist/host.js +182 -239
- package/dist/installation-execution.js +10 -5
- package/dist/installation-operations.d.ts +4 -180
- package/dist/installation-operations.js +1 -5
- package/dist/installation-store-generation.d.ts +4 -1
- package/dist/installation-store-generation.js +59 -6
- package/dist/internal/delivery.js +0 -1
- package/dist/internal/host-gate.d.ts +9 -6
- package/dist/internal/host-gate.js +19 -25
- package/dist/internal/invocation-timing.d.ts +16 -0
- package/dist/internal/invocation-timing.js +23 -0
- package/dist/internal/registry-installations.js +1 -0
- package/dist/invocation.d.ts +19 -11
- package/dist/invocation.js +171 -96
- package/dist/keys.d.ts +2 -19
- package/dist/keys.js +1 -37
- package/dist/mcp.d.ts +15 -27
- package/dist/mcp.js +105 -155
- package/dist/page/agent-browser.d.ts +15 -0
- package/dist/page/agent-browser.js +162 -0
- package/dist/page/app-permissions-port.d.ts +3 -0
- package/dist/page/app-permissions-port.js +43 -0
- package/dist/page/app-permissions.d.ts +11 -0
- package/dist/page/app-permissions.js +296 -0
- package/dist/page/capabilities.js +1 -1
- package/dist/page/child-selection.d.ts +27 -0
- package/dist/page/child-selection.js +38 -0
- package/dist/page/isolated-page-theme.d.ts +2 -0
- package/dist/page/isolated-page-theme.js +11 -0
- package/dist/page/mount.d.ts +2 -13
- package/dist/page/mount.js +8 -94
- package/dist/page-script.d.ts +0 -3
- package/dist/page-script.js +3 -4
- package/dist/release.d.ts +13 -0
- package/dist/release.js +10 -0
- package/dist/request-origin.d.ts +4 -0
- package/dist/request-origin.js +10 -0
- package/dist/standalone/agent-archive-owner.d.ts +42 -0
- package/dist/standalone/agent-archive-owner.js +116 -0
- package/dist/standalone/agent-archive-schedules.d.ts +6 -0
- package/dist/standalone/agent-archive-schedules.js +76 -0
- package/dist/standalone/agent-archive.d.ts +31 -0
- package/dist/standalone/agent-archive.js +67 -0
- package/dist/standalone/agent-computers.d.ts +7 -6
- package/dist/standalone/agent-computers.js +4 -7
- package/dist/standalone/agent-mail.d.ts +2 -2
- package/dist/standalone/agents.d.ts +157 -20
- package/dist/standalone/agents.js +242 -38
- package/dist/standalone/app-builds-binding.js +1 -1
- package/dist/standalone/app-set.js +2 -54
- package/dist/standalone/app-source.d.ts +3 -4
- package/dist/standalone/app-source.js +12 -9
- package/dist/standalone/builds.d.ts +2 -14
- package/dist/standalone/builds.js +15 -13
- package/dist/standalone/computer-fleet.d.ts +4 -4
- package/dist/standalone/computer-fleet.js +20 -43
- package/dist/standalone/computer.d.ts +4 -3
- package/dist/standalone/computer.js +52 -53
- package/dist/standalone/dashboard-approval.d.ts +10 -0
- package/dist/standalone/dashboard-approval.js +66 -0
- package/dist/standalone/machine-link.d.ts +4 -221
- package/dist/standalone/machine-link.js +21 -15
- package/dist/standalone/media.d.ts +1 -0
- package/dist/standalone/media.js +20 -14
- package/dist/standalone/owner-routes.d.ts +16 -0
- package/dist/standalone/owner-routes.js +21 -0
- package/dist/standalone/permission-resources.d.ts +5 -0
- package/dist/standalone/permission-resources.js +31 -0
- package/dist/standalone/registry.d.ts +7 -0
- package/dist/standalone/registry.js +3 -0
- package/dist/standalone/tenancy.js +3 -1
- package/dist/standalone/worker-routes.d.ts +19 -0
- package/dist/standalone/worker-routes.js +9 -0
- package/dist/standalone/worker.d.ts +1 -1
- package/dist/standalone/worker.js +27 -35
- package/dist/standalone/workflow-binding.d.ts +8 -3
- package/dist/standalone/workflow-binding.js +14 -5
- package/dist/standalone/workflow-git-capture.js +2 -1
- package/dist/standalone/workflow-host.d.ts +8 -103
- package/dist/standalone/workflow-host.js +1 -1
- package/dist/standalone/workflow-node-capture.js +2 -2
- package/dist/standalone/workflow-root-authority.d.ts +1 -1
- package/dist/standalone/workflow-root-authority.js +1 -1
- package/dist/standalone/workflow-schedules.d.ts +14 -5
- package/dist/standalone/workflow-schedules.js +11 -5
- package/dist/standalone/workflow-webhooks.d.ts +4 -18
- package/dist/standalone/workflow-webhooks.js +5 -5
- package/dist/standalone/workflows.d.ts +36 -28
- package/dist/standalone/workflows.js +6 -3
- package/dist/storage-frame.d.ts +6 -6
- package/dist/testing/capabilities.d.ts +7 -6
- package/dist/testing/capabilities.js +3 -6
- package/dist/testing/installation.d.ts +0 -1
- package/dist/testing/installation.js +2 -5
- package/dist/turnstile.d.ts +27 -0
- package/dist/turnstile.js +51 -0
- package/dist/workers-git.d.ts +12 -4
- package/dist/workers-git.js +58 -36
- package/dist/workers.d.ts +9 -1
- package/dist/workers.js +59 -20
- package/dist/workflows.d.ts +2 -0
- package/dist/workflows.js +1 -0
- package/docs/api/README.md +7 -0
- package/docs/api/agent-schedules.md +175 -0
- package/docs/api/agents.md +34 -13
- package/docs/api/app-storage.md +1 -1
- package/docs/api/apps.md +323 -225
- package/docs/api/authorization.md +1300 -0
- package/docs/api/build-contract.md +2 -2
- package/docs/api/build.md +40 -37
- package/docs/api/cloudflare.md +27 -2
- package/docs/api/git.md +20 -11
- package/docs/api/host.md +80 -199
- package/docs/api/index.md +1 -1
- package/docs/api/invocation.md +15 -11
- package/docs/api/keys.md +1 -98
- package/docs/api/mcp.md +43 -40
- package/docs/api/modules.md +2 -0
- package/docs/api/page/mount.md +16 -19
- package/docs/api/workers-git.md +46 -12
- package/docs/api/workers.md +125 -235
- package/docs/site/agent-quickstart.mdx +6 -2
- package/examples/standalone/wrangler.celld.jsonc +66 -0
- package/package.json +64 -21
- package/dist/standalone/channel-session-door.d.ts +0 -4
- package/dist/standalone/channel-session-door.js +0 -42
|
@@ -10,6 +10,10 @@ Run every command exactly as written, from the directory each step names.
|
|
|
10
10
|
Compare its output with the expected output before you go on. When a step fails,
|
|
11
11
|
read the "If it fails" notes under it before trying anything else.
|
|
12
12
|
|
|
13
|
+
Not sure Oyster fits the job?
|
|
14
|
+
[Is Oyster for you?](https://docs.fungi.computer/is-oyster-for-you/) compares it
|
|
15
|
+
with Cloudflare Workers Builds before you install anything.
|
|
16
|
+
|
|
13
17
|
## Before you start
|
|
14
18
|
|
|
15
19
|
- **Cloudflare plan:** SQLite-backed Durable Objects are available on Workers
|
|
@@ -303,8 +307,8 @@ If it fails:
|
|
|
303
307
|
|
|
304
308
|
- `SESSION` is empty: the `initialize` call was refused. Check the key as in
|
|
305
309
|
step 3.
|
|
306
|
-
-
|
|
307
|
-
|
|
310
|
+
- The copied Worker already includes `POST /api/keys`. Use the owner key to
|
|
311
|
+
create a separate key for each agent; no extra Worker is needed.
|
|
308
312
|
|
|
309
313
|
## 6. Add Git
|
|
310
314
|
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Copy beside this package's worker.ts into a celld project as wrangler.jsonc.
|
|
3
|
+
// Set OYSTER_ORIGIN to the public HTTPS origin and keep the owner key out of
|
|
4
|
+
// this file (.dev.vars for dev; --secret-name / --secrets-file for a fleet).
|
|
5
|
+
"name": "oyster",
|
|
6
|
+
"main": "worker.ts",
|
|
7
|
+
"compatibility_date": "2026-09-04",
|
|
8
|
+
"compatibility_flags": ["nodejs_compat"],
|
|
9
|
+
// The React build uses console.createTask() without this production define.
|
|
10
|
+
"define": { "process.env.NODE_ENV": "\"production\"" },
|
|
11
|
+
"workflows": [
|
|
12
|
+
{
|
|
13
|
+
"binding": "GRAPH_WORKFLOWS",
|
|
14
|
+
"name": "oyster-graphs",
|
|
15
|
+
"class_name": "StandaloneGraphWorkflow",
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
"worker_loaders": [{ "binding": "LOADER" }],
|
|
19
|
+
// celld requires distinct bucket names (unlike the Cloudflare example, which
|
|
20
|
+
// uses oyster-releases for both); these are prefixes in the same fleet bucket.
|
|
21
|
+
"r2_buckets": [
|
|
22
|
+
{ "binding": "RELEASES", "bucket_name": "oyster-releases" },
|
|
23
|
+
{ "binding": "APP_ARTIFACTS", "bucket_name": "oyster-media" },
|
|
24
|
+
],
|
|
25
|
+
"vars": {
|
|
26
|
+
"OYSTER_ORIGIN": "https://oyster.example",
|
|
27
|
+
"OYSTER_COMPUTER_ID": "workspace",
|
|
28
|
+
"OYSTER_HOME_INSTALLATION": "tourtois",
|
|
29
|
+
"OYSTER_OWNER_NAME": "owner",
|
|
30
|
+
},
|
|
31
|
+
"durable_objects": {
|
|
32
|
+
"bindings": [
|
|
33
|
+
{ "name": "TENANTS", "class_name": "StandaloneTenants" },
|
|
34
|
+
{ "name": "MCP", "class_name": "OysterMcp" },
|
|
35
|
+
{ "name": "REGISTRY", "class_name": "OysterRegistry" },
|
|
36
|
+
{ "name": "WORKFLOW_RUNS", "class_name": "StandaloneWorkflowRuns" },
|
|
37
|
+
{ "name": "INSTANCES", "class_name": "StandaloneInstance" },
|
|
38
|
+
{ "name": "COMPUTER", "class_name": "ComputerDO" },
|
|
39
|
+
{ "name": "KEYS", "class_name": "OysterKeys" },
|
|
40
|
+
{ "name": "WEBHOOKS", "class_name": "OysterWebhooks" },
|
|
41
|
+
{ "name": "AGENTS", "class_name": "StandaloneAgent" },
|
|
42
|
+
{ "name": "AGENT_DIRECTORY", "class_name": "AgentDirectory" },
|
|
43
|
+
{ "name": "MACHINE_LINK", "class_name": "MachineLinkDO" },
|
|
44
|
+
{ "name": "MEDIA_OPERATION", "class_name": "MediaOperationDO" },
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
"migrations": [
|
|
48
|
+
{
|
|
49
|
+
"tag": "oyster-v1",
|
|
50
|
+
"new_sqlite_classes": [
|
|
51
|
+
"StandaloneTenants",
|
|
52
|
+
"OysterMcp",
|
|
53
|
+
"OysterRegistry",
|
|
54
|
+
"StandaloneWorkflowRuns",
|
|
55
|
+
"StandaloneInstance",
|
|
56
|
+
"ComputerDO",
|
|
57
|
+
"OysterKeys",
|
|
58
|
+
"OysterWebhooks",
|
|
59
|
+
"StandaloneAgent",
|
|
60
|
+
"AgentDirectory",
|
|
61
|
+
"MachineLinkDO",
|
|
62
|
+
"MediaOperationDO",
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/oyster",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"author": "Levi <levi@technomancy.dev>",
|
|
5
5
|
"description": "Run your own Apps on Cloudflare Workers or celld: installable App Releases, each with its own Durable Object, SQLite database and declared bindings",
|
|
6
6
|
"type": "module",
|
|
@@ -112,6 +112,26 @@
|
|
|
112
112
|
"types": "./dist/channels/binding.d.ts",
|
|
113
113
|
"import": "./dist/channels/binding.js"
|
|
114
114
|
},
|
|
115
|
+
"./channels/visitors": {
|
|
116
|
+
"types": "./dist/channels/visitors.d.ts",
|
|
117
|
+
"import": "./dist/channels/visitors.js"
|
|
118
|
+
},
|
|
119
|
+
"./channels/visitor-request": {
|
|
120
|
+
"types": "./dist/channels/visitor-request.d.ts",
|
|
121
|
+
"import": "./dist/channels/visitor-request.js"
|
|
122
|
+
},
|
|
123
|
+
"./channels/visitor-stream-slots": {
|
|
124
|
+
"types": "./dist/channels/visitor-stream-slots.d.ts",
|
|
125
|
+
"import": "./dist/channels/visitor-stream-slots.js"
|
|
126
|
+
},
|
|
127
|
+
"./channels/visitor-channel": {
|
|
128
|
+
"types": "./dist/channels/visitor-channel.d.ts",
|
|
129
|
+
"import": "./dist/channels/visitor-channel.js"
|
|
130
|
+
},
|
|
131
|
+
"./channels/visitor-edge": {
|
|
132
|
+
"types": "./dist/channels/visitor-edge.d.ts",
|
|
133
|
+
"import": "./dist/channels/visitor-edge.js"
|
|
134
|
+
},
|
|
115
135
|
"./channels/conversations": {
|
|
116
136
|
"types": "./dist/channels/conversations.d.ts",
|
|
117
137
|
"import": "./dist/channels/conversations.js"
|
|
@@ -140,6 +160,14 @@
|
|
|
140
160
|
"types": "./dist/agents.d.ts",
|
|
141
161
|
"import": "./dist/agents.js"
|
|
142
162
|
},
|
|
163
|
+
"./agent-schedules": {
|
|
164
|
+
"types": "./dist/agent-schedules.d.ts",
|
|
165
|
+
"import": "./dist/agent-schedules.js"
|
|
166
|
+
},
|
|
167
|
+
"./agent-archive": {
|
|
168
|
+
"types": "./dist/standalone/agent-archive-owner.d.ts",
|
|
169
|
+
"import": "./dist/standalone/agent-archive-owner.js"
|
|
170
|
+
},
|
|
143
171
|
"./agent-computers": {
|
|
144
172
|
"types": "./dist/agent-computers.d.ts",
|
|
145
173
|
"import": "./dist/agent-computers.js"
|
|
@@ -232,14 +260,30 @@
|
|
|
232
260
|
"types": "./dist/auth.d.ts",
|
|
233
261
|
"import": "./dist/auth.js"
|
|
234
262
|
},
|
|
263
|
+
"./turnstile": {
|
|
264
|
+
"types": "./dist/turnstile.d.ts",
|
|
265
|
+
"import": "./dist/turnstile.js"
|
|
266
|
+
},
|
|
235
267
|
"./apps": {
|
|
236
268
|
"types": "./dist/apps/index.d.ts",
|
|
237
269
|
"import": "./dist/apps/index.js"
|
|
238
270
|
},
|
|
271
|
+
"./apps/permissions-view": {
|
|
272
|
+
"types": "./dist/page/app-permissions.d.ts",
|
|
273
|
+
"import": "./dist/page/app-permissions.js"
|
|
274
|
+
},
|
|
275
|
+
"./apps/permissions-port": {
|
|
276
|
+
"types": "./dist/page/app-permissions-port.d.ts",
|
|
277
|
+
"import": "./dist/page/app-permissions-port.js"
|
|
278
|
+
},
|
|
239
279
|
"./keys": {
|
|
240
280
|
"types": "./dist/keys.d.ts",
|
|
241
281
|
"import": "./dist/keys.js"
|
|
242
282
|
},
|
|
283
|
+
"./authorization": {
|
|
284
|
+
"types": "./dist/authorization.d.ts",
|
|
285
|
+
"import": "./dist/authorization.js"
|
|
286
|
+
},
|
|
243
287
|
"./testing": {
|
|
244
288
|
"types": "./dist/testing/index.d.ts",
|
|
245
289
|
"import": "./dist/testing/index.js"
|
|
@@ -264,42 +308,41 @@
|
|
|
264
308
|
"dependencies": {
|
|
265
309
|
"@cfworker/json-schema": "4.1.1",
|
|
266
310
|
"@earendil-works/pi-ai": "1.3.0",
|
|
267
|
-
"@fungi.computer/agar": "0.
|
|
268
|
-
"@fungi.computer/bird-dog": "0.
|
|
269
|
-
"@fungi.computer/braid": "0.
|
|
270
|
-
"@fungi.computer/burrow": "0.
|
|
311
|
+
"@fungi.computer/agar": "0.6.0",
|
|
312
|
+
"@fungi.computer/bird-dog": "0.3.1",
|
|
313
|
+
"@fungi.computer/braid": "0.3.0",
|
|
314
|
+
"@fungi.computer/burrow": "0.2.0",
|
|
271
315
|
"@fungi.computer/cairn": "0.1.0",
|
|
272
316
|
"@fungi.computer/capnweb": "0.12.0",
|
|
273
|
-
"@fungi.computer/caps": "0.
|
|
317
|
+
"@fungi.computer/caps": "0.5.0",
|
|
274
318
|
"@fungi.computer/carrier": "0.2.0",
|
|
275
|
-
"@fungi.computer/computer": "0.
|
|
276
|
-
"@fungi.computer/computer-contract": "0.0.
|
|
277
|
-
"@fungi.computer/darkroom": "0.
|
|
319
|
+
"@fungi.computer/computer": "0.4.0",
|
|
320
|
+
"@fungi.computer/computer-contract": "0.0.6",
|
|
321
|
+
"@fungi.computer/darkroom": "0.4.0",
|
|
278
322
|
"@fungi.computer/ear-tag": "0.1.0",
|
|
279
|
-
"@fungi.computer/forage": "0.2.
|
|
323
|
+
"@fungi.computer/forage": "0.2.1",
|
|
280
324
|
"@fungi.computer/gills": "0.2.0",
|
|
281
|
-
"@fungi.computer/knapsack": "0.
|
|
282
|
-
"@fungi.computer/mycelium": "0.
|
|
283
|
-
"@fungi.computer/nacre": "0.
|
|
284
|
-
"@fungi.computer/puffball": "0.
|
|
325
|
+
"@fungi.computer/knapsack": "0.4.1",
|
|
326
|
+
"@fungi.computer/mycelium": "0.3.0",
|
|
327
|
+
"@fungi.computer/nacre": "0.1.1",
|
|
328
|
+
"@fungi.computer/puffball": "0.3.0",
|
|
285
329
|
"@fungi.computer/seam": "0.2.0",
|
|
286
|
-
"@fungi.computer/shiitake": "0.
|
|
287
|
-
"@fungi.computer/shiitake-extensions": "0.
|
|
330
|
+
"@fungi.computer/shiitake": "0.7.0",
|
|
331
|
+
"@fungi.computer/shiitake-extensions": "0.5.0",
|
|
288
332
|
"@fungi.computer/sigils": "0.2.0",
|
|
289
333
|
"@fungi.computer/sprite": "0.2.0",
|
|
290
|
-
"@fungi.computer/sprite-zdog": "0.
|
|
334
|
+
"@fungi.computer/sprite-zdog": "0.3.0",
|
|
291
335
|
"@fungi.computer/veil": "0.2.1",
|
|
292
336
|
"@fungi.computer/watchdog": "0.1.0",
|
|
293
|
-
"@fungi.computer/whistle": "0.
|
|
294
|
-
"@fungi.computer/workflows-wire": "0.
|
|
295
|
-
"@fungi.computer/zookeeper": "0.0.
|
|
337
|
+
"@fungi.computer/whistle": "0.3.0",
|
|
338
|
+
"@fungi.computer/workflows-wire": "0.3.0",
|
|
339
|
+
"@fungi.computer/zookeeper": "0.0.6",
|
|
296
340
|
"@modelcontextprotocol/server": "2.0.0",
|
|
297
341
|
"@pnpm/lockfile.fs": "1100.2.13",
|
|
298
342
|
"@pnpm/lockfile.pruner": "1100.0.27",
|
|
299
343
|
"effect": "4.0.2",
|
|
300
344
|
"esbuild": "0.28.2",
|
|
301
345
|
"eventsource": "5.1.1",
|
|
302
|
-
"fast-json-stable-stringify": "2.1.0",
|
|
303
346
|
"hono": "4.13.5",
|
|
304
347
|
"jose": "6.2.11",
|
|
305
348
|
"mime": "4.1.0",
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ShiitakeOwnerAgent } from "@fungi.computer/shiitake/cloudflare";
|
|
2
|
-
import type { SessionDoor } from "../channels/conversations.js";
|
|
3
|
-
/** Translate a standalone Agent's Shiitake owner into Oyster's channel Session port. */
|
|
4
|
-
export declare function channelSessionDoor(open: () => Promise<ShiitakeOwnerAgent>, deliverGrants: (sessionId: string) => void): SessionDoor;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { authorMeta } from "@fungi.computer/agar/agents";
|
|
2
|
-
import { ShiitakeError } from "@fungi.computer/shiitake";
|
|
3
|
-
/** Translate a standalone Agent's Shiitake owner into Oyster's channel Session port. */
|
|
4
|
-
export function channelSessionDoor(open, deliverGrants) {
|
|
5
|
-
return {
|
|
6
|
-
createSession: async (requestId) => (await open()).createSession(requestId),
|
|
7
|
-
deliverGrants,
|
|
8
|
-
withdraw: async (sessionId, requestId) => (await open()).session(sessionId).withdraw(requestId),
|
|
9
|
-
latestPending: async (sessionId, visitor) => (await open())
|
|
10
|
-
.withMeta(authorMeta(visitor))
|
|
11
|
-
.session(sessionId)
|
|
12
|
-
.latestPending(),
|
|
13
|
-
prompt: async (sessionId, { requestId, text, meta }) => {
|
|
14
|
-
// The conversation row exists now, so its channel admission is known;
|
|
15
|
-
// deliver Agent tools before the first run can call one.
|
|
16
|
-
deliverGrants(sessionId);
|
|
17
|
-
const agent = await open();
|
|
18
|
-
return await agent.withMeta(meta).session(sessionId).command({
|
|
19
|
-
type: "prompt",
|
|
20
|
-
requestId,
|
|
21
|
-
text,
|
|
22
|
-
delivery: "followUp",
|
|
23
|
-
});
|
|
24
|
-
},
|
|
25
|
-
line: async (sessionId, input) => {
|
|
26
|
-
const agent = await open();
|
|
27
|
-
const meta = input.author === "operator" ? authorMeta(input.identity) : input.meta;
|
|
28
|
-
await agent.withMeta(meta).session(sessionId).command({
|
|
29
|
-
type: "operator",
|
|
30
|
-
requestId: input.requestId,
|
|
31
|
-
author: input.author,
|
|
32
|
-
text: input.text,
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
errorKind: (error, requestId) => error instanceof ShiitakeError &&
|
|
36
|
-
error.boundary === "contract" &&
|
|
37
|
-
error.cause === "closed" &&
|
|
38
|
-
error.requestId === requestId
|
|
39
|
-
? "closed_request"
|
|
40
|
-
: null,
|
|
41
|
-
};
|
|
42
|
-
}
|