@fungi.computer/oyster 0.0.0-stage → 0.0.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 (242) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1082 -2
  3. package/dist/agents.d.ts +114 -0
  4. package/dist/agents.js +322 -0
  5. package/dist/app-builds.d.ts +151 -0
  6. package/dist/app-builds.js +355 -0
  7. package/dist/app-sandbox.d.ts +2 -0
  8. package/dist/app-sandbox.js +2 -0
  9. package/dist/app-sources.d.ts +46 -0
  10. package/dist/app-sources.js +335 -0
  11. package/dist/app-storage.d.ts +141 -0
  12. package/dist/app-storage.js +281 -0
  13. package/dist/apps/gate.d.ts +105 -0
  14. package/dist/apps/gate.js +273 -0
  15. package/dist/apps/index.d.ts +5 -0
  16. package/dist/apps/index.js +5 -0
  17. package/dist/apps/installation.d.ts +248 -0
  18. package/dist/apps/installation.js +307 -0
  19. package/dist/apps/operations.d.ts +8 -0
  20. package/dist/apps/operations.js +98 -0
  21. package/dist/apps/tools.d.ts +33 -0
  22. package/dist/apps/tools.js +17 -0
  23. package/dist/auth.d.ts +11 -0
  24. package/dist/auth.js +93 -0
  25. package/dist/backend-request.d.ts +3 -0
  26. package/dist/backend-request.js +53 -0
  27. package/dist/build/build-jobs.d.ts +128 -0
  28. package/dist/build/build-jobs.js +197 -0
  29. package/dist/build/build-step.d.ts +26 -0
  30. package/dist/build/build-step.js +20 -0
  31. package/dist/build/bundled-html.d.ts +7 -0
  32. package/dist/build/bundled-html.js +64 -0
  33. package/dist/build/definition-emission.d.ts +34 -0
  34. package/dist/build/definition-emission.js +201 -0
  35. package/dist/build/effect.d.ts +231 -0
  36. package/dist/build/effect.js +396 -0
  37. package/dist/build/git-environment.d.ts +6 -0
  38. package/dist/build/git-environment.js +48 -0
  39. package/dist/build/html-recipe.d.ts +20 -0
  40. package/dist/build/html-recipe.js +51 -0
  41. package/dist/build/local-build.d.ts +57 -0
  42. package/dist/build/local-build.js +1078 -0
  43. package/dist/build/r2-artifact-writer.d.ts +31 -0
  44. package/dist/build/r2-artifact-writer.js +179 -0
  45. package/dist/build/snapshot-package-store.d.ts +2 -0
  46. package/dist/build/snapshot-package-store.js +21 -0
  47. package/dist/build/snapshot-program-scripts.d.ts +6 -0
  48. package/dist/build/snapshot-program-scripts.js +2 -0
  49. package/dist/build/submission-contract.d.ts +384 -0
  50. package/dist/build/submission-contract.js +70 -0
  51. package/dist/build/workspace-build.d.ts +50 -0
  52. package/dist/build/workspace-build.js +156 -0
  53. package/dist/build-contract.d.ts +4 -0
  54. package/dist/build-contract.js +4 -0
  55. package/dist/build-jobs.d.ts +2 -0
  56. package/dist/build-jobs.js +2 -0
  57. package/dist/build.d.ts +11 -0
  58. package/dist/build.js +13 -0
  59. package/dist/capability-descriptor.d.ts +46 -0
  60. package/dist/capability-descriptor.js +51 -0
  61. package/dist/catalog-frame.d.ts +39 -0
  62. package/dist/catalog-frame.js +72 -0
  63. package/dist/cause-class.d.ts +19 -0
  64. package/dist/cause-class.js +54 -0
  65. package/dist/cloudflare.d.ts +123 -0
  66. package/dist/cloudflare.js +391 -0
  67. package/dist/computer-terminal.d.ts +38 -0
  68. package/dist/computer-terminal.js +410 -0
  69. package/dist/computer.d.ts +60 -0
  70. package/dist/computer.js +33 -0
  71. package/dist/event-recipients.d.ts +57 -0
  72. package/dist/event-recipients.js +144 -0
  73. package/dist/facet-invocation.d.ts +4 -0
  74. package/dist/facet-invocation.js +45 -0
  75. package/dist/files.d.ts +42 -0
  76. package/dist/files.js +123 -0
  77. package/dist/frame-binding-wire-script.d.ts +2 -0
  78. package/dist/frame-binding-wire-script.js +1 -0
  79. package/dist/frame-binding-wire.d.ts +28 -0
  80. package/dist/frame-binding-wire.js +54 -0
  81. package/dist/git-admission.d.ts +52 -0
  82. package/dist/git-admission.js +188 -0
  83. package/dist/git-auth.d.ts +11 -0
  84. package/dist/git-auth.js +27 -0
  85. package/dist/git-door.d.ts +35 -0
  86. package/dist/git-door.js +108 -0
  87. package/dist/git-journal.d.ts +31 -0
  88. package/dist/git-journal.js +188 -0
  89. package/dist/git.d.ts +31 -0
  90. package/dist/git.js +64 -0
  91. package/dist/guest-policy.d.ts +9 -0
  92. package/dist/guest-policy.js +13 -0
  93. package/dist/host.d.ts +244 -0
  94. package/dist/host.js +1043 -0
  95. package/dist/index.d.ts +166 -0
  96. package/dist/index.js +320 -0
  97. package/dist/installation-consent.d.ts +79 -0
  98. package/dist/installation-consent.js +82 -0
  99. package/dist/internal/background-origins.d.ts +3 -0
  100. package/dist/internal/background-origins.js +8 -0
  101. package/dist/internal/delivery.d.ts +12 -0
  102. package/dist/internal/delivery.js +167 -0
  103. package/dist/internal/host-gate.d.ts +14 -0
  104. package/dist/internal/host-gate.js +62 -0
  105. package/dist/internal/registry-installations.d.ts +6 -0
  106. package/dist/internal/registry-installations.js +12 -0
  107. package/dist/invocation.d.ts +251 -0
  108. package/dist/invocation.js +377 -0
  109. package/dist/keys.d.ts +48 -0
  110. package/dist/keys.js +52 -0
  111. package/dist/mcp-owner.d.ts +27 -0
  112. package/dist/mcp-owner.js +143 -0
  113. package/dist/mcp.d.ts +89 -0
  114. package/dist/mcp.js +429 -0
  115. package/dist/media.d.ts +23 -0
  116. package/dist/media.js +12 -0
  117. package/dist/pack.d.ts +76 -0
  118. package/dist/pack.js +134 -0
  119. package/dist/page/capabilities.d.ts +23 -0
  120. package/dist/page/capabilities.js +256 -0
  121. package/dist/page/computer-handles.d.ts +79 -0
  122. package/dist/page/computer-handles.js +44 -0
  123. package/dist/page/lifetime.d.ts +6 -0
  124. package/dist/page/lifetime.js +19 -0
  125. package/dist/page/mount.d.ts +163 -0
  126. package/dist/page/mount.js +390 -0
  127. package/dist/page/storage.d.ts +3 -0
  128. package/dist/page/storage.js +82 -0
  129. package/dist/page/terminal.d.ts +5 -0
  130. package/dist/page/terminal.js +7 -0
  131. package/dist/page-script.d.ts +14 -0
  132. package/dist/page-script.js +5 -0
  133. package/dist/r2-files.d.ts +3 -0
  134. package/dist/r2-files.js +79 -0
  135. package/dist/release.d.ts +72 -0
  136. package/dist/release.js +164 -0
  137. package/dist/root-data.d.ts +86 -0
  138. package/dist/root-data.js +69 -0
  139. package/dist/shell/app-directory.d.ts +537 -0
  140. package/dist/shell/app-directory.js +195 -0
  141. package/dist/shell/browser-actions.d.ts +7 -0
  142. package/dist/shell/browser-actions.js +56 -0
  143. package/dist/shell/command-host.d.ts +112 -0
  144. package/dist/shell/command-host.js +502 -0
  145. package/dist/shell/commands.d.ts +25 -0
  146. package/dist/shell/commands.js +78 -0
  147. package/dist/shell/index.d.ts +8 -0
  148. package/dist/shell/index.js +8 -0
  149. package/dist/shell/keys.d.ts +41 -0
  150. package/dist/shell/keys.js +134 -0
  151. package/dist/shell/shell-module.d.ts +31 -0
  152. package/dist/shell/shell-module.js +37 -0
  153. package/dist/shell/window-manager.d.ts +124 -0
  154. package/dist/shell/window-manager.js +711 -0
  155. package/dist/shell/workbench-contract.d.ts +68 -0
  156. package/dist/shell/workbench-contract.js +1 -0
  157. package/dist/shell/workbench-host-types.d.ts +96 -0
  158. package/dist/shell/workbench-host-types.js +1 -0
  159. package/dist/shell/workbench-host.d.ts +34 -0
  160. package/dist/shell/workbench-host.js +347 -0
  161. package/dist/shell/workbench-model.d.ts +192 -0
  162. package/dist/shell/workbench-model.js +53 -0
  163. package/dist/shell/workbench.d.ts +4 -0
  164. package/dist/shell/workbench.js +2 -0
  165. package/dist/source/fork.d.ts +27 -0
  166. package/dist/source/fork.js +46 -0
  167. package/dist/source/index.d.ts +11 -0
  168. package/dist/source/index.js +11 -0
  169. package/dist/source/seed-receipt.d.ts +53 -0
  170. package/dist/source/seed-receipt.js +18 -0
  171. package/dist/source/team-source.d.ts +32 -0
  172. package/dist/source/team-source.js +42 -0
  173. package/dist/source/template-repository.d.ts +2 -0
  174. package/dist/source/template-repository.js +8 -0
  175. package/dist/source/template-write.d.ts +69 -0
  176. package/dist/source/template-write.js +344 -0
  177. package/dist/storage-frame.d.ts +64 -0
  178. package/dist/storage-frame.js +28 -0
  179. package/dist/tenant.d.ts +81 -0
  180. package/dist/tenant.js +71 -0
  181. package/dist/testing/capabilities.d.ts +29 -0
  182. package/dist/testing/capabilities.js +130 -0
  183. package/dist/testing/catalog.d.ts +3 -0
  184. package/dist/testing/catalog.js +53 -0
  185. package/dist/testing/index.d.ts +10 -0
  186. package/dist/testing/index.js +10 -0
  187. package/dist/testing/installation.d.ts +11 -0
  188. package/dist/testing/installation.js +25 -0
  189. package/dist/testing/native-worker.d.ts +21 -0
  190. package/dist/testing/native-worker.js +106 -0
  191. package/dist/testing/worker.d.ts +18 -0
  192. package/dist/testing/worker.js +67 -0
  193. package/dist/testing/workers-runtime.d.ts +24 -0
  194. package/dist/testing/workers-runtime.js +33 -0
  195. package/dist/webhook-delivery.d.ts +14 -0
  196. package/dist/webhook-delivery.js +17 -0
  197. package/dist/workers-git.d.ts +285 -0
  198. package/dist/workers-git.js +1174 -0
  199. package/dist/workers.d.ts +352 -0
  200. package/dist/workers.js +866 -0
  201. package/docs/api/README.md +82 -0
  202. package/docs/api/agents.md +332 -0
  203. package/docs/api/app-storage.md +209 -0
  204. package/docs/api/apps.md +1375 -0
  205. package/docs/api/auth.md +63 -0
  206. package/docs/api/build-contract.md +507 -0
  207. package/docs/api/build.md +1476 -0
  208. package/docs/api/cloudflare.md +421 -0
  209. package/docs/api/computer.md +203 -0
  210. package/docs/api/files.md +117 -0
  211. package/docs/api/git.md +470 -0
  212. package/docs/api/host.md +1328 -0
  213. package/docs/api/index.md +430 -0
  214. package/docs/api/invocation.md +738 -0
  215. package/docs/api/keys.md +175 -0
  216. package/docs/api/mcp.md +301 -0
  217. package/docs/api/media.md +40 -0
  218. package/docs/api/modules.md +42 -0
  219. package/docs/api/pack.md +138 -0
  220. package/docs/api/page/mount.md +298 -0
  221. package/docs/api/root-data.md +111 -0
  222. package/docs/api/shell/app-directory.md +332 -0
  223. package/docs/api/shell/command-host.md +224 -0
  224. package/docs/api/shell/commands.md +197 -0
  225. package/docs/api/shell/keys.md +183 -0
  226. package/docs/api/shell/shell-module.md +143 -0
  227. package/docs/api/shell/window-manager.md +267 -0
  228. package/docs/api/shell/workbench.md +186 -0
  229. package/docs/api/shell.md +1788 -0
  230. package/docs/api/tenant.md +194 -0
  231. package/docs/api/workers-git.md +1527 -0
  232. package/docs/api/workers.md +1678 -0
  233. package/docs/media/architecture.mmd +32 -0
  234. package/docs/media/architecture.png +0 -0
  235. package/docs/media/bonsai-network.png +0 -0
  236. package/docs/media/bonsai-repository.png +0 -0
  237. package/docs/site/agent-quickstart.mdx +349 -0
  238. package/examples/git/worker.ts +39 -0
  239. package/examples/git/wrangler.jsonc +32 -0
  240. package/examples/standalone/worker.ts +14 -0
  241. package/examples/standalone/wrangler.jsonc +21 -0
  242. package/package.json +249 -3
