@fungi.computer/oyster 0.37.2 → 0.38.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.
Files changed (88) hide show
  1. package/README.md +5 -4
  2. package/dist/agents.js +9 -2
  3. package/dist/app-builds.d.ts +1 -1
  4. package/dist/app-region.d.ts +94 -0
  5. package/dist/app-region.js +316 -0
  6. package/dist/authorization.d.ts +58 -9
  7. package/dist/authorization.js +56 -11
  8. package/dist/backend-request.d.ts +4 -0
  9. package/dist/backend-request.js +3 -10
  10. package/dist/boot-host-script.js +1 -1
  11. package/dist/build/candidate-builder.d.ts +1 -1
  12. package/dist/build/candidate-cli.mjs +284 -17
  13. package/dist/build/effect.d.ts +3 -3
  14. package/dist/build/submission-contract.d.ts +1 -1
  15. package/dist/build/workspace-build.d.ts +2 -2
  16. package/dist/channels/discord-replies.d.ts +8 -1
  17. package/dist/channels/discord-replies.js +80 -29
  18. package/dist/cloudflare.d.ts +1 -0
  19. package/dist/cloudflare.js +12 -2
  20. package/dist/credential-migration-001.d.ts +14 -0
  21. package/dist/credential-migration-001.js +13 -0
  22. package/dist/credential-migration-002.d.ts +38 -0
  23. package/dist/credential-migration-002.js +74 -0
  24. package/dist/embed-metafiles.js +2 -2
  25. package/dist/embed-scripts.js +1 -1
  26. package/dist/host.d.ts +2 -0
  27. package/dist/host.js +23 -13
  28. package/dist/index.d.ts +15 -1
  29. package/dist/index.js +19 -0
  30. package/dist/invocation.d.ts +165 -0
  31. package/dist/invocation.js +67 -0
  32. package/dist/keys.d.ts +4 -3
  33. package/dist/keys.js +5 -4
  34. package/dist/mcp-owner.d.ts +4 -3
  35. package/dist/mcp-owner.js +3 -2
  36. package/dist/page/mount.js +5 -1
  37. package/dist/page/region.d.ts +6 -0
  38. package/dist/page/region.js +12 -0
  39. package/dist/page-config.d.ts +2 -0
  40. package/dist/page-config.js +2 -0
  41. package/dist/page-script.js +2 -2
  42. package/dist/source/seed-receipt.d.ts +1 -1
  43. package/dist/source/template-seed.d.ts +1 -1
  44. package/dist/standalone/agent-connections.d.ts +49 -1
  45. package/dist/standalone/agent-connections.js +101 -12
  46. package/dist/standalone/agent-self.js +2 -1
  47. package/dist/standalone/agents.d.ts +7 -3
  48. package/dist/standalone/agents.js +42 -19
  49. package/dist/standalone/computer-fleet.d.ts +12 -6
  50. package/dist/standalone/computer-fleet.js +70 -29
  51. package/dist/standalone/computer.js +39 -14
  52. package/dist/standalone/instance.d.ts +3 -1
  53. package/dist/standalone/instance.js +8 -0
  54. package/dist/standalone/model-key-vault.d.ts +33 -4
  55. package/dist/standalone/model-key-vault.js +74 -17
  56. package/dist/standalone/preview.js +11 -10
  57. package/dist/standalone/try-cli.d.ts +12 -2
  58. package/dist/standalone/try-cli.js +170 -32
  59. package/dist/standalone/try-worker.d.ts +2 -0
  60. package/dist/standalone/try-worker.js +15 -0
  61. package/dist/standalone/worker.js +3 -3
  62. package/dist/standalone/workflow-host.d.ts +1 -1
  63. package/dist/standalone/workflows.d.ts +3 -3
  64. package/dist/standalone/workflows.js +7 -0
  65. package/dist/testing/capabilities.d.ts +2 -0
  66. package/dist/testing/capabilities.js +2 -0
  67. package/dist/webhook-custody.d.ts +14 -3
  68. package/dist/webhook-custody.js +165 -43
  69. package/dist/webhooks.d.ts +1 -1
  70. package/dist/webhooks.js +15 -3
  71. package/dist/workers-git.d.ts +24 -8
  72. package/dist/workers-git.js +105 -15
  73. package/dist/workers.d.ts +16 -0
  74. package/dist/workers.js +95 -5
  75. package/docs/api/apps.md +31 -31
  76. package/docs/api/authorization.md +119 -17
  77. package/docs/api/build-contract.md +8 -8
  78. package/docs/api/build.md +163 -174
  79. package/docs/api/cloudflare.md +171 -0
  80. package/docs/api/host.md +1 -0
  81. package/docs/api/index.md +23 -0
  82. package/docs/api/invocation.md +623 -23
  83. package/docs/api/keys.md +6 -6
  84. package/docs/api/pack.md +3 -3
  85. package/docs/api/page/mount.md +22 -20
  86. package/docs/api/workers-git.md +273 -157
  87. package/docs/api/workers.md +257 -175
  88. package/package.json +19 -18
