@fungi.computer/oyster 0.19.19 → 0.19.21

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.
@@ -46,6 +46,8 @@ export declare const gateRequestSchema: z.ZodLazy<z.ZodDiscriminatedUnion<[z.Zod
46
46
  kind: z.ZodLiteral<"list-tools">;
47
47
  }, z.core.$strict>, z.ZodObject<{
48
48
  kind: z.ZodLiteral<"backend">;
49
+ }, z.core.$strict>, z.ZodObject<{
50
+ kind: z.ZodLiteral<"background">;
49
51
  }, z.core.$strict>], "kind">>;
50
52
  /** One decoded method, route, binding or catalog admission request. */
51
53
  export type GateRequest = z.output<typeof gateRequestSchema>;
package/dist/apps/gate.js CHANGED
@@ -35,6 +35,7 @@ export const gateRequestSchema = z.lazy(() => z.discriminatedUnion("kind", [
35
35
  }),
36
36
  z.strictObject({ kind: z.literal("list-tools") }),
37
37
  z.strictObject({ kind: z.literal("backend") }),
38
+ z.strictObject({ kind: z.literal("background") }),
38
39
  ]));
39
40
  /** Binding grants have the exact S2 InvocationFacts shape and its maintained registry grammar. */
40
41
  export const invocationGrantsSchema = z.lazy(() => z
@@ -205,27 +206,45 @@ export function admits(facts, rawRequest) {
205
206
  if (facts.access?.level === "read")
206
207
  return refusal("level_too_low");
207
208
  return { kind: "admitted", grants: admittedBindings(facts) };
209
+ case "background":
208
210
  case "method": {
209
- const metadata = methodMetadata(facts, request.name);
211
+ const call = request.kind === "background"
212
+ ? {
213
+ name: facts.declaration.backend?.sync?.method,
214
+ input: {},
215
+ resource: undefined,
216
+ }
217
+ : request;
218
+ if (call.name === undefined)
219
+ return refusal("not_declared");
220
+ const metadata = methodMetadata(facts, call.name);
210
221
  if (metadata.kind === "refused")
211
222
  return metadata;
212
223
  const { method } = metadata;
224
+ if (request.kind === "background" && method.effect !== "write")
225
+ return refusal("not_declared");
213
226
  // The maintained JSON-Schema compiler can reject unsupported declared schemas.
214
227
  // Return the typed input refusal; never leak compiler diagnostics or throw from admission.
215
228
  try {
216
- const input = appMethodSchemas({ methods: { [request.name]: method } })[request.name]?.input;
217
- if (!input?.safeParse(request.input).success)
229
+ const input = appMethodSchemas({ methods: { [call.name]: method } })[call.name]?.input;
230
+ if (!input?.safeParse(call.input).success)
218
231
  return refusal("invalid_input");
219
- if (new TextEncoder().encode(JSON.stringify(request.input)).byteLength >
232
+ if (new TextEncoder().encode(JSON.stringify(call.input)).byteLength >
220
233
  64 * 1024)
221
234
  return refusal("invalid_input");
222
235
  }
223
236
  catch {
224
237
  return refusal("invalid_input");
225
238
  }
226
- const grantDenied = methodGrantRefusal(facts, method, request.resource);
227
- if (grantDenied !== null)
228
- return grantDenied;
239
+ // A continuation declares the union of all possible write requirements.
240
+ // Replay claims each sealed origin separately before capability effects;
241
+ // an unapproved, unrelated origin must not prevent an approved job running.
242
+ // The binding ceiling below still contains only current owner approvals.
243
+ if (request.kind === "method") {
244
+ const grantDenied = methodGrantRefusal(facts, method, call.resource);
245
+ if (grantDenied !== null)
246
+ return grantDenied;
247
+ }
229
248
  return {
230
249
  kind: "admitted",
231
250
  grants: admittedBindings(facts, method),
@@ -75,12 +75,7 @@ export async function deliverBackground(host, raw) {
75
75
  release.api?.methods[method]?.effect !== "write")
76
76
  return { kind: "refused", code: "denied" };
77
77
  const gate = await hostGateFacts(host, installation, release, principal);
78
- const verdict = admits(gate, {
79
- kind: "method",
80
- name: method,
81
- input: {},
82
- via: "ui",
83
- });
78
+ const verdict = admits(gate, { kind: "background" });
84
79
  if (verdict.kind === "refused") {
85
80
  switch (verdict.code) {
86
81
  case "unavailable":
package/docs/api/apps.md CHANGED
@@ -1796,10 +1796,10 @@ stay outside this pure gate.
1796
1796
 
1797
1797
  #### Parameters
1798
1798
 
1799
- | Parameter | Type |
1800
- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1801
- | `facts` | [`GateFacts`](#gatefacts) |
1802
- | `rawRequest` | \| \{ `kind`: `"method"`; `name`: `string`; `input`: `unknown`; `via`: `"ui"` \| `"agent"` \| `"mcp"` \| `"workflow"`; `resource?`: `Readonly`\<\{ `kind`: `string`; `id`: `string`; \}\>; \} \| \{ `kind`: `"capability"`; `capability`: \| `"computer.list"` \| `"computer.readFile"` \| `"computer.writeFile"` \| `"computer.execute"` \| `"approvals"` \| `"agent.list"` \| `"agent.manage"` \| `"agent.rename"` \| `"agent.avatar"` \| `"agent.toolPolicy"` \| `"agent.read"` \| `"agent.send"` \| `"llm.generation"` \| `"media.generation"` \| `"media.share"` \| `"games:servers"` \| `"git.repository"` \| `"apps.open"` \| `"apps.call"` \| `"app.storage"` \| `"app.events.emit"` \| `"team.workbenchHost"` \| `"marketplace.browse"` \| `"marketplace.purchase"` \| `"workflow.run"` \| `"workflow.publish"` \| `"workflow.arm"` \| `"world"` \| `"channels.read"` \| `"channels.personal.manage"`; `operation?`: `string`; `resource`: \| `"any"` \| `Readonly`\<\{ `kind`: `string`; `id`: `string`; \}\>; \} \| \{ `kind`: `"capability-route"`; `capability`: \| `"computer.list"` \| `"computer.readFile"` \| `"computer.writeFile"` \| `"computer.execute"` \| `"approvals"` \| `"agent.list"` \| `"agent.manage"` \| `"agent.rename"` \| `"agent.avatar"` \| `"agent.toolPolicy"` \| `"agent.read"` \| `"agent.send"` \| `"llm.generation"` \| `"media.generation"` \| `"media.share"` \| `"games:servers"` \| `"git.repository"` \| `"apps.open"` \| `"apps.call"` \| `"app.storage"` \| `"app.events.emit"` \| `"team.workbenchHost"` \| `"marketplace.browse"` \| `"marketplace.purchase"` \| `"workflow.run"` \| `"workflow.publish"` \| `"workflow.arm"` \| `"world"` \| `"channels.read"` \| `"channels.personal.manage"`; `operation`: `string`; `effect`: `"read"` \| `"write"`; \} \| \{ `kind`: `"binding"`; `binding`: \| `"BACKGROUND"` \| `"GIT"` \| `"EVENTS"` \| `"APPS"` \| `"WORKFLOWS"` \| `"APP_STORAGE"` \| `"MEDIA"` \| `"COMPUTER"` \| `"INBOX"` \| `"AGENTS"`; `operation`: `string`; \} \| \{ `kind`: `"list-tools"`; \} \| \{ `kind`: `"backend"`; \} |
1799
+ | Parameter | Type |
1800
+ | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1801
+ | `facts` | [`GateFacts`](#gatefacts) |
1802
+ | `rawRequest` | \| \{ `kind`: `"method"`; `name`: `string`; `input`: `unknown`; `via`: `"ui"` \| `"agent"` \| `"mcp"` \| `"workflow"`; `resource?`: `Readonly`\<\{ `kind`: `string`; `id`: `string`; \}\>; \} \| \{ `kind`: `"capability"`; `capability`: \| `"computer.list"` \| `"computer.readFile"` \| `"computer.writeFile"` \| `"computer.execute"` \| `"approvals"` \| `"agent.list"` \| `"agent.manage"` \| `"agent.rename"` \| `"agent.avatar"` \| `"agent.toolPolicy"` \| `"agent.read"` \| `"agent.send"` \| `"llm.generation"` \| `"media.generation"` \| `"media.share"` \| `"games:servers"` \| `"git.repository"` \| `"apps.open"` \| `"apps.call"` \| `"app.storage"` \| `"app.events.emit"` \| `"team.workbenchHost"` \| `"marketplace.browse"` \| `"marketplace.purchase"` \| `"workflow.run"` \| `"workflow.publish"` \| `"workflow.arm"` \| `"world"` \| `"channels.read"` \| `"channels.personal.manage"`; `operation?`: `string`; `resource`: \| `"any"` \| `Readonly`\<\{ `kind`: `string`; `id`: `string`; \}\>; \} \| \{ `kind`: `"capability-route"`; `capability`: \| `"computer.list"` \| `"computer.readFile"` \| `"computer.writeFile"` \| `"computer.execute"` \| `"approvals"` \| `"agent.list"` \| `"agent.manage"` \| `"agent.rename"` \| `"agent.avatar"` \| `"agent.toolPolicy"` \| `"agent.read"` \| `"agent.send"` \| `"llm.generation"` \| `"media.generation"` \| `"media.share"` \| `"games:servers"` \| `"git.repository"` \| `"apps.open"` \| `"apps.call"` \| `"app.storage"` \| `"app.events.emit"` \| `"team.workbenchHost"` \| `"marketplace.browse"` \| `"marketplace.purchase"` \| `"workflow.run"` \| `"workflow.publish"` \| `"workflow.arm"` \| `"world"` \| `"channels.read"` \| `"channels.personal.manage"`; `operation`: `string`; `effect`: `"read"` \| `"write"`; \} \| \{ `kind`: `"binding"`; `binding`: \| `"BACKGROUND"` \| `"GIT"` \| `"EVENTS"` \| `"APPS"` \| `"WORKFLOWS"` \| `"APP_STORAGE"` \| `"MEDIA"` \| `"COMPUTER"` \| `"INBOX"` \| `"AGENTS"`; `operation`: `string`; \} \| \{ `kind`: `"list-tools"`; \} \| \{ `kind`: `"backend"`; \} \| \{ `kind`: `"background"`; \} |
1803
1803
 
1804
1804
  #### Returns
1805
1805
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/oyster",
3
- "version": "0.19.19",
3
+ "version": "0.19.21",
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",