@@ -0,0 +1,82 @@
1
+ <!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
2
+
3
+ **@fungi.computer/oyster**
4
+
5
+ ---
6
+
7
+ # Oyster API overview
8
+
9
+ | Import | Export | Purpose |
10
+ | --------------------------------------------- | -------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
11
+ | `@fungi.computer/oyster` | `createAppInstance` | Run one App Instance's lifecycle and admission over host-supplied ports. |
12
+ | `@fungi.computer/oyster` | `InstancePorts` | The storage, artifact resolution, abort, purge and connection ports a host supplies. |
13
+ | `@fungi.computer/oyster` | `selectionSchema` | Decode the owner-issued selection that authorizes a request. |
14
+ | `@fungi.computer/oyster` | `ownerStateSchema` | Decode a complete owner state: `enabled`, `disabled` or `deleted`. |
15
+ | `@fungi.computer/oyster` | `AppInstanceError` | Typed rejection with a stable `code` from `appInstanceErrorCodeSchema`. |
16
+ | `@fungi.computer/oyster` | `instanceIds` | Mint and recognize App Instance IDs. |
17
+ | `@fungi.computer/oyster/invocation` | `createInvocationGate`, `invocationFacts`, `InvocationFrame` | Run each request in one frame of host-admitted caller facts, with its deadline and abort signal. |
18
+ | `@fungi.computer/oyster/cloudflare` | `createCloudflareAppInstance` | Run an Instance in a SQLite Durable Object with a Worker Loader facet (workerd or celld). |
19
+ | `@fungi.computer/oyster/apps` | `Installation`, `applyInstallationCommand`, `admits`, `approvedBindingGrants` | Pure installation approvals and admission; host-owned commits and tenant freshness. |
20
+ | `@fungi.computer/oyster/host` | `createOyster` | The Oyster App server: a Hono app over host adapters for sign-in, Releases, installations and Instances. |
21
+ | `@fungi.computer/oyster/auth` | `ownerKeyAuth`, `ownerOrKeyAuth` | Owner-key sign-in (a Bearer key or the login cookie, compared in constant time) and named agent keys as Team-key principals. |
22
+ | `@fungi.computer/oyster/tenant` | `TenantScope`, `tenantScope`, `singleTenant`, `OysterTenancy` | Host-resolved tenant identity and the scope that prefixes registry, key and repository names. |
23
+ | `@fungi.computer/oyster/workers` | `createOysterWorker` | A standalone single-owner Oyster on Workers or celld: R2 Releases, a registry and one Durable Object per Instance. |
24
+ | `@fungi.computer/oyster/pack` | `packRelease`, `installRelease`, `installFromSource`, `publishSource` | Build a committed App through the canonical recipe compiler and install its Release on an Oyster over HTTP. |
25
+ | `@fungi.computer/oyster/build` | `createAppCandidatePreparer`, `createLocalBuildExecutor` | Node-only source capture, pinned compilation and local artifact writing. |
26
+ | `@fungi.computer/oyster/build-contract` | Recipe schemas and candidate orchestration | The Worker-safe half of `./build`, without the executor. |
27
+ | `@fungi.computer/oyster/app-storage` | `AppStorageBinding` | `env.APP_STORAGE` for methods and lifecycle handlers: lifecycle writes go to the team layer and reach `appStorage.watch`. |
28
+ | `@fungi.computer/oyster/app-storage` | `createAppStorage`, `appStorageSchemaStatements` | SQLite owner for declared keys, live member/lifecycle admission, revision checks and watch invalidations. |
29
+ | `@fungi.computer/oyster/mcp` | `oysterAppMethods`, `oysterComputerTools`, `oysterMcpCatalogLoad` | Installed App methods and the host's Computer as Mycelium modules for the shared MCP endpoint, scoped to the caller. |
30
+ | `@fungi.computer/oyster/agents` | `OysterAgents`, `agentCapabilities`, `agentApprovalRoutes` | The host's Agent slot, its App capabilities and the owner-only approval routes. |
31
+ | `@fungi.computer/oyster/computer` | `computerSlots`, `ComputerTerminalHost` | Computer ports, processes and terminal routes supplied by the host; execution stays in the Computer runtime. |
32
+ | `@fungi.computer/oyster/media` | `mediaSlot` | The media capability slot a host fills; Oyster owns routing, never generation. |
33
+ | `@fungi.computer/oyster/files` | `FileSource` | Files Apps reach through Agar's `computer.*` file contracts, with a compare-and-swap replace. |
34
+ | `@fungi.computer/oyster/root-data` | `createOysterRootData` | Installation and verified Release owners as shared workbench metadata for a standalone root. |
35
+ | `@fungi.computer/oyster/page` | `mountOysterPage`, `connectOysterApp`, `readOysterPageConfig` | Mount one installed App's sandboxed frame and connect its admitted slots. |
36
+ | `@fungi.computer/oyster/shell` | Shell client exports | Build a browser or terminal host from the focused entries below. |
37
+ | `@fungi.computer/oyster/shell/workbench` | Workbench types and schemas | Describe child mounts, geometry and Gill arrangers without platform policy. |
38
+ | `@fungi.computer/oyster/shell/command-host` | `createAppSurfaceCommandHost` | Admit declared commands and own focus and contribution lifetimes. |
39
+ | `@fungi.computer/oyster/shell/keys` | `installShellKeys`, `parseChord` | Match chords and optionally install DOM key dispatch. |
40
+ | `@fungi.computer/oyster/shell/commands` | `shellCommands` | Declare shell commands over embedding-host callbacks. |
41
+ | `@fungi.computer/oyster/shell/window-manager` | `createWindowManager` | Own window generations, visibility and disposal over a mount adapter. |
42
+ | `@fungi.computer/oyster/shell/app-directory` | Directory schemas | Decode host-neutral addresses and App metadata before permissions. |
43
+ | `@fungi.computer/oyster/shell/shell-module` | `importShellModule`, `ShellMountInput`, `MountShell` | Load the picked shell Release's `mountShell` module from the host's own origin and hand it the workbench, storage and methods. |
44
+ | `@fungi.computer/oyster/git` | `EventSink`, `createGitDoor`, `signStandardWebhook` | The EVENTS binding contract, the git smart-HTTP door and Standard Webhooks signing. `GitBinding` comes from `@fungi.computer/agar/git`. |
45
+ | `@fungi.computer/oyster/workers-git` | `oysterGitRoot`, `createOysterGitWorker`, `ownerOrKeyTenancy`, `oysterWorkerGit`, `gitAdminRoutes` | One Git root whose `hostFor` serves HTTP, MCP and Instances, or `host.git` and key/webhook routes for your own host. |
46
+
47
+ The host owns admission: it decides who may apply owner state and which
48
+ selection a request carries. Oyster owns what happens to one Instance once the
49
+ host has that authority: owner-state replay and conflict rules, Release
50
+ resolution, state-schema compatibility, fencing on disable and purge on delete.
51
+ The generated module pages below include every port and record type.
52
+
53
+ ## Guest execution policy
54
+
55
+ `createOyster({ ...host, guestLimits: { cpuMs: 250, subRequests: 10 } })`
56
+ configures per-invocation budgets. Omitted fields default to 1,000 milliseconds
57
+ of CPU and 50 subrequests. CPU must be a positive integer; subrequests may be
58
+ zero to forbid them. Both must fit a signed 32-bit integer. Invalid
59
+ configuration fails before accepting requests.
60
+
61
+ The host's `InstanceDirectory.get(id, limits)` adapter must carry those budgets
62
+ to guest execution.
63
+ `createOysterWorker({ guestLimits: { cpuMs: 250, subRequests: 10 } })` supplies
64
+ this wiring for the standalone Worker. Direct `createCloudflareAppInstance`
65
+ callers can supply the same policy in its final argument; otherwise the same
66
+ defaults apply. The loader code carries limits for both HTTP and method calls,
67
+ without granting ambient outbound access. Changing an Instance's budgets
68
+ invalidates its running facet while preserving its SQLite state. Runtime
69
+ enforcement uses the
70
+ [Worker Loader resource limits](https://developers.cloudflare.com/dynamic-workers/usage/limits/).
71
+
72
+ Guest HTTP responses retain only content metadata: content type, language,
73
+ encoding, length, disposition and range, accepted ranges, ETag and
74
+ last-modified. Oyster supplies `Cache-Control: no-store`,
75
+ `X-Content-Type-Options: nosniff`, and a sandboxed, deny-by-default Content
76
+ Security Policy. Cookies, redirects, origin policy, service-worker scope and
77
+ unrecognized headers cannot come from guests. Host-issued login responses retain
78
+ their cookies.
79
+
80
+ The Node-only `@fungi.computer/oyster/build` entry owns captured App
81
+ compilation; `@fungi.computer/oyster/build-contract` provides its Worker-safe
82
+ recipe and candidate orchestration without loading the executor.
@@ -0,0 +1,332 @@
1
+ <!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
2
+
3
+ [**@fungi.computer/oyster**](README.md)
4
+
5
+ ---
6
+
7
+ [@fungi.computer/oyster](modules.md) / agents
8
+
9
+ # agents
10
+
11
+ ## Type Aliases
12
+
13
+ ### OysterAgent
14
+
15
+ ```ts
16
+ type OysterAgent = Readonly<{
17
+ agentId: string;
18
+ name: string;
19
+ sessionOperations: readonly ("agent.read" | "agent.send" | "agent.manage")[];
20
+ }>;
21
+ ```
22
+
23
+ One agent as Apps see it, in Agar's `appAgentSchema` shape.
24
+
25
+ ---
26
+
27
+ ### OysterSessionRow
28
+
29
+ ```ts
30
+ type OysterSessionRow =
31
+ | Omit<
32
+ Extract<
33
+ MemberInboxSession,
34
+ {
35
+ title: string;
36
+ }
37
+ >,
38
+ "agentId" | "visitedAt"
39
+ >
40
+ | Omit<
41
+ Extract<
42
+ MemberInboxSession,
43
+ {
44
+ state: "unavailable";
45
+ }
46
+ >,
47
+ "agentId"
48
+ >;
49
+ ```
50
+
51
+ An Agent owner's Session facts before the member identity and visit are added.
52
+
53
+ ---
54
+
55
+ ### OysterInboxItem
56
+
57
+ ```ts
58
+ type OysterInboxItem = MemberInboxItem;
59
+ ```
60
+
61
+ Both hosts expose the same Inbox item vocabulary.
62
+
63
+ ---
64
+
65
+ ### OysterInbox
66
+
67
+ ```ts
68
+ type OysterInbox = Readonly<{
69
+ items: readonly OysterInboxItem[];
70
+ revision: number;
71
+ }>;
72
+ ```
73
+
74
+ The whole inbox at one revision; the revision only grows.
75
+
76
+ ---
77
+
78
+ ### AgentPolicyActor
79
+
80
+ ```ts
81
+ type AgentPolicyActor =
82
+ | "owner-direct"
83
+ | Readonly<{
84
+ installationId: string;
85
+ }>;
86
+ ```
87
+
88
+ Host-attested source of a policy request; request headers are not this fact.
89
+
90
+ ---
91
+
92
+ ### PendingAgentPolicy
93
+
94
+ ```ts
95
+ type PendingAgentPolicy = Readonly<{
96
+ status: "pending";
97
+ revision: string;
98
+ }>;
99
+ ```
100
+
101
+ An App's requested tools await the owner's direct approval.
102
+
103
+ ---
104
+
105
+ ### AgentMcpServer
106
+
107
+ ```ts
108
+ type AgentMcpServer = Readonly<{
109
+ serverId: string;
110
+ name: string;
111
+ url: string;
112
+ hasBearer: boolean;
113
+ }>;
114
+ ```
115
+
116
+ One remote MCP server connected to an Agent; its bearer token is never returned.
117
+
118
+ ---
119
+
120
+ ### AgentMcpServerInput
121
+
122
+ ```ts
123
+ type AgentMcpServerInput = typeof agentMcpServerInputSchema.Type;
124
+ ```
125
+
126
+ An owner's request to connect one remote MCP server to an Agent.
127
+
128
+ ---
129
+
130
+ ### AgentMcpServerRefusal
131
+
132
+ ```ts
133
+ type AgentMcpServerRefusal = Readonly<{
134
+ error: "not_found" | "duplicate_name" | "limit";
135
+ }>;
136
+ ```
137
+
138
+ Why connecting an MCP server was refused.
139
+
140
+ ---
141
+
142
+ ### AgentToolPolicyStatus
143
+
144
+ ```ts
145
+ type AgentToolPolicyStatus = Readonly<{
146
+ status: "pending" | "approved";
147
+ revision: string;
148
+ }>;
149
+ ```
150
+
151
+ This Agent's App-tool policy, in the shape Apps read it.
152
+
153
+ ---
154
+
155
+ ### OysterAgents
156
+
157
+ ```ts
158
+ type OysterAgents = Readonly<{
159
+ list: Promise<
160
+ readonly Readonly<{
161
+ agentId: string;
162
+ name: string;
163
+ sessionOperations: readonly (
164
+ "agent.read" | "agent.send" | "agent.manage"
165
+ )[];
166
+ }>[]
167
+ >;
168
+ create: Promise<
169
+ Readonly<{
170
+ agentId: string;
171
+ name: string;
172
+ sessionOperations: readonly (
173
+ "agent.read" | "agent.send" | "agent.manage"
174
+ )[];
175
+ }>
176
+ >;
177
+ rename: Promise<
178
+ | Readonly<{
179
+ agentId: string;
180
+ name: string;
181
+ sessionOperations: readonly (
182
+ "agent.read" | "agent.send" | "agent.manage"
183
+ )[];
184
+ }>
185
+ | Readonly<{
186
+ error: "not_found" | "name_taken" | "not_granted";
187
+ }>
188
+ >;
189
+ policyStatus: Promise<Readonly<{
190
+ status: "pending" | "approved";
191
+ revision: string;
192
+ }> | null>;
193
+ appToolPolicy: Promise<{
194
+ level: "read" | "write";
195
+ revision: string;
196
+ grantedBy: string;
197
+ } | null>;
198
+ policyRevision: Promise<string | null>;
199
+ approveAppToolPolicy: Promise<
200
+ | {
201
+ level: "read" | "write";
202
+ revision: string;
203
+ grantedBy: string;
204
+ }
205
+ | Readonly<{
206
+ status: "pending";
207
+ revision: string;
208
+ }>
209
+ | Readonly<{
210
+ error: "not_found" | "revision_conflict" | "not_granted";
211
+ }>
212
+ >;
213
+ mcpServers: Promise<
214
+ | readonly Readonly<{
215
+ serverId: string;
216
+ name: string;
217
+ url: string;
218
+ hasBearer: boolean;
219
+ }>[]
220
+ | null
221
+ >;
222
+ addMcpServer: Promise<
223
+ | Readonly<{
224
+ serverId: string;
225
+ name: string;
226
+ url: string;
227
+ hasBearer: boolean;
228
+ }>
229
+ | Readonly<{
230
+ error: "not_found" | "duplicate_name" | "limit";
231
+ }>
232
+ >;
233
+ removeMcpServer: Promise<boolean>;
234
+ fetch: Promise<Response | null>;
235
+ inbox: Promise<
236
+ Readonly<{
237
+ items: readonly OysterInboxItem[];
238
+ revision: number;
239
+ }>
240
+ >;
241
+ revision: Promise<number>;
242
+ visit: Promise<boolean>;
243
+ }>;
244
+ ```
245
+
246
+ Where an Oyster's agents live and run.
247
+
248
+ ## Variables
249
+
250
+ ### maxAgentMcpServers
251
+
252
+ ```ts
253
+ const maxAgentMcpServers: 16 = 16;
254
+ ```
255
+
256
+ At most this many MCP servers per Agent.
257
+
258
+ ---
259
+
260
+ ### agentMcpServerInputSchema
261
+
262
+ ```ts
263
+ const agentMcpServerInputSchema: Struct<{
264
+ name: String;
265
+ url: String;
266
+ bearer: NullOr<String>;
267
+ }>;
268
+ ```
269
+
270
+ Owner input for one MCP server: a guest identifier, an `https:` endpoint and an
271
+ optional bearer.
272
+
273
+ ## Functions
274
+
275
+ ### agentCapabilities()
276
+
277
+ ```ts
278
+ function agentCapabilities(agents): readonly Readonly<object & object>[];
279
+ ```
280
+
281
+ Agent adapters admitted against each App's declared capabilities.
282
+
283
+ #### Parameters
284
+
285
+ | Parameter | Type |
286
+ | --------- | ------------------------------- |
287
+ | `agents` | [`OysterAgents`](#oysteragents) |
288
+
289
+ #### Returns
290
+
291
+ readonly `Readonly`\<`object` & `object`\>[]
292
+
293
+ ---
294
+
295
+ ### agentApprovalRoutes()
296
+
297
+ ```ts
298
+ function agentApprovalRoutes(agents): Hono<OysterEnv>;
299
+ ```
300
+
301
+ Host-owned direct approval under the admitted owner; never an App capability.
302
+
303
+ #### Parameters
304
+
305
+ | Parameter | Type |
306
+ | --------- | ------------------------------- |
307
+ | `agents` | [`OysterAgents`](#oysteragents) |
308
+
309
+ #### Returns
310
+
311
+ `Hono`\<[`OysterEnv`](host.md#oysterenv)\>
312
+
313
+ ---
314
+
315
+ ### agentMcpServerRoutes()
316
+
317
+ ```ts
318
+ function agentMcpServerRoutes(agents): Hono<OysterEnv>;
319
+ ```
320
+
321
+ Host-owned Agent MCP server custody for the owner directly; never an App
322
+ capability. Bearer tokens go in and never come back out.
323
+
324
+ #### Parameters
325
+
326
+ | Parameter | Type |
327
+ | --------- | ------------------------------- |
328
+ | `agents` | [`OysterAgents`](#oysteragents) |
329
+
330
+ #### Returns
331
+
332
+ `Hono`\<[`OysterEnv`](host.md#oysterenv)\>
@@ -0,0 +1,209 @@
1
+ <!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
2
+
3
+ [**@fungi.computer/oyster**](README.md)
4
+
5
+ ---
6
+
7
+ [@fungi.computer/oyster](modules.md) / app-storage
8
+
9
+ # app-storage
10
+
11
+ ## Type Aliases
12
+
13
+ ### AppStorageBinding
14
+
15
+ ```ts
16
+ type AppStorageBinding = Readonly<{
17
+ read: Promise<
18
+ AppStorageResult<{
19
+ value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
20
+ source: Schema.Literals<readonly ["member", "team", "none"]>;
21
+ team: Schema.NullOr<
22
+ Schema.Struct<{
23
+ value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
24
+ revision: Schema.Int;
25
+ }>
26
+ >;
27
+ member: Schema.NullOr<
28
+ Schema.Struct<{
29
+ value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
30
+ revision: Schema.Int;
31
+ }>
32
+ >;
33
+ canWriteTeam: Schema.Boolean;
34
+ }>
35
+ >;
36
+ write: Promise<
37
+ AppStorageResult<{
38
+ revision: number;
39
+ }>
40
+ >;
41
+ reset: Promise<
42
+ AppStorageResult<{
43
+ revision: number;
44
+ }>
45
+ >;
46
+ }>;
47
+ ```
48
+
49
+ The App storage handle in `env.APP_STORAGE`.
50
+
51
+ ---
52
+
53
+ ### AppStorageWriter
54
+
55
+ ```ts
56
+ type AppStorageWriter =
57
+ | Readonly<{
58
+ kind: "member";
59
+ memberId: string;
60
+ isOwner: boolean;
61
+ }>
62
+ | Readonly<{
63
+ kind: "lifecycle";
64
+ handler: string;
65
+ }>;
66
+ ```
67
+
68
+ Trusted backend writer: owners may also edit the Team layer; lifecycle has no
69
+ member.
70
+
71
+ ---
72
+
73
+ ### AppStorageAdmission
74
+
75
+ ```ts
76
+ type AppStorageAdmission = Readonly<{
77
+ address: string;
78
+ appId: string;
79
+ memberId: string;
80
+ membershipVersion: number;
81
+ isOwner: boolean;
82
+ keys: readonly AppStorageKey[];
83
+ assertCurrent: () => void;
84
+ }>;
85
+ ```
86
+
87
+ Trusted live App admission, never supplied by the App or an HTTP body.
88
+
89
+ ---
90
+
91
+ ### AppStorageInstallationAdmission
92
+
93
+ ```ts
94
+ type AppStorageInstallationAdmission = Pick<
95
+ AppStorageAdmission,
96
+ "address" | "appId" | "keys" | "assertCurrent"
97
+ >;
98
+ ```
99
+
100
+ Trusted installation lifecycle admission, with no member identity or private
101
+ layer.
102
+
103
+ ## Variables
104
+
105
+ ### appStorageSchemaStatements
106
+
107
+ ```ts
108
+ const appStorageSchemaStatements: readonly [
109
+ "CREATE TABLE IF NOT EXISTS hub_app_storage (\n address TEXT NOT NULL, app_id TEXT NOT NULL, key TEXT NOT NULL,\n scope TEXT NOT NULL CHECK(scope IN ('team','member')), member_id TEXT NOT NULL, membership_version INTEGER NOT NULL,\n value TEXT NOT NULL, revision INTEGER NOT NULL, bytes INTEGER NOT NULL,\n PRIMARY KEY(address,app_id,key,scope,member_id,membership_version),\n CHECK((scope='team' AND member_id='' AND membership_version=0) OR (scope='member' AND member_id<>'' AND membership_version>0))) STRICT",
110
+ "CREATE INDEX IF NOT EXISTS hub_app_storage_member ON hub_app_storage(member_id) WHERE scope='member'",
111
+ "CREATE TABLE IF NOT EXISTS hub_app_storage_clock (id INTEGER PRIMARY KEY CHECK(id=1), revision INTEGER NOT NULL) STRICT",
112
+ "INSERT OR IGNORE INTO hub_app_storage_clock VALUES(1,0)",
113
+ "CREATE TABLE IF NOT EXISTS hub_app_storage_writes (address TEXT NOT NULL, member_id TEXT NOT NULL, membership_version INTEGER NOT NULL, started_at INTEGER NOT NULL, count INTEGER NOT NULL, PRIMARY KEY(address,member_id,membership_version)) STRICT",
114
+ ];
115
+ ```
116
+
117
+ SQLite tables, indexes and initial revision state used by the App storage owner.
118
+
119
+ ## Functions
120
+
121
+ ### appStorageWritable()
122
+
123
+ ```ts
124
+ function appStorageWritable(writer, scope): boolean;
125
+ ```
126
+
127
+ Whether `writer` may mutate `scope`; anything else is `owner_required`.
128
+
129
+ #### Parameters
130
+
131
+ | Parameter | Type |
132
+ | --------- | --------------------------------------- |
133
+ | `writer` | [`AppStorageWriter`](#appstoragewriter) |
134
+ | `scope` | `"team"` \| `"member"` |
135
+
136
+ #### Returns
137
+
138
+ `boolean`
139
+
140
+ ---
141
+
142
+ ### purgeAppStorageInCommit()
143
+
144
+ ```ts
145
+ function purgeAppStorageInCommit(sql, address): void;
146
+ ```
147
+
148
+ Called only inside the installation owner's delete transaction.
149
+
150
+ #### Parameters
151
+
152
+ | Parameter | Type |
153
+ | --------- | ----------------------------------------------------------------------------------- |
154
+ | `sql` | `Readonly`\<\{ `exec`: (`statement`, ...`bindings`) => `WatchdogSqliteCursor`; \}\> |
155
+ | `address` | `string` |
156
+
157
+ #### Returns
158
+
159
+ `void`
160
+
161
+ ---
162
+
163
+ ### purgeAppMemberStorageInCommit()
164
+
165
+ ```ts
166
+ function purgeAppMemberStorageInCommit(sql, memberId, throughVersion): void;
167
+ ```
168
+
169
+ Called only inside the membership owner's removal transaction.
170
+
171
+ #### Parameters
172
+
173
+ | Parameter | Type |
174
+ | ---------------- | ----------------------------------------------------------------------------------- |
175
+ | `sql` | `Readonly`\<\{ `exec`: (`statement`, ...`bindings`) => `WatchdogSqliteCursor`; \}\> |
176
+ | `memberId` | `string` |
177
+ | `throughVersion` | `number` |
178
+
179
+ #### Returns
180
+
181
+ `void`
182
+
183
+ ---
184
+
185
+ ### createAppStorage()
186
+
187
+ ```ts
188
+ function createAppStorage(options): object;
189
+ ```
190
+
191
+ One SQLite owner for scoped App values; its views bind the admitted member.
192
+
193
+ #### Parameters
194
+
195
+ | Parameter | Type | Description |
196
+ | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
197
+ | `options` | \{ `sql`: `Readonly`\<\{ `exec`: (`statement`, ...`bindings`) => `WatchdogSqliteCursor`; \}\>; `now?`: () => `number`; `commit`: \<`A`\>(`body`) => `Effect`\<`A`, `Error`\>; \} | - |
198
+ | `options.sql` | `Readonly`\<\{ `exec`: (`statement`, ...`bindings`) => `WatchdogSqliteCursor`; \}\> | The SQLite connection shared with installation and membership changes. |
199
+ | `options.now?` | () => `number` | Millisecond clock used for the existing per-principal write-rate limit. |
200
+ | `options.commit` | \<`A`\>(`body`) => `Effect`\<`A`, `Error`\> | Commit the supplied mutation atomically before publishing its invalidation. |
201
+
202
+ #### Returns
203
+
204
+ | Name | Type | Description |
205
+ | --------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------ |
206
+ | `purgeInstallation()` | (`address`) => `void` | Remove an installation's values and write counters inside its delete transaction. |
207
+ | `purgeMember()` | (`memberId`, `throughVersion`) => `void` | Remove a member's private values and counters through the revoked membership version. |
208
+ | `openInstallation()` | (`authorize`) => `object` | Bind a lifecycle view to fresh installation admission; only declared team layers are accessible. |
209
+ | `open()` | (`authorize`) => `object` | Bind a member view to live admission, declared keys and the current membership version. |