@@ -10,6 +10,99 @@
10
10
 
11
11
  ## Type Aliases
12
12
 
13
+ ### AppRegionSocket
14
+
15
+ ```ts
16
+ type AppRegionSocket = Pick<
17
+ WebSocket,
18
+ | "send"
19
+ | "close"
20
+ | "serializeAttachment"
21
+ | "deserializeAttachment"
22
+ | "readyState"
23
+ >;
24
+ ```
25
+
26
+ The socket operations a Region supervisor uses; App code never sees one.
27
+
28
+ ---
29
+
30
+ ### AppRegionNative
31
+
32
+ ```ts
33
+ type AppRegionNative<Socket, Client> = Readonly<{
34
+ pair: {
35
+ client: Client;
36
+ server: Socket;
37
+ };
38
+ accept: void;
39
+ sockets: readonly Socket[];
40
+ readWake: number | null;
41
+ writeWake: void;
42
+ scheduleWake: Promise<void>;
43
+ upgraded: Response;
44
+ now: number;
45
+ }>;
46
+ ```
47
+
48
+ The native Durable Object surface a Region supervisor uses: hibernating
49
+ WebSockets and the Instance's one shared alarm. App code never sees it.
50
+
51
+ #### Type Parameters
52
+
53
+ | Type Parameter | Default type |
54
+ | -------------------------------------------------------- | ------------ |
55
+ | `Socket` _extends_ [`AppRegionSocket`](#appregionsocket) | `WebSocket` |
56
+ | `Client` | `WebSocket` |
57
+
58
+ ---
59
+
60
+ ### AppRegionDeliver
61
+
62
+ ```ts
63
+ type AppRegionDeliver = (event) => Promise<AppRegionReply>;
64
+ ```
65
+
66
+ Run one bounded event in the App, under the Instance's current authority.
67
+
68
+ #### Parameters
69
+
70
+ | Parameter | Type |
71
+ | --------- | ---------------- |
72
+ | `event` | `AppRegionEvent` |
73
+
74
+ #### Returns
75
+
76
+ `Promise`\<`AppRegionReply`\>
77
+
78
+ ---
79
+
80
+ ### AppRegion
81
+
82
+ ```ts
83
+ type AppRegion = ReturnType<typeof createAppRegion>;
84
+ ```
85
+
86
+ One Instance's Region supervisor.
87
+
88
+ ---
89
+
90
+ ### AppRegionDurableState
91
+
92
+ ```ts
93
+ type AppRegionDurableState = Pick<
94
+ DurableObjectState,
95
+ "acceptWebSocket" | "getWebSockets" | "getTags"
96
+ > &
97
+ Readonly<{
98
+ storage: Pick<DurableObjectStorage, "sql">;
99
+ }>;
100
+ ```
101
+
102
+ The Durable Object surface a Region needs: hibernating sockets and SQLite.
103
+
104
+ ---
105
+
13
106
  ### FrameBindingProps
14
107
 
15
108
  ```ts
@@ -280,6 +373,84 @@ The shared RPC boundary decoder for host-minted invocation binding props.
280
373
 
281
374
  ## Functions
282
375
 
376
+ ### createAppRegion()
377
+
378
+ ```ts
379
+ function createAppRegion<Socket, Client>(native, deliver): object;
380
+ ```
381
+
382
+ Supervisor-owned Region lifecycle: native sockets and alarms stay here; the App
383
+ receives only bounded Region events and answers with a bounded reply.
384
+
385
+ #### Type Parameters
386
+
387
+ | Type Parameter |
388
+ | -------------------------------------------------------- |
389
+ | `Socket` _extends_ [`AppRegionSocket`](#appregionsocket) |
390
+ | `Client` |
391
+
392
+ #### Parameters
393
+
394
+ | Parameter | Type |
395
+ | --------- | ----------------------------------------------------------- |
396
+ | `native` | [`AppRegionNative`](#appregionnative)\<`Socket`, `Client`\> |
397
+ | `deliver` | [`AppRegionDeliver`](#appregiondeliver) |
398
+
399
+ #### Returns
400
+
401
+ | Name | Type | Description |
402
+ | ----------- | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
403
+ | `connect()` | (`caller`, `deliverConnect?`) => `Promise`\<`Response`\> | Accept an already-admitted connection; the caller comes from the host. Its connect runs in the admitting frame, later events in fresh ones. |
404
+ | `message()` | (`socket`, `data`) => `Promise`\<`void`\> | Deliver one bounded text frame from an attested socket. |
405
+ | `close()` | ( `socket`, `code`, `reason` ) => `Promise`\<`void`\> | The browser closed: send the server's half of the close, then tell the App if the socket was attested. |
406
+ | `alarm()` | () => `Promise`\<`void`\> | Deliver the App's wake when due; the shared alarm may fire for others. |
407
+ | `fence()` | (`reason`) => `void` | Disable or removal: close every socket and drop the App's wake; data stays. |
408
+
409
+ ---
410
+
411
+ ### durableAppRegionNative()
412
+
413
+ ```ts
414
+ function durableAppRegionNative(ctx, scheduleWake): AppRegionNative;
415
+ ```
416
+
417
+ Native hibernating sockets and a persisted wake in the supervisor's own SQLite.
418
+ The supervisor's shared alarm is lowered through `scheduleWake`.
419
+
420
+ #### Parameters
421
+
422
+ | Parameter | Type |
423
+ | -------------- | ------------------------------------------------- |
424
+ | `ctx` | [`AppRegionDurableState`](#appregiondurablestate) |
425
+ | `scheduleWake` | (`at`) => `Promise`\<`void`\> |
426
+
427
+ #### Returns
428
+
429
+ [`AppRegionNative`](#appregionnative)
430
+
431
+ ---
432
+
433
+ ### isAppRegionSocket()
434
+
435
+ ```ts
436
+ function isAppRegionSocket(ctx, socket): boolean;
437
+ ```
438
+
439
+ Whether a hibernated socket a Durable Object woke for is a Region socket.
440
+
441
+ #### Parameters
442
+
443
+ | Parameter | Type |
444
+ | --------- | ------------------------------------------- |
445
+ | `ctx` | `Pick`\<`DurableObjectState`, `"getTags"`\> |
446
+ | `socket` | `WebSocket` |
447
+
448
+ #### Returns
449
+
450
+ `boolean`
451
+
452
+ ---
453
+
283
454
  ### checkBackendConstruction()
284
455
 
285
456
  ```ts
package/docs/api/host.md CHANGED
@@ -295,6 +295,7 @@ type InstanceHandle = Readonly<{
295
295
  syncRefused: (facts, refusal) => Promise<void>;
296
296
  authorizeGitPush: (facts, question) => Promise<GitPushVerdict>;
297
297
  fetch: (facts, request) => Promise<Response>;
298
+ regionConnect: (facts, request) => Promise<Response>;
298
299
  gill: (facts, api, source, input) => Promise<InstanceResult<GillReply>>;
299
300
  call: (facts, api, name, input) => Promise<InstanceResult<AppMethodReply>>;
300
301
  }>;
package/docs/api/index.md CHANGED
@@ -249,6 +249,27 @@ Host storage, verified artifact resolution, and frame-bound execution ports.
249
249
 
250
250
  ---
251
251
 
252
+ ### AppRegionHostEvent
253
+
254
+ ```ts
255
+ type AppRegionHostEvent =
256
+ | Readonly<{
257
+ kind: "connect";
258
+ connection: string;
259
+ }>
260
+ | Exclude<
261
+ AppRegionEvent,
262
+ {
263
+ kind: "connect";
264
+ }
265
+ >;
266
+ ```
267
+
268
+ A Region event as a supervisor hands it to the runtime; a connect carries no
269
+ caller of its own.
270
+
271
+ ---
272
+
252
273
  ### AppBackendConnection
253
274
 
254
275
  ```ts
@@ -256,6 +277,7 @@ type AppBackendConnection = Readonly<{
256
277
  authorizeGitPush?: (question) => Effect.Effect<GitPushVerdict, Error>;
257
278
  onGitPush?: (fact) => Effect.Effect<void, Error>;
258
279
  syncRefused?: (refusal) => Effect.Effect<void, Error>;
280
+ region?: (event) => Effect.Effect<AppRegionReply, Error>;
259
281
  fetch: (request) => Effect.Effect<Response, Error>;
260
282
  call: (name, input) => Effect.Effect<AppMethodReply, Error>;
261
283
  gill: (cargo) => Effect.Effect<Schema.Json, Error>;
@@ -278,6 +300,7 @@ type AppInstance<Host> = Readonly<{
278
300
  authorizeGitPush: (frame, question) => Effect.Effect<GitPushVerdict, Error>;
279
301
  onGitPush: (frame, fact) => Effect.Effect<void, Error>;
280
302
  syncRefused: (frame, refusal) => Effect.Effect<void, Error>;
303
+ region: (frame, event) => Effect.Effect<AppRegionReply, Error>;
281
304
  inspect: () => Effect.Effect<Instance | null, Error>;
282
305
  }>;
283
306
  ```