@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,352 @@
1
+ import { type Installation } from "./apps/installation.js";
2
+ import { type BackgroundSyncRefusal } from "@fungi.computer/puffball/background-replay";
3
+ import { type TenantScope, type TenantId } from "./tenant.js";
4
+ import { type GillCall, type GillReply } from "@fungi.computer/gills";
5
+ import { ownerKeyAuth } from "./auth.js";
6
+ import type { AppGitPushFact, GitBinding, GitPushQuestion, GitPushVerdict } from "@fungi.computer/agar/git";
7
+ import { type OysterMcpOwner } from "./mcp-owner.js";
8
+ export { createOysterMcpOwner, OysterMcpOwner, type OysterMcpOwnerEnv, type OysterMcpTenantPin, } from "./mcp-owner.js";
9
+ import { type GuestLimits } from "./guest-policy.js";
10
+ import { r2FileSource } from "./r2-files.js";
11
+ import { type FileSource } from "./files.js";
12
+ import { DurableObject, type WorkerEntrypoint } from "cloudflare:workers";
13
+ import * as Schema from "effect/Schema";
14
+ import type { Release } from "@fungi.computer/puffball";
15
+ import { type Backend, type Instance, type OwnerState } from "./index.js";
16
+ import { type FrameBindingReply, type FrameBindingMethod, type FrameBindingProps } from "./cloudflare.js";
17
+ import { type BackgroundFrameState, type InvocationFacts, type InvocationFrame } from "./invocation.js";
18
+ import { type InstallationCommit, type InstanceResult, type OysterAuth, type OysterHost, type OysterJson } from "./host.js";
19
+ import { type AppStorageResult, type AppStorageWrite, type AppStorageReset, type ResolvedAppStorage } from "@fungi.computer/agar/storage";
20
+ import { type OysterRootDirectory } from "./root-data.js";
21
+ import { type ArtifactStore } from "./release.js";
22
+ import type { AppApi } from "@fungi.computer/puffball";
23
+ import type { AppDeclaration } from "@fungi.computer/puffball/app";
24
+ import { createOysterAppSourceReceipts, createOysterAppRegistrations, createOysterArtifactsRepositoryMetadataStore } from "./app-sources.js";
25
+ export { r2FileSource, ownerKeyAuth };
26
+ /** Native values returned by the standalone Git, event and JSON binding owners. */
27
+ export type OysterBindingResult = Awaited<ReturnType<GitBinding[keyof GitBinding]>> | Schema.Json | undefined;
28
+ /** Verified backend custody is captured in the frame, never in a current-context field. */
29
+ export type OysterInvocationHost = BackgroundFrameState & Readonly<{
30
+ artifact: Backend;
31
+ declaration: AppDeclaration | null;
32
+ /** The verified declared method; opaque backend and lifecycle frames have none. */
33
+ method?: Readonly<{
34
+ name: string;
35
+ }>;
36
+ }>;
37
+ /** Existing fleet directory owner records, resolved by the host rather than App input. */
38
+ export type OysterStorageAgentDirectory = Readonly<{
39
+ /** Resolve the host-owned fleet directory by its existing durable name. */
40
+ getByName(name: string): Readonly<{
41
+ /** Return the recorded creator, or null when the Agent has no owner record. */
42
+ readCreator(agentId: string): Promise<string | null>;
43
+ }>;
44
+ }>;
45
+ /** Bindings a standalone Oyster Worker declares in its Wrangler config. */
46
+ export type OysterWorkerEnv = Readonly<{
47
+ /** The owner's sign-in key, at least 24 characters (a secret). */
48
+ OYSTER_OWNER_KEY: string;
49
+ /** The single-tenant owner's identity, also recorded by the existing fleet creator. */
50
+ OYSTER_OWNER_NAME?: string;
51
+ /** Optional existing fleet owner; absence grants no Agent storage authority. */
52
+ AGENT_DIRECTORY?: OysterStorageAgentDirectory;
53
+ /** Canonical configured origin; requests cannot choose the owner tenant. */
54
+ OYSTER_ORIGIN: string;
55
+ /** One tenant-scoped MCP session owner. Required when serving /mcp. */
56
+ MCP: DurableObjectNamespace<OysterMcpOwner>;
57
+ /** Release artifacts, keyed by artifact reference. */
58
+ RELEASES: R2Bucket;
59
+ /** The installation registry. */
60
+ REGISTRY: DurableObjectNamespace<OysterRegistry>;
61
+ /** One Durable Object per App Instance. */
62
+ INSTANCES: DurableObjectNamespace<OysterInstance>;
63
+ /** Worker Loader that runs App backends. */
64
+ LOADER: WorkerLoader;
65
+ }>;
66
+ /** Store Release artifacts in an R2 bucket. */
67
+ export declare function r2ArtifactStore(bucket: R2Bucket): ArtifactStore;
68
+ /** The installation registry: one SQLite-backed Durable Object per Oyster. */
69
+ export declare class OysterRegistry extends DurableObject<OysterWorkerEnv> {
70
+ #private;
71
+ /** Append-only App source seed receipts; a Git-capable subclass forks over these. */
72
+ protected readonly appSourceReceipts: ReturnType<typeof createOysterAppSourceReceipts>;
73
+ /** Team-owned fork registrations, one App publisher record per App. */
74
+ protected readonly appRegistrations: ReturnType<typeof createOysterAppRegistrations>;
75
+ /** Durable Artifacts repository provenance for this Oyster's own fork compositions. */
76
+ protected readonly artifactsRepositories: ReturnType<typeof createOysterArtifactsRepositoryMetadataStore>;
77
+ constructor(ctx: DurableObjectState, env: OysterWorkerEnv);
78
+ /** Current desktop metadata; roles are the ADR's derived default, never Hub's stored choice. */
79
+ directory(): Promise<OysterRootDirectory>;
80
+ /** Read one key for the authenticated root owner, under fresh App admission. */
81
+ storageRead(installationId: string, ownerId: string, key: string): Promise<AppStorageResult<ResolvedAppStorage>>;
82
+ /** Write one declared key for the authenticated root owner. */
83
+ storageWrite(installationId: string, ownerId: string, input: AppStorageWrite): Promise<AppStorageResult<{
84
+ revision: number;
85
+ }>>;
86
+ /** Reset one declared layer for the authenticated root owner. */
87
+ storageReset(installationId: string, ownerId: string, input: AppStorageReset): Promise<AppStorageResult<{
88
+ revision: number;
89
+ }>>;
90
+ /** Storage for a live owner method frame; no guest-selected installation or member. */
91
+ storageBackend(raw: InvocationFacts, method: string, args: readonly unknown[], tenantId: TenantId): Promise<OysterBindingResult>;
92
+ /** Open the existing App-storage invalidation stream under fresh owner admission. */
93
+ storageEvents(installationId: string, ownerId: string, key: string): Promise<Response>;
94
+ private storageResult;
95
+ private storageOwner;
96
+ /**
97
+ * Resolve a stored creator against the live owner. The single-owner root's
98
+ * owner is the identity its owner key admits; tenant roots override this
99
+ * with their canonical membership.
100
+ */
101
+ protected currentOwner(memberId: string, tenantId: TenantId): Promise<string | null>;
102
+ private storageView;
103
+ /** Every installation record. */
104
+ list(): Installation[];
105
+ /** One installation record, or `null`. */
106
+ get(installationId: string): Installation | null;
107
+ /** Create or replace one installation record. */
108
+ put(installation: Installation, tenantId?: TenantId): Promise<void>;
109
+ /** Native RPC returns a closed result; callers never classify a transported Error. */
110
+ compareAndPut(installation: Installation, expectedAuthorityVersion: number, tenantId?: TenantId): Promise<InstallationCommit>;
111
+ private writeInstallation;
112
+ private decode;
113
+ }
114
+ /** What a binding row may read from the Instance that owns the frame. */
115
+ export type OysterBindingContext<Env> = Readonly<{
116
+ env: Env;
117
+ /** The tenant this Instance's host pinned at its first apply. */
118
+ scope(): TenantScope;
119
+ /** The root host that readmits background work, or `null` where it is refused. */
120
+ backgroundHost(): Promise<OysterHost | null>;
121
+ }>;
122
+ /**
123
+ * One guest binding: the frame codecs both sides of the RPC share, and the
124
+ * host owner that serves a decoded, granted packet under its captured frame.
125
+ */
126
+ export type OysterBindingRow<Env> = Readonly<{
127
+ methods: Readonly<Record<string, FrameBindingMethod<OysterBindingResult>>>;
128
+ /** Serve one decoded packet; the Instance has already admitted its frame and grant. */
129
+ dispatch(context: OysterBindingContext<Env>, frame: InvocationFrame<OysterInvocationHost>, props: FrameBindingProps, method: string, args: readonly unknown[]): Promise<OysterBindingResult>;
130
+ }>;
131
+ /**
132
+ * The bindings an Instance serves, keyed by the closed App binding vocabulary;
133
+ * a missing row is `binding_unavailable`.
134
+ */
135
+ export type OysterBindingTable<Env> = Readonly<{
136
+ APP_STORAGE?: OysterBindingRow<Env>;
137
+ APPS?: OysterBindingRow<Env>;
138
+ BACKGROUND?: OysterBindingRow<Env>;
139
+ GIT?: OysterBindingRow<Env>;
140
+ EVENTS?: OysterBindingRow<Env>;
141
+ INBOX?: OysterBindingRow<Env>;
142
+ AGENTS?: OysterBindingRow<Env>;
143
+ COMPUTER?: OysterBindingRow<Env>;
144
+ MEDIA?: OysterBindingRow<Env>;
145
+ WORKFLOWS?: OysterBindingRow<Env>;
146
+ }>;
147
+ /**
148
+ * The one guest binding entrypoint over `table`. Every binding in a frame is
149
+ * this export with its own props; each packet returns to its originating
150
+ * Instance, which serves it from the same table.
151
+ */
152
+ export declare function oysterBindingEntrypoint<Env extends OysterWorkerEnv>(table: OysterBindingTable<Env>): typeof WorkerEntrypoint<Env, FrameBindingProps>;
153
+ /** The plain Oyster host's bindings: App storage, the read-only catalog and replay admission. */
154
+ export declare const oysterBindings: OysterBindingTable<OysterWorkerEnv>;
155
+ declare const OysterBinding_base: abstract new (ctx: ExecutionContext, env: Readonly<{
156
+ /** The owner's sign-in key, at least 24 characters (a secret). */
157
+ OYSTER_OWNER_KEY: string;
158
+ /** The single-tenant owner's identity, also recorded by the existing fleet creator. */
159
+ OYSTER_OWNER_NAME?: string;
160
+ /** Optional existing fleet owner; absence grants no Agent storage authority. */
161
+ AGENT_DIRECTORY?: Readonly<{
162
+ /** Resolve the host-owned fleet directory by its existing durable name. */
163
+ getByName(name: string): Readonly<{
164
+ /** Return the recorded creator, or null when the Agent has no owner record. */
165
+ readCreator(agentId: string): Promise<string | null>;
166
+ }>;
167
+ }>;
168
+ /** Canonical configured origin; requests cannot choose the owner tenant. */
169
+ OYSTER_ORIGIN: string;
170
+ /** One tenant-scoped MCP session owner. Required when serving /mcp. */
171
+ MCP: DurableObjectNamespace<OysterMcpOwner>;
172
+ /** Release artifacts, keyed by artifact reference. */
173
+ RELEASES: R2Bucket;
174
+ /** The installation registry. */
175
+ REGISTRY: DurableObjectNamespace<OysterRegistry>;
176
+ /** One Durable Object per App Instance. */
177
+ INSTANCES: DurableObjectNamespace<OysterInstance>;
178
+ /** Worker Loader that runs App backends. */
179
+ LOADER: WorkerLoader;
180
+ }>) => WorkerEntrypoint<Readonly<{
181
+ /** The owner's sign-in key, at least 24 characters (a secret). */
182
+ OYSTER_OWNER_KEY: string;
183
+ /** The single-tenant owner's identity, also recorded by the existing fleet creator. */
184
+ OYSTER_OWNER_NAME?: string;
185
+ /** Optional existing fleet owner; absence grants no Agent storage authority. */
186
+ AGENT_DIRECTORY?: Readonly<{
187
+ /** Resolve the host-owned fleet directory by its existing durable name. */
188
+ getByName(name: string): Readonly<{
189
+ /** Return the recorded creator, or null when the Agent has no owner record. */
190
+ readCreator(agentId: string): Promise<string | null>;
191
+ }>;
192
+ }>;
193
+ /** Canonical configured origin; requests cannot choose the owner tenant. */
194
+ OYSTER_ORIGIN: string;
195
+ /** One tenant-scoped MCP session owner. Required when serving /mcp. */
196
+ MCP: DurableObjectNamespace<OysterMcpOwner>;
197
+ /** Release artifacts, keyed by artifact reference. */
198
+ RELEASES: R2Bucket;
199
+ /** The installation registry. */
200
+ REGISTRY: DurableObjectNamespace<OysterRegistry>;
201
+ /** One Durable Object per App Instance. */
202
+ INSTANCES: DurableObjectNamespace<OysterInstance>;
203
+ /** Worker Loader that runs App backends. */
204
+ LOADER: WorkerLoader;
205
+ }>, Readonly<{
206
+ instanceId: string;
207
+ binding: import("@fungi.computer/puffball/app").AppBackendBindingName;
208
+ frameId: string;
209
+ }>>;
210
+ /** The plain Oyster Worker's guest binding entrypoint. */
211
+ export declare class OysterBinding extends OysterBinding_base {
212
+ }
213
+ /**
214
+ * One App Instance: Oyster's lifecycle supervisor in this Durable Object's
215
+ * SQLite and the App backend in its `app` facet.
216
+ */
217
+ export declare class OysterInstance<Env extends OysterWorkerEnv = OysterWorkerEnv> extends DurableObject<Env> {
218
+ #private;
219
+ protected ctx: DurableObjectState<Record<never, never>> & Readonly<{
220
+ exports: Readonly<{
221
+ /** The root's one guest binding entrypoint; every binding name maps to it. */
222
+ OysterBinding(input: {
223
+ props: FrameBindingProps;
224
+ }): object;
225
+ }>;
226
+ }>;
227
+ /** The bindings this Instance serves; a root's Instance names its own table. */
228
+ protected readonly bindings: OysterBindingTable<Env>;
229
+ private runtime;
230
+ private limits;
231
+ private readonly frames;
232
+ /** Content-addressed backends are verified once per Instance, not per call. */
233
+ private readonly backends;
234
+ private readonly gitJournal;
235
+ constructor(ctx: DurableObjectState, env: Env);
236
+ /** The deployable root's host for one pinned tenant; this plain root is the single owner key. */
237
+ protected hostFor(scope: TenantScope): OysterHost;
238
+ /** Reconstruct current host admission for each wake; non-default tenants get no wakes. */
239
+ protected backgroundHost(): Promise<OysterHost | null>;
240
+ private localInstance;
241
+ private closeBackground;
242
+ private createRuntime;
243
+ private runtimeFor;
244
+ /** The tenant this Instance's host pinned at its first apply; never its guest frame. */
245
+ protected scope(): TenantScope;
246
+ private requireTenant;
247
+ /** The installation this Instance serves, once an owner state named it. */
248
+ protected installationId(): string | null;
249
+ /** Every binding name is the one entrypoint, routed by props; authority is checked per packet. */
250
+ private guestEnv;
251
+ /** Resolve each guest packet against its immutable frame before any host effect. */
252
+ bindingCall(raw: FrameBindingProps, method: string, input: readonly unknown[]): Promise<FrameBindingReply<OysterBindingResult>>;
253
+ private executeBindingCall;
254
+ /** Last provider-accepted ref recorded by this installation's journal. */
255
+ gitTip(installationId: string, repository: string, ref: string, tenantId?: TenantId): Promise<string | null>;
256
+ /** Join accepted fact identity and Carrier delivery in one local transaction. */
257
+ recordGitPush(installationId: string, fact: AppGitPushFact, tenantId?: TenantId): Promise<"recorded" | "duplicate">;
258
+ /** Carrier owns retries, dead letters and retained delivery receipts. */
259
+ alarm(): Promise<void>;
260
+ /** Installation changes end guest work; a Workflow cancel targets only its run. */
261
+ revoke(installationId: string, runId?: string, tenantId?: TenantId): Promise<void>;
262
+ /** One registry read re-admits a guest binding packet against its frame. */
263
+ private assertCurrent;
264
+ private withFrame;
265
+ private release;
266
+ /** Remember `release`, then apply the owner state under the host's tenant pin. */
267
+ apply(state: OwnerState, release: Release, limits: GuestLimits | undefined, tenant: Pick<TenantScope, "tenantId" | "origin">): Promise<InstanceResult<Instance>>;
268
+ /** Forward an admitted HTTP request to the App backend. */
269
+ backend(facts: InvocationFacts, request: Request, limits?: GuestLimits, tenantId?: TenantId): Promise<Response>;
270
+ /** Deliver a Git push through the same selected-Instance admission as methods. */
271
+ onGitPush(facts: InvocationFacts, fact: AppGitPushFact, limits?: GuestLimits, tenantId?: TenantId): Promise<void>;
272
+ /** Ask the App's declared authorizer through the same frame-bound connection. */
273
+ authorizeGitPush(facts: InvocationFacts, question: GitPushQuestion, limits?: GuestLimits, tenantId?: TenantId): Promise<GitPushVerdict>;
274
+ /** An available lane settles a refusal under an active frame with no binding grants. */
275
+ syncRefused(facts: InvocationFacts, refusal: BackgroundSyncRefusal, limits?: GuestLimits, tenantId?: TenantId): Promise<void>;
276
+ /** Invoke a Release-declared Gill in a fresh immutable frame. */
277
+ gill(facts: InvocationFacts, _api: AppApi, source: string, input: GillCall, limits?: GuestLimits, tenantId?: TenantId): Promise<InstanceResult<GillReply>>;
278
+ /** Invoke one declared App method; the value is its AppMethodReply wire,
279
+ * which the host handle decodes. */
280
+ call(facts: InvocationFacts, _api: AppApi, name: string, input: OysterJson, limits?: GuestLimits, tenantId?: TenantId): Promise<InstanceResult<OysterJson>>;
281
+ }
282
+ /** One host-selected workspace shared by App context and capability adapters. */
283
+ export type OysterWorkspace = Readonly<{
284
+ computerId: string;
285
+ files: FileSource;
286
+ /** Caller-scoped Computer calls; file-only workspaces omit it. */
287
+ computer?: OysterHost["computer"];
288
+ }>;
289
+ /** Host adapters for a standalone Oyster Worker over its own bindings. */
290
+ export declare function oysterWorkerHost(env: OysterWorkerEnv, auth: OysterAuth, options?: Pick<OysterHost, "guestLimits" | "appToolPolicy"> & Readonly<{
291
+ workspace?: OysterWorkspace;
292
+ scope?: TenantScope;
293
+ }>): OysterHost;
294
+ declare const OysterMcp_base: new (ctx: DurableObjectState, env: Readonly<{
295
+ /** The owner's sign-in key, at least 24 characters (a secret). */
296
+ OYSTER_OWNER_KEY: string;
297
+ /** The single-tenant owner's identity, also recorded by the existing fleet creator. */
298
+ OYSTER_OWNER_NAME?: string;
299
+ /** Optional existing fleet owner; absence grants no Agent storage authority. */
300
+ AGENT_DIRECTORY?: Readonly<{
301
+ /** Resolve the host-owned fleet directory by its existing durable name. */
302
+ getByName(name: string): Readonly<{
303
+ /** Return the recorded creator, or null when the Agent has no owner record. */
304
+ readCreator(agentId: string): Promise<string | null>;
305
+ }>;
306
+ }>;
307
+ /** Canonical configured origin; requests cannot choose the owner tenant. */
308
+ OYSTER_ORIGIN: string;
309
+ /** One tenant-scoped MCP session owner. Required when serving /mcp. */
310
+ MCP: DurableObjectNamespace<OysterMcpOwner>;
311
+ /** Release artifacts, keyed by artifact reference. */
312
+ RELEASES: R2Bucket;
313
+ /** The installation registry. */
314
+ REGISTRY: DurableObjectNamespace<OysterRegistry>;
315
+ /** One Durable Object per App Instance. */
316
+ INSTANCES: DurableObjectNamespace<OysterInstance>;
317
+ /** Worker Loader that runs App backends. */
318
+ LOADER: WorkerLoader;
319
+ }>) => OysterMcpOwner<Readonly<{
320
+ /** The owner's sign-in key, at least 24 characters (a secret). */
321
+ OYSTER_OWNER_KEY: string;
322
+ /** The single-tenant owner's identity, also recorded by the existing fleet creator. */
323
+ OYSTER_OWNER_NAME?: string;
324
+ /** Optional existing fleet owner; absence grants no Agent storage authority. */
325
+ AGENT_DIRECTORY?: Readonly<{
326
+ /** Resolve the host-owned fleet directory by its existing durable name. */
327
+ getByName(name: string): Readonly<{
328
+ /** Return the recorded creator, or null when the Agent has no owner record. */
329
+ readCreator(agentId: string): Promise<string | null>;
330
+ }>;
331
+ }>;
332
+ /** Canonical configured origin; requests cannot choose the owner tenant. */
333
+ OYSTER_ORIGIN: string;
334
+ /** One tenant-scoped MCP session owner. Required when serving /mcp. */
335
+ MCP: DurableObjectNamespace<OysterMcpOwner>;
336
+ /** Release artifacts, keyed by artifact reference. */
337
+ RELEASES: R2Bucket;
338
+ /** The installation registry. */
339
+ REGISTRY: DurableObjectNamespace<OysterRegistry>;
340
+ /** One Durable Object per App Instance. */
341
+ INSTANCES: DurableObjectNamespace<OysterInstance>;
342
+ /** Worker Loader that runs App backends. */
343
+ LOADER: WorkerLoader;
344
+ }>>;
345
+ /** The non-git standalone root's MCP owner. */
346
+ export declare class OysterMcp extends OysterMcp_base {
347
+ }
348
+ /**
349
+ * The standalone Worker's `fetch` handler; frontend hosts are cached per env.
350
+ * MCP transports belong to the tenant Durable Object, independent of that cache.
351
+ */
352
+ export declare function createOysterWorker(options?: Pick<OysterHost, "guestLimits">): ExportedHandler<OysterWorkerEnv